iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi
I have bound WebGrid to DataSet. I get DataSet from a WCF Service.
Please have a look on attached picture.
In Listbox you can see all rows.
But the WebGrid shows only the roottable and the first childtable! Why?
I can reproduce this behavoir only if i get DataSet from a WCF Service! It works, if i copy the method ProductHierarchy_Sel() to local page.
What could be the problem?
DataSet ds2; protected void Page_Load(object sender, EventArgs e) { using (proxyRelays.MasterdataClient proxyMasterdata = new QS_Client.proxyRelays.MasterdataClient()) { ds2 = proxyMasterdata.ProductHierarchy_Sel(); } foreach (DataRow family in ds2.Tables["ProductFamily"].Rows) { ListBox1.Items.Add(family["Name"].ToString()); foreach (DataRow nr in family.GetChildRows("relFamilyContactNr")) { ListBox1.Items.Add("...." + nr["Name"].ToString()); foreach (DataRow var in nr.GetChildRows("relContactNrContactVariant")) { ListBox1.Items.Add("........" + var["Name"].ToString()); foreach (DataRow c in var.GetChildRows("relContactVariantCoil")) { ListBox1.Items.Add("..........." + c["Name"].ToString()); } } } } } protected void grd2_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { e.DataSource = ds2; grd2.DataMember = "ProductFamily"; grd2.RootTable.DataMember = "ProductFamily"; } protected void grd2_PrepareDataBinding(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { if (!Page.IsPostBack) { grd2.ClearCachedDataSource(); grd2.RetrieveHierarchicalStructure(); } }
The method ProductHierarchy_Sel()
public DataSet ProductHierarchy_Sel() { SqlConnection cn = new SqlConnection(); cn.ConnectionString = ConfigurationManager.ConnectionStrings["QS-SYS"].ConnectionString; cn.Open(); using (cn) { SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandText = "EXEC Product.Family_SelWithDep;EXEC Product.ContactNr_SelWithDep;EXEC Product.ContactVariant_SelWithDep;EXEC Product.Coil_SelWithDep"; SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; da.TableMappings.Add("Table", "ProductFamily"); da.TableMappings.Add("Table1", "ProductContactNr"); da.TableMappings.Add("Table2", "ProductContactVariant"); da.TableMappings.Add("Table3", "ProductCoil"); DataSet ds = new DataSet(); da.Fill(ds); da.FillSchema(ds, SchemaType.Mapped); DataRelation rel; rel = new DataRelation("relFamilyContactNr", ds.Tables["ProductFamily"].Columns["ID"], ds.Tables["ProductContactNr"].Columns["FamilyID"]); ds.Relations.Add(rel); rel = new DataRelation("relContactNrContactVariant", ds.Tables["ProductContactNr"].Columns["ID"], ds.Tables["ProductContactVariant"].Columns["ContactNrID"]); ds.Relations.Add(rel); rel = new DataRelation("relContactVariantCoil", ds.Tables["ProductContactVariant"].Columns["ID"], ds.Tables["ProductCoil"].Columns["ContactVariantID"]); ds.Relations.Add(rel); return ds; } }
Based on the provided snippet I have create a sample project to test the scenario. Using all the latest build from WebUI Studio 2009 R2 and northwind.mdf, already provided in the WebGrid sample, we could not replicate the issue. Attached is the sample project we use to recreate the scenario, the database and dll is not inculded to reduce the size of the attachment.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname