|
-
May 18th, 2003, 02:58 AM
#1
Thread Starter
Lively Member
Avoiding DataGrid Adding New Rows
Hi All,
Is there a way to avoid the DataGrid from adding new line in it.
I managed to do it by doing the following:
dg1.ReadOnly = True, but the problem in this the user will not be able to change any existing data in it.
Thanks for the help.
<><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><>
-
May 18th, 2003, 07:09 AM
#2
Frenzied Member
You have to bind your datagrid to a Dataview and set the data view Allownew to False. If you dotn want ppl to delete rows you can set AllowDelete to False and if not editable set AllowEdit to False.
You can define a new dataview or even you can use the dataset table default view to manage it.
Last edited by Lunatic3; May 19th, 2003 at 03:49 AM.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
May 18th, 2003, 04:58 PM
#3
Thread Starter
Lively Member
Thank Lunatic3 for your reply,
Do you mean I have to use a DataView insted of the DataSets I am using?
If yes, will I be able to save the changed back to my table using DataView?
Note:
My DataSet has about 7 tables in it with a relation between them, what the case will be if I used the DataView ?
Thank in advance.
<><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><>
-
May 19th, 2003, 03:48 AM
#4
Frenzied Member
Yes, you may use a Dataview and bind your datagrid to that. Dataview is the top most view of your table. Any change you make to that will affect the underlying dataset table. It doesnt matter if you have relations in your dataset tables. The relations are some rules, so it doesnt matter how you manipulate the data in datatable, you just have to keep the rules.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
May 19th, 2003, 04:57 AM
#5
Thread Starter
Lively Member
Thnak you Lunatic3
<><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|