Hello
I have a WHDG binds to flat dataset. I make the relations via WHDS. If I set InitialDataBindDepth property to 1 there is no problem it can bind the child row without problems. But I want to bind the data with LoadOnDemand method. So if I set the InitialDataBindDepth to 0, it can see which parent record has child but it cannot bind data.
Here is my code (C#)
dsMessages = Messages.MesajGetir(RezervasyonRef, 3, 1); dsKullanici = Messages.KisiGetir(RezervasyonRef, 0, 1); dtMessages = dsMessages.Tables[0]; dtMessages.TableName = "tableMesaj"; dtKullanici = dsKullanici.Tables[0]; dtKullanici.TableName = "tableKisi"; Infragistics.Web.UI.DataSourceControls.DataView dvKisi = new Infragistics.Web.UI.DataSourceControls.DataView(); dvKisi.ID = "vBaslik"; dvKisi.DataMember = "tableKisi"; dvKisi.DataSource = dtKullanici;
#region comment dvMesaj Infragistics.Web.UI.DataSourceControls.DataView dvMesaj = new Infragistics.Web.UI.DataSourceControls.DataView(); dvMesaj.ID = "vMesaj"; dvMesaj.DataMember = "tableMesaj";
dvMesaj.DataSource = dtMessages;
whdsShowMessages.DataRelations.Clear(); whdsShowMessages.DataViews.Clear(); whgridShowMessages.Rows.Clear();
whdsShowMessages.DataViews.Add(dvKisi); whdsShowMessages.DataViews.Add(dvMesaj);
Infragistics.Web.UI.DataSourceControls.DataRelation drel = new Infragistics.Web.UI.DataSourceControls.DataRelation("vBaslik", "ID", "vMesaj", "ID"); whdsShowMessages.DataRelations.Add(drel); #endregion whgridShowMessages.DataSource = whdsShowMessages; whgridShowMessages.DataBind();
and here is the (.aspx)
<ig:WebHierarchicalDataSource ID="whdsShowMessages" runat="server"> </ig:WebHierarchicalDataSource> <ig:WebHierarchicalDataGrid ID="whgridShowMessages" runat="server" InitialDataBindDepth="0" Width="100%" DataKeyFields="ID" AutoGenerateColumns="False" Key="whgridShowMessages" AutoGenerateBands="False" onrowislandspopulating="whgridShowMessages_RowIslandsPopulating" > <Columns> <ig:TemplateDataField Key="AdiSoyadi"> <Header Text="Gönderen"> </Header> <ItemTemplate > <asp:Label CssClass="selam" ID="lblRoom" runat="server" Text='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "AdiSoyadi") %>'> </asp:Label> </ItemTemplate> </ig:TemplateDataField> <ig:TemplateDataField Key="Tarih"> <Header Text="Tarih"> </Header> <ItemTemplate > <asp:Label CssClass="selam" ID="lblRoom" runat="server" Text='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Tarih") %>'> </asp:Label> </ItemTemplate> </ig:TemplateDataField> </Columns> <Bands> <ig:Band Key="MessageContent" DataKeyFields="ID" DataMember="vMesaj" AutoGenerateColumns="False"> <Columns> <ig:TemplateDataField Key="Mesaj"> <header text="Mesaj" /> <itemtemplate> <asp:Label CssClass="selam" ID="lblRoom" runat="server" Text='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Mesaj") %>'> </asp:Label> </itemtemplate> </ig:TemplateDataField> </Columns> </ig:Band> </Bands> </ig:WebHierarchicalDataGrid>
I've solved the issue. The problem is my grid filler method is not posting back. But there is a problem. First of all I fetch datas of parent rows. And for the child rows I'm creating a DataTable and filling them with parent's DataTable's IDs and create a relation between them. And then in rowislandspopulating event I'm filling row island with real data. But if I try to expand it, on first click shows data but on second try there is nothing.
Hi Kerem Kambur,
I think the following link to our forum will be helpful for you: Manual load on demand and handling RowIslandsPopulating server side event.
Also if there is any other concern, it will be good if you attach an working example where the issue can be observable. It will be easier for us to observe/debug/understand the problem.
Please tell me whether this helps you.
Hi again,I am still following your case. Have you been able to resolve the issue?
Hi Petko,
Thank you for interesting with my problem. My code is based on example of yours ThreeLevelsManualLoadOnDemandSample. I've tried some changes in it. Here is my work. It can bind parent level but if I try to expand no child grid descriptor error occurs. I've tried autogenerate bla bla properties and without them.
Images are querie results of datatables. I thought it might help.
I've handled problem by formatting container grid's column's dataformatstring. Thanks for interesting.
Is there anything else that I can help you with?
again our colleagues have answered a similar question, so you can use it as a source of knowledge:
Add Columns from code behind
The examples and knowledge base are related to WebDataGrid instead of WebHierarchicalDataGrid, but the approach is the same.
Please, let me know whether this helps you!
Hi Petko
I've solved the problem by changing relations. But now I have another problem. I have two container grids having my data. But I need to add templatefields to containers. I need to add asp Label as template because I've some html formatted texts. How can I do this ?
I was able to find again few posts in our forum that may helps you:
why does 'no child grid script descriptors are available' error come?
Getting 'no child grid script descriptors are available' error
Runtime Exception: No child grid script descriptors are available!
However I was not able to run your project because of the missing dependency - TBS.cls .
If links do not help you, please provide me this class or other sample that I can run.