selected Item is always blank

7 posts, 0 answers
  1. Yoni
    Yoni avatar
    32 posts
    Member since:
    Nov 2010

    Posted 26 Apr 2011 Link to this post

    hello,
    I have a grid which has a number of columns,
    one of the columns is combobox,
    I am getting Data from DB from 2 Tables:

    1. a table that populates the combobox - display, code.
    2. a table that populates the grid - fields+display.

    my problem is that I Indeed get the comboboxes full, but the selected items are always blank .

    i tried to change it to label instead of combobox and then i got it right,
    but I want it to be combobox.

    P. S. I want the combobox to be always avalable to change, without editmode.
  2. Yoni
    Yoni avatar
    32 posts
    Member since:
    Nov 2010

    Posted 28 Apr 2011 Link to this post

    please!!!
    it is very importent for me
    I'm stuck!
  3. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Apr 2011 Link to this post

    Hello Yoni,

    I am not quite sure about your requirement and I suppose you want to get the ComboBox i normal mode. if thats is your case you can add the control in ItemTemplate , it will be available in normal mode.

    Here is a sample code:
    aspx:
    <telerik:GridTemplateColumn HeaderText="TextBoxcol" UniqueName="ComboBoxcol">
        <ItemTemplate>
            <telerik:RadComboBox ID="RadComboBox1" runat="server"  Width="200px" DataSourceID="SqlDataSource1" EmptyMessage="Select An Item" DataTextField="FirstName">
            </telerik:RadComboBox>
          </ItemTemplate>
    </telerik:GridTemplateColumn>

    Thanks,
    Shinu.
  4. Yoni
    Yoni avatar
    32 posts
    Member since:
    Nov 2010

    Posted 28 Apr 2011 Link to this post

     

    Thanks for answering..
    I did what you wrote, but I still get the comboboxes selected Items - blank.
    (the combo boxes are populated)
    How can i make them display the right value (According to Data Base)?
    waiting for an answer,
    yoni
  5. Yoni
    Yoni avatar
    32 posts
    Member since:
    Nov 2010

    Posted 28 Apr 2011 Link to this post

     
  6. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 29 Apr 2011 Link to this post

    Hi Yoni,

    In order to determine what is causing this problem in your scenario we would need some more information. Please share with us your declaration of the RadGrid along with the RadComboBox and the way you bind them to a data source.

    Regards,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  7. Yoni
    Yoni avatar
    32 posts
    Member since:
    Nov 2010

    Posted 01 May 2011 Link to this post

    Thanks for the help
    it works!!
    my problem was, i did this code in the Combo_Init instead of putting it in the RadGrid1_ItemDataBound

     

    now i put it there (RadGrid1_ItemDataBound) and it works.

     

    TryCast(e.Item.FindControl("RadComboBox1"), RadComboBox).DataTextField = "ModelDesc"
      
    TryCast(e.Item.FindControl("RadComboBox1"), RadComboBox).DataValueField = "ModelId"
      
    TryCast(e.Item.FindControl("RadComboBox1"), RadComboBox).DataBind()
      
    TryCast(e.Item.FindControl("RadComboBox1"), RadComboBox).SelectedValue = SelectedValueString

     

     

     

Back to Top