Possible to have DropDown column with different values per row?

2 posts, 0 answers
  1. EmpowerIT
    EmpowerIT avatar
    117 posts
    Member since:
    Jun 2007

    Posted 30 Jan 2008 Link to this post

    I was wondering if it is possible to have a drop down column which has different values in the list depending on the row?

    E.G I have a record which consists of a RecId, name and a status. Name is just a plain text, RecId is the primary key (autogenerated number) and status is a foregin key to another table.

    The other table is in the format of Id, RecId,StatusName.

    I have a datasource which needs to select from this status table where RecId is the value of the current row.

    Is it possible? Is there some event where I can set the default value for the SqlDataSource select paramater to allow this behaviour?
  2. Vlad
    Vlad avatar
    11100 posts

    Posted 31 Jan 2008 Link to this post

    Hello EmpowerIT,

    You can achieve this using GridTemplateColumn with regular drop down where you can point desired DataSource in ItemCreated. Here is an example:

    <MasterTableView DataKeyNames="MyID">
                  <asp:DropDownList ID="DropDownList1" runat="server" />

    if(e.Item is GridDataItem)
        string myKeyValue = ((GridDataItem)e.Item).GetDataKeyValue("MyID").ToString();
       if(myKeyValue == "Something")
           DropDownList DropDownList1 = (DropDownList)e.Item.FindControl("DropDownList1");
           DropDownList1.DataSource = MySource;

    Kind regards,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top