﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebCombo - Problem setting initial value of WebCombo</title><link>http://www.intersoftsolutions.com/Community/WebCombo/Problem-setting-initial-value-of-WebCombo/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Problem setting initial value of WebCombo</title><link>http://www.intersoftsolutions.com/Community/WebCombo/Problem-setting-initial-value-of-WebCombo/</link><pubDate>Tue, 25 Mar 2014 02:49:19 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;Snippet code of BindToDataTable.aspx file&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;&amp;lt;ISWebCombo:WebCombo ID="WebCombo1" runat="server" UseDefaultStyle="True"     Width="477px" Height="20px"
    DataTextField="FirstName" DataValueField="EmployeeID"
    OnInitializeDataSource="WebCombo1_InitializeDataSource"&amp;gt;
    &amp;lt;Columns&amp;gt;
        &amp;lt;ISWebCombo:WebComboColumn BaseFieldName="FirstName"
            Bound="True" HeaderText="FirstName" Name="FirstName"
            Width="100px" /&amp;gt;
        &amp;lt;ISWebCombo:WebComboColumn BaseFieldName="LastName"
            Bound="True" HeaderText="LastName" Name="LastName" /&amp;gt;
        &amp;lt;ISWebCombo:WebComboColumn BaseFieldName="Title"
            Bound="True" HeaderText="Title" Name="Title"
            Width="200px" /&amp;gt;
    &amp;lt;/Columns&amp;gt;
    &amp;lt;LayoutSettings ComboMode="MultipleColumns" TextBoxMode="ReadOnly"&amp;gt;
    &amp;lt;/LayoutSettings&amp;gt;
&amp;lt;/ISWebCombo:WebCombo&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;Snippet code of BindToDataTable.aspx.cs&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;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 &amp;lt; 5; i&amp;#43;&amp;#43;)
    {
        DataRow dr = dt.NewRow();
        dr["EmployeeID"] = i;
        dr["FirstName"] = "John" &amp;#43; i;
        dr["LastName"] = "Doe" &amp;#43; i;
        dr["Title"] = "Owner";
        dt.Rows.Add(dr);
    }
    e.DataSource = dt;
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;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).&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;WebCombo1.Value = "3";&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;I’m able to see a value selected in the WebCombo.&lt;/span&gt;&lt;/p&gt;&lt;img style="height: 290px; width: 516px;" src="https://dm2303files.storage.live.com/y2pot1SPRu-QmUge1Y2QYlp9avt49vqgcPplaM_ya5OVExVF6tTvq9aJ2nb4UcuAADI/WebCombo_SetValue.jpg?psid=1&amp;amp;ck=1&amp;amp;ex=720" /&gt;
&lt;p&gt;&lt;span style="color: rgb(31, 73, 125);"&gt;Please feel free to let us know whether this helps or not.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Problem setting initial value of WebCombo</title><link>http://www.intersoftsolutions.com/Community/WebCombo/Problem-setting-initial-value-of-WebCombo/</link><pubDate>Fri, 21 Mar 2014 09:03:10 GMT</pubDate><dc:creator>kejohnson</dc:creator><description>I have a WebCombo where the DataSource is set to a collection of objects. &amp;nbsp;I have added several properties from each object as a WebComboColumn. &amp;nbsp;I set DataValueField = "Id" and DataTextField = "Name", both of which are properties on the DataSource object. &amp;nbsp;I have a page containing a WebCombo where I want to set the currently selected item of the WebCombo to the object that is loaded by the page. &amp;nbsp;I have attempted to set the Value property to the value of the Id property of the object. &amp;nbsp;However, I am unable to see a value selected in the WebCombo. &amp;nbsp;When DataBind on the WebCombo is called, the Value property seems to be cleared and the WebCombo is blank. &amp;nbsp;I have tried setting the Value at several different times and have had no luck. &amp;nbsp;Please help.
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;Also, the code that I currently have has worked fine for years but no longer works after I upgraded to version 6 of WebCombo from version 2.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;Thanks.&lt;/div&gt;</description></item></channel></rss>