Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
Set a specific value as a selected value in the combo box
posted
Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

Hi All

In my web application user can select a value from a  webcombo for an example user can select his favorite sport and save it. My problem is when user login and visit back to that page his favorite sport should be selected in the web combo . Please post the code for that.  I'm using NetAdvantage for .NET 2008 Vol. 2 CLR 3.5.

Thanks in advance 

Parents
No Data
Reply
  • 75
    Verified Answer
    posted

    Hi Bugzila,

    I guess you can hook the DataBound event of the combo (at your Page-Load event) and then deside which record to be selected one.

    You can use this sample code and modify it to suite your needs:

            protected void Page_Load(object sender, EventArgs e)
            {
                WebCombo1.DataBound += new EventHandler(WebCombo1_DataBound);
            }

            void WebCombo1_DataBound(object sender, EventArgs e)
            {
                WebCombo1.SelectedRow = WebCombo1.Rows[2];

            }

Children