This is a migrated thread and some comments may be shown as answers.

RadGrid - Usercontrol dropdownlist issue

3 Answers 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 22 Nov 2011, 04:55 PM
I'm having issue with my dropdownlist after I DataBind and then I use the dropdownlist.Items.Insert(0,"Testing") doesn't show up in my DataGrid.

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx

For example the EmployeeDetailsCS.ascx.cs in the
        protected void EmployeeDetails_DataBinding(object sender, System.EventArgs e)
        {
            ArrayList tocs = new ArrayList(new string[] { "Dr.", "Mr.", "Mrs.", "Ms." });

            ddlTOC.DataSource = tocs;
            ddlTOC.DataBind();
            //issue here
            ddlTOC.Items.Insert(0,"Testing");
            // or ddlTOC.Items.Insert(0,"Please select Title");

            object tocValue = DataBinder.Eval(DataItem, "TitleOfCourtesy");

            if (tocValue == DBNull.Value)
            {
                tocValue = "Mrs.";
            }
            ddlTOC.SelectedIndex = tocs.IndexOf((string)tocValue);
            ddlTOC.DataSource = null;
        }

3 Answers, 1 is accepted

Sort by
0
Accepted
ravindra
Top achievements
Rank 1
answered on 23 Nov 2011, 11:19 AM

hi Paul,
try this below code will insert values to radcombobox at specified index.

 

ddlTOC.items.insert(0,new RadComboBoxItem("--select ---"));

0
Paul
Top achievements
Rank 1
answered on 30 Nov 2011, 04:26 PM
Thank you
0
Paul
Top achievements
Rank 1
answered on 01 Dec 2011, 05:40 PM
Problem solved.
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
ravindra
Top achievements
Rank 1
Paul
Top achievements
Rank 1
Share this question
or