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
Snippet code of BindToDataTable.aspx file
<ISWebCombo:WebCombo ID="WebCombo1" runat="server" UseDefaultStyle="True" Width="477px" Height="20px" DataTextField="FirstName" DataValueField="EmployeeID" OnInitializeDataSource="WebCombo1_InitializeDataSource"> <Columns> <ISWebCombo:WebComboColumn BaseFieldName="FirstName" Bound="True" HeaderText="FirstName" Name="FirstName" Width="100px" /> <ISWebCombo:WebComboColumn BaseFieldName="LastName" Bound="True" HeaderText="LastName" Name="LastName" /> <ISWebCombo:WebComboColumn BaseFieldName="Title" Bound="True" HeaderText="Title" Name="Title" Width="200px" /> </Columns> <LayoutSettings ComboMode="MultipleColumns" TextBoxMode="ReadOnly"> </LayoutSettings> </ISWebCombo:WebCombo>
Snippet code of BindToDataTable.aspx.cs
protected void WebCombo1_InitializeDataSource(object sender, ISNet.WebUI.WebCombo.DataSourceEventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("EmployeeID", typeof(int))); dt.Columns.Add(new DataColumn("FirstName", typeof(string))); dt.Columns.Add(new DataColumn("LastName", typeof(string))); dt.Columns.Add(new DataColumn("Title", typeof(string))); for (int i = 0; i < 5; i++) { DataRow dr = dt.NewRow(); dr["EmployeeID"] = i; dr["FirstName"] = "John" + i; dr["LastName"] = "Doe" + i; dr["Title"] = "Owner"; dt.Rows.Add(dr); } e.DataSource = dt; }
As shown in the above snippet code, I have a simple sample of WebCombo where the DataSource is set to a DataTable on InitializeDataSource event.
In order to set a value of WebCombo, I simply add following line in the code behind (where value property of WebCombo is set to the id property of the DataTable).
WebCombo1.Value = "3";
I’m able to see a value selected in the WebCombo.
Please feel free to let us know whether this helps or not.
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