1. Abhi Shinde
    Abhi Shinde avatar
    56 posts
    Member since:
    May 2010

    Posted 23 Nov 2010 Link to this post

    Hello,
           Ive Created rad-combobox in code-behind (.cs file) and assign "RadComboBoxItem" collection through dataset.
    Like - 

    public void PopulateDROPDOWN(RadComboBox drp,string dataval,string datatxt,string selected,string strSQL)
            {
                DataSet objdr;
                RadComboBoxItem mylist;
                try
                {
                    objdr=GetDataSet(strSQL);
                    drp.Items.Clear();
                    mylist = new RadComboBoxItem();
                    mylist.Value = "0";
                    mylist.Text = "Select";
                    if (selected == null)
                    {
                        mylist.Selected = true;
                    }
                    drp.Items.Add(mylist);
                    foreach (DataRow myDatarow in objdr.Tables["cnpl"].Rows)
                    {
                        mylist = new RadComboBoxItem();
                        mylist.Value = myDatarow[dataval].ToString();
                        mylist.Text = myDatarow[datatxt].ToString();
                        if (selected ==myDatarow[dataval].ToString())
                        {
                            mylist.Selected = true;
                             
                        }
                        drp.Items.Add(mylist); 
                    }
                }
                catch
                {
                    drp.Items.Clear();
                    mylist = new RadComboBoxItem();
                    mylist.Text = "Error";
                    mylist.Value = "Error";
                    drp.Items.Add(mylist);
                }
            }

    But when I used foll. code to get selectedValue from combobox , it gives selectedText.
    string val = FRM.Page.Request["radCombo_drp"];

    In above code,  val = selectedText.
    I want to assign val = selectedValue

    Please Help,
    Thanks in advance... 
Back to Top