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
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using ISNet.WebUI.WebGrid; namespace TestWebGrid { public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void WebGrid1_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("CustomerID", typeof(string))); dt.Columns.Add(new DataColumn("CompanyName", typeof(string))); dt.Columns.Add(new DataColumn("Phone", typeof(string))); //if (((ISNet.WebUI.WebGrid.WebGrid)(sender)).ActionName == PostBackAction.LoadData) //{ for (int i = 1; i <= 20; i++) dt.Rows.Add(new object[] { i.ToString(), "Company " + i.ToString(), "12345678" + i.ToString() }); //} e.DataSource = dt; } protected void WebGrid1_PrepareDataBinding(object sender, DataSourceEventArgs e) { WebGrid1.RetrieveStructure(); } } }
File Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestWebGrid.Default" %>
<%@ Register assembly="ISNet.WebUI.WebGrid" namespace="ISNet.WebUI.WebGrid" tagprefix="ISWebGrid" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="250px" UseDefaultStyle="True" Width="500px" BindingOperationMode="ClientBinding" OnInitializeDataSource="WebGrid1_InitializeDataSource" OnPrepareDataBinding="WebGrid1_PrepareDataBinding"> <LayoutSettings AllowContextMenu="False" ContextMenuAnimation="False" AlwaysShowHelpButton="False"> </LayoutSettings> </ISWebGrid:WebGrid> </div> <div> </div> </form> </body> </html>
Regards
I managed to resolve this by removing RetrieveStructure() from PrepareDataBinding and add it to OnLoad server-side event (such as shown in the following snippet code).
protected void WebGrid1_PrepareDataBinding(object sender, DataSourceEventArgs e) { // remove RetrieveStructure from // PrepareDataBinding server-side event // WebGrid1.RetrieveStructure(); } protected void WebGrid1_Load(object sender, EventArgs e) { // invoke RetrieveStructure in // OnLoad server-side event WebGrid1.RetrieveStructure(); }
Hope this helps.
I will have this discussed with the WebGrid development team. I will get back to you with any news regarding this.
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