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
I have an Hierarchical Grid with one Child table.
The rootTable has a DataMember filled by a storedProcedure and I use for this Datasource
a FilterExpression attribute and a FilterParameters tag:
<FilterParameters> <asp:ControlParameter PropertyName="Text" Name="invoicenumber" ControlID="TextBox1"></asp:ControlParameter> </FilterParameters>
The child Table has a DataMember filled by a storedProcedure which has as input parameter
a ControlParameter:
<asp:ControlParameter ControlID="TextBox2" ConvertEmptyStringToNull="True" DefaultValue="" Name="productnumber" PropertyName="Text" Type="String" />
So the stored procedure use this parameter to make the query.
I added a button on my application and inside the Button event I put this code to refresh the data:
WebGrid1.DataBind();
So the data of the root table is refreshed but the data of the child table no.
Why?
The same thing if I remove the ControlParameter for the DataMember used for the childTable
and use I FilterExpression attribute and a FilterParameters tag.
So how to refresh the also data of the ChildGrid for a Hierarchical Grid?
Thanks in advanced.
Best regards,
Daniele Barbini
You can try to use following code in order to refresh WebGrid child tables only.
function refreshChild() { var grid = ISGetObject("WebGrid1"); grid.Tables["Orders"].Refresh(); }
Hope this helps.
Ok I start the filter by a button,
and on the c# code in the OnButtonClick event I call:
MyWebgrid.DataBind();
and the root table is refreshed in the right way but the child table no.
So where I have to put the code to call the java script function
that you suggested me.
thanks
Daniele
In order to call the Javascript function from C# code in the OnButtonClick event you can use InvokeScript method.
The snippet code below shows how to call refreshChild() Javascript function from C# OnButtonClick event.
protected void Button1_Click(object sender, EventArgs e) { WebGrid1.ClientAction.InvokeScript("refreshChild();"); }
Hi,
I put your code inside the OnClick event,but the java script function is not invoked.
But if I put your code inside the loadPage event for the message LoadChild the JavaScript
function is invoked but the child is not refreshed yet.
The only way ,I found to filter also the child, is to create a local filter by javascript:
var grid1 = ISGetObject("WebGrid1");
var grid1Child = grid1.Tables["TableName"]; var newFilter = new WebGridFilter(); // create new Filter configuration newFilter.ColumnMember = "productnumber"; newFilter.FilterType = "Like"; newFilter.FilterText = document.getElementById('TextBox1').value; grid1Child.FilteredColumns.Add(newFilter); grid1Child.UpdateUI(); grid1Child.Refresh();
and call it in the event client click button.
In this way I'm be able to flter also the child table.
My problem now is that if I don't open at least one time the child grid
I get a java script error on the function:
grid1Child.UpdateUI();
Is there a way to avoid this?
Thanks a lot
Daniele Barbini.
From your previous post, it seems that your original required scenario is to filter the child table of hierarchical WebGrid from code-behind.
I made a simple sample of a test page of this specific scenario. In my test page, “Supplier” and “Products” table of Northwind database is bind to the WebGrid to create a hierarchical grid – where “Products" table is the child table. An ASP.NET button is then added to filter the child table based on the “Discontinued” field. It will filter the “Products” table where Discontinued field equals to “False”.
I simply use following snippet code to implement this scenario.
protected void Button1_Click(object sender, EventArgs e) { WebGridFilter ChildFilter = new WebGridFilter(); ChildFilter.ColumnMember = "Discontinued"; ChildFilter.FilterText = "False"; ChildFilter.FilterType = ColumnFilterType.EqualTo; WebGrid1.RootTable.ChildTables.GetNamedItem("Products").FilteredColumns.Add(ChildFilter); }
The test page is enclosed as an attachment. Please have the attached sample page tested on your end and let us know your response.
RE:
I am using ObjectDataSource. I do not know what the TableName is, as this is not a property of the WebGrid.
How do I refresh the grid?
None of this works...
To Daniele Barbini and Jaques Els:
We are willing to advice you further but in order to do so we would need you to elaborate on your specific scenario and possibly give us a step-by-step guide that we can use to observe the problematic behavior.
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