In a telerik:RadGrid, I specify that every line will have a detail table:
<telerik:RadGrid ID="grd" AutoGenerateColumns="False" runat="server" OnDetailTableDataBind="grd_OnDetailTableDataBind" AllowMultiRowSelection="True"> <MasterTableView DataKeyNames="id1,id2"> <Columns> <telerik:GridClientSelectColumn UniqueName="DetailCheckColumn"/> <telerik:GridBoundColumn HeaderText="Date" DataField="foo"/> <telerik:GridBoundColumn HeaderText="Time" DataField="bar"/> <telerik:GridBoundColumn HeaderText="Activity" DataField="xod"/> </Columns> <DetailTables> <telerik:GridTableView ShowHeadersWhenNoRecords="True" DataKeyNames="id" Name="Child"/> </DetailTables> </MasterTableView> <ClientSettings> <Selecting AllowRowSelect="true"/> </ClientSettings> </telerik:RadGrid>In the handler for the OnDetailTableDataBind event, I specify the data source for the DetailTableView. The handler is called when a line is expanded. Setting a list of anonymous objects as data source works fine, but a list of Dictionary will not.
I get a yellow page, It seems like the grid table view tries to find a property id of Dictionary
DataBinding: System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] does not have a property with the name id.
If I remove the DataKeyNames attribute in the detail table, I will get a detail table with the correct number of lines, but the fields will be all blank (screenshot is attached).
The event handler where I create the detail table for each expanded line. Observe that I name columns c1, c2 etc. I create the columns in the first loop round.
protected void grd_OnDetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e){ var tv = e.DetailTableView; var parentItem = e.DetailTableView.ParentItem; var bis = dal.get_booking_informations(); tv.Columns.Add(new GridClientSelectColumn()); var columnNameDict = new Dictionary<string,string>(); var firstDict = true; var dicts = bis.GroupBy(bi=>bi.platsBokadID).Select(group => { var dict = new Dictionary<string, string>(); dict["id"] = "" + group.Key; var list = group.ToList(); if (firstDict) { firstDict = false; var num = 0; var columns = list.Select(header=> { var shortName = "c" + ++num; columnNameDict[header.HeaderName] = shortName; return new GridBoundColumn { DataField = shortName, HeaderText = header.HeaderName }; }); foreach(var column in columns) tv.Columns.Add(column); } foreach(var header in list) { var shortName = columnNameDict[header.HeaderName]; dict[shortName] = header.Value; } return dict; }); tv.DataSource = dicts;}I have also tried to use dynamic objects instead of Dictionaries (with the same result):
protected void grdActivitiesToCopy_OnDetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e){ var tv = e.DetailTableView; var parentItem = e.DetailTableView.ParentItem; var bis = dal.get_booking_informations(); tv.Columns.Add(new GridClientSelectColumn()); var columnNameDict = new Dictionary<string,string>(); var firstDict = true; var dicts = bis.GroupBy(bi=>bi.platsBokadID).Select(group => { var dict = new Dictionary<string, object>(); dict["id"] = "" + group.Key; var list = group.ToList(); if (firstDict) { firstDict = false; var num = 0; var columns = list.Select(header=> { var shortName = "c" + ++num; columnNameDict[header.HeaderName] = shortName; return new GridBoundColumn { DataField = shortName, HeaderText = header.HeaderName }; }); foreach(var column in columns) tv.Columns.Add(column); } var eo = new ExpandoObject(); var eoColl = (ICollection<KeyValuePair<string, object>>)eo; foreach(var header in list) { var shortName = columnNameDict[header.HeaderName]; dict[shortName] = header.Value; } foreach (var kvp in dict) { eoColl.Add(kvp); } dynamic eoDynamic = eo; return eoDynamic; }).ToList(); tv.DataSource = dicts;}

hi everboy i'm new to RadGrid and i found this example at site
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=grid
and i copy all file and this work find, but when it run this show error, plz help me, thank


Hi,
I've read as many of the posts on this topic as I can but just can't get it to work for me.
Please the attached image - I want to get rid of the grey area and move the details rows left, underneath the expand-collapse icons.
Thanks in advance,
Jack


Currently, the RadPanelBar can only act as a tab strip (role="tabstrip"). (Actually, the current implementation is missing the role="tabstrip" attribute, so it's basically invalid and only a collection of incoherent tabs.)
The RadPanelBar, however, is rather a menu. It may, semantically, even rather be a tree view, too.
It depends on the usage on a web page what the RadPanelBar is actually supposed to represent.
So I suggest to add an enumeration property to the RadPanelBar enabling developers to designate it either
Regards,
Axel
In BatchEdit mode when clicking "Cancel Changes" CommandName returns "RebindGrid" and not Cancel. What do I need to do to receive Cancel on server side when Cancel Changes is clicked?
Hi Team,
I am using RadGrid inside RadAjaxPanel.
But RadGrid's function OnInfrastructureExporting="RadGrid1_InfrastructureExporting" is not working after adding RadAjaxPanel.
If i delete RadAjaxPanel then everything works fine.
Please let me know where exactly i am doing a mistake.
Thanks & Regards,
Jatin
I have put 7 FormView inside the RadPageView by using RadTabStrip/RadMultiPage. I am using the databind to the FormView. every time When I save, it only save the FormView data in first RadPageView, the rest are not saved. But try to save again, the all FormView data will be saved now, every time it required 2 time saving for all the FormView, May I know the reasons? where goes wrong?
