Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Avoiding DataGrid Adding New Rows
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00789791
Message ID:
00790311
Views:
15
I really thank you Cathi, you always give me a great help…

I think your sample coded in the language that I hate (C# ) correct! :)

Why should I make 2 views (parent & child) & are they for the same datatable ?
& what (intIndex) represents ?

I worked also with Plamen’s code, it works fine but I could not figure out how it work with relations.



>Ahmad,
>
>The DataRowView object exposes a CreateChildView method. You can supply the name of the DataRelation and the method returns a DataView object set to display just the child rows using that relationship.
>
>Your code would look something like this:
>
>
>DataView vueParent = dsParent.ParentTable.DefaultView;
>DataRowView rowParent = vueParent[intIndex];
>DataView vueChild = rowParent.CreateChildView("RelationName");
>gridChild.DataSource = vueChild;
>gridChild.DataBind();
>
>
>
>>Hi Cathi,
>>
>>Thank you for your reply.
>>I am using a DataSet with 7 DataTables and have a DataRelation between them, if I used DataView with the table that I need to use it in the DataGrid I think I'll lose the DataRelation to that table ( correct? ).
>>
>>And if I replaced the DataSet with DataView, I can't make a DataRelation in DataView, if I am not misstaken.
>>
>>Do you agree with me Cathi?
>>
>>
>>
>>>Hi Ahmad,
>>>
>>>You need to bind the DataGrid to a DataView and then set the AllowNew property of the DataView to false. This will remove the row with the "*" from the DataGrid.
>>>
>>>>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.
>>>>
>>>>Thank for the help.
<><><><><><><><><><><><><><><><><><><><>
<><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
<><><><><><><><><><><><><><><><><><><><>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform