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
Latest Development Blogs
ForumPostTopic
Browse By Tag
I have a grid that is using CachedDataSource(). Above the grid the user can enter information and save to the database. The save method returns the saved data that I want to display in the grid.
I tried
WebGrid1.ClearCachedDataSource();
WebGrid1.Datasource = ds;
WebGrid1.Databind();
However the grid didn't not refresh. Again this update is being done outside of the webgrid, so there is no AcceptAllChanges. So above the grid is a dropdown(column) and textbox (value) and button that will save this save to the database. The database will return a new dataset with the updated data. I want to bind that new data to existing grid.
Hi Tenika,
If you want to bind the data, you need to put the code inside InitializeDataSource event. As well for modified outside of the grid, you could use this code to refresh the data :
protected void btnSave_Click(object sender, EventArgs e) { DataSet ds = SaveDataReturnsNewDataSet(DropDownList1.SelectedValue, TextBox1.Text); if (ds != null) { WebGrid1.ClientAction.Refresh(); } }
The code will InitializeDataSource and get the latest data.
Regards,
Julia
We recommended you to use e.DataSource = dt; instead of WebGrid1.DataSource = dt; and then placed it in WebGrid1_InitializeDataSource event. Also, you don't need to add code WebGrid1.ClearCachedDataSource(); and WebGrid1.Databind();
Below is an attachment of my simple sample on how to bind from server side that we recommended. Please find a file name BindServerSide.rar. You could use this method when you want to create server side binding.
I hope this can help.
Julia,
I know how to bind to the WebGrid when I'm modifying the grid but like I mentioned above this is modifying the data OUTSIDE of the gird.
<asp:dropdownlist id="ddlList" runat="server"></asp:dropdownlist>
<asp:textbox id="txtValue" runat="Server"></asp:textbox>
<asp:button id="btnSave" runat="Server" onclick="btnSave_Click"></asp:button>
<ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="600px" UseDefaultStyle="false" Width="100%" OnInitializeDataSource="WebGrid1_InitializeDataSource"OnPrepareDataBinding="WebGrid1_PrepareDataBinding" oninitializelayout="WebGrid1_InitializeLayout"oninitializerow="WebGrid1_InitializeRow" onbatchupdate="WebGrid1_BatchUpdate">
</ISWebGrid:WebGrid>
..
protected void btnSave_Click(object sender, Event Args e)
{
DatSet ds = SaveDataReturnsNewDataSet(ddlList.SelectedValue, txtValue.Text);
if (ds != null) {
WebGrid1.DataSource = ds;
WebGrid1.DataBind();
}
This is what I'm looking for...
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