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
65
WebDropDown SelectedItem.Text oder Value Error?
posted

1.) To "pre-filter" the data from a large table i do this in the

WebDropDown1_ItemsRequested - Event:

this.SqlDataSource1.SelectCommand = string.Format("SELECT IDX,PARAMETER FROM MASTER.K_PARAMETER WHERE PARAMETER LIKE '{0}%'", e.Value.ToString().ToUpper()); this.WebDropDown1.DataBind();

so far so good, it works

2.) I've selected a value in the WebDropDown

3.) I fire a WebImageButton1_Click ... Event

    this.WebTextEdit1.Text = this.WebDropDown1.SelectedItem.Text;

4.) Error:    SelectedItem.Text is null

kind regards

Parents
No Data
Reply
  • 24671
    posted

    Hello Andreas,

    Thanks for your feedback. I have attached a WebSite project where I have a WebDropDown and WebTextEdit, and select and item, then click the "Set Text" button which does a postback, and the selectedItem.Text is correcty set in the WebTextEdit input box.

    Maybe you have EnableMultipleSelection=true ? In that case SelectedItem will always be null, and you will need to refer to the SelectedItems collection property (if only one item is selected, your item will be in WebDropDown1.SelectedItems[0], and will be the same thing as WebDropDown1.SelectedItem).

     

    I hope this helps.

    Regards,

    Angel 

    WebSite27.zip
Children