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>
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.
Hi again,I am still following your case. Have you been able to resolve the issue?
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.
How can I bind data on rowislandspopulating event to a Item Template field ?
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.