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

EditForm Double Binding

2 Answers 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adrian Eng Ying Ming
Top achievements
Rank 1
Adrian Eng Ying Ming asked on 22 Jul 2010, 01:28 AM
Hi,
    After using telerik RadGrid Edit form. Which within our custom user control contains a ComboBox (Data Source: DataTable, AppendItemDataBound: True). It appears that the combobox has double bind the value. I have attached a sample code which duplicated the scenario im describing.
ddl.AppendDataBoundItems = true;
ddl.Items.Add(new ListItem("select one", ""));
ddl.DataTextField = "Value";
ddl.DataValueField = "ID";
ddl.DataSource = Session["DataTableSource"];
ddl.DataBind();
 
RadComboTest.AppendDataBoundItems = true;
RadComboTest.Items.Add(new RadComboBoxItem("select one", ""));
RadComboTest.DataTextField = "Value";
RadComboTest.DataValueField = "ID";
RadComboTest.DataSource = Session["DataTableSource"];
RadComboTest.DataBind();


the above code is invoked one during Page Load (userControl, that is invoked by radGrid). however the behaviour of having appenddatabound is for us to Add "Select One" item is desired. Is there a reason why its duplicating ?

Best Regards,
Adrian






2 Answers, 1 is accepted

Sort by
0
Accepted
Iana Tsolova
Telerik team
answered on 22 Jul 2010, 03:50 PM
Hi Adrian,

It is hard to determine the exact cause of the issue withouth being able to debug  the whole project. However I suggest that you modify your code as below and see if it makes any difference:

RadComboTest.AppendDataBoundItems = true;
RadComboTest.Items.Add(new RadComboBoxItem("select one", ""));
RadComboTest.DataTextField = "Value";
RadComboTest.DataValueField = "ID";
RadComboTest.DataSource = Session["DataTableSource"];
RadComboTest.DataBind();
RadComboTest.DataSource = null;


Let me know how it goes.

Sincerely yours,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Adrian Eng Ying Ming
Top achievements
Rank 1
answered on 23 Jul 2010, 05:03 AM
thats it!!! Thanks :D

Regards,
Adrian
Tags
Grid
Asked by
Adrian Eng Ying Ming
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Adrian Eng Ying Ming
Top achievements
Rank 1
Share this question
or