سؤال

I am trying to set a value for a radcombobox based on the textchanged event(updatestatus) of one textbox.

Its not changing the value.

  <telerik:RadComboBox ID="ddlStatus" runat="server"  Enabled="false"/>

  protected void updatestatus(object sender, System.EventArgs e)
{
    if (txtname.Text != String.Empty)
    {
        if (ddlStatus.Text.Trim() == "Waiting")
        {
            ddlStatus.Text = "complete";

        }
    }
} 

Can Some one suggest me if I am missing something.?

هل كانت مفيدة؟

المحلول

You can use FindItemByText to set value of Talerik dropdown:

   RadComboBoxItem item = ddlStatus.FindItemByText("complete");
   item.Selected = true;

Complete implementation in your case will be something like this:

protected void updatestatus(object sender, System.EventArgs e)
{
    if (txtname.Text != String.Empty)
    {
        if (ddlStatus.Text.Trim() == "Waiting")
        {
           RadComboBoxItem item = ddlStatus.FindItemByText("complete");
           item.Selected = true;
        }
    }
}   
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top