I have 2 table that's Customer and Bill,i also 2 RadGrid , i want Radgrid1 containing Customer Information and Radgrid2 (In <NestedViewTemplate> ) containing Bill information with condition is CustomerID= Value when i click Expand
What's should i do ?
http://nguy-hiem.co.cc/share/567.png
THANKS !
9 Answers, 1 is accepted
Have look at this online demo showing hierarchy in RadGrid with NestedViewTemplate. Basically you need to use the ParentTableRelation setting and specify there the MasterKeyField and DetailKeyField properties in order to relate the two table.
Greetings,Marin
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
THANK !
You can have a look at this help article showing how you can access a value from a cell of the grid.
Regards,Marin
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
THANK A LOT !
You can use the GetDataKeyValue method of the grid item, but you should have set the primary key as DataKeyName for the grid.
<telerik:RadGrid ID="RadGrid1" runat="server" ...> <MasterTableView DataKeyNames="CustomerID">protected void grid_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == RadGrid.ExpandCollapseCommandName) { //CustomerID should be set as DataKeyNames for the parent in order for this code to work correctly var id = (e.Item as GridDataItem).GetDataKeyValue("CustomerID"); } }Marin
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
http://nguy-hiem.co.cc/share/ask.png (what's event i can use in RadGrid2)
THANK
Check whether the CommandName is "ExpandCollapse" and also check for OwnerTableView's Name in ItemCommand event. Hope this helps you.
C#:
protected void RadGrid2_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "ExpandCollapse" && e.Item.OwnerTableView.Name == "DetailTable") { //your code }
}
Thanks,
Princy