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

EditForm UserControl - wont bind RadCombBox properly

2 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
matt
Top achievements
Rank 1
matt asked on 16 Oct 2008, 05:35 PM
hello,

i am using a UserControl for my grid's EditForm. usually i have no problems.

but now i have a problem.. if i use a normal RadComboBox:

<Telerik:RadComboBox ID="rcbVictims"  
DataValueField="VictimPersonID"  
    DataTextField="Name"  
    DropDownWidth="300"  
    ShowToggleImage="false"  
    AllowCustomText="False"  
    MarkFirstMatch="true"  
    Skin="Gray"  
    TabIndex="2"  
    runat="server"
     
</Telerik:RadComboBox> 

...this works when i bind to it like so:

private void MyEditForm_DataBinding(object sender, System.EventArgs e) 
    //bind 
    rcbVictims.DataSource = Victims.GetVictimsByReport(reportID); 
    rcbVictims.DataBind(); 
    rcbVictims.Items.Insert(0, new RadComboBoxItem()); 
 
    //set current value 
    rcbVictims.Items.FindItemByValue(DataBinder.Eval(this.DataItem, "VictimPersonID").ToString()).Selected = true
 
    rcbVictims.DataSource = null
 

BUT, if i try to use multi columns:

<Telerik:RadComboBox ID="rcbVictims" DataValueField="VictimPersonID" DataTextField="Name" DropDownWidth="300" ShowToggleImage="false" AllowCustomText="False" MarkFirstMatch="true" Skin="Gray" TabIndex="2" runat="server"
    <ItemTemplate> 
        <%# DataBinder.Eval(Container.DataItem, "VictimNumber")%> - <%# DataBinder.Eval(Container.DataItem, "Name")%> 
    </ItemTemplate> 
</Telerik:RadComboBox> 

...then the ComboBox fails to render anything -- i only see my separator char, " - ".. No "VictimNumber" nor "Name".

why is this happening?

to test, i placed the same into a non-grid, normal ASPX page. worked fine there.


thanks,
matt


2 Answers, 1 is accepted

Sort by
0
Prangadj
Top achievements
Rank 1
answered on 20 Oct 2008, 12:12 PM

Try generating the item template for the combo items from the code-behind, not using DataBind.Evals - this might help. If not, post an example using a support ticket and the Telerik support might help you more.

Prangadj

0
matt
Top achievements
Rank 1
answered on 20 Oct 2008, 03:10 PM
if it worked in code-behind, but not in the designer, why would this not be a bug?
Tags
Grid
Asked by
matt
Top achievements
Rank 1
Answers by
Prangadj
Top achievements
Rank 1
matt
Top achievements
Rank 1
Share this question
or