EditForm UserControl - wont bind RadCombBox properly

3 posts, 0 answers
  1. matt
    matt avatar
    259 posts
    Member since:
    Oct 2007

    Posted 16 Oct 2008 Link to this post

    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. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 20 Oct 2008 Link to this post

    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

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. matt
    matt avatar
    259 posts
    Member since:
    Oct 2007

    Posted 20 Oct 2008 Link to this post

    if it worked in code-behind, but not in the designer, why would this not be a bug?
Back to Top