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

[Solved] Dynamic data bind for a drop down list

1 Answer 227 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Viswanathan
Top achievements
Rank 1
Viswanathan asked on 29 Jul 2009, 02:08 PM
Hi,

How to dynamically bind data to a drop down list in a RAD grid control.

i tried using the following lines, but the event is not firing! 

protected void grd_ItemDataBound(object sender, Telerik.WebControls.GridItemEventArgs e) 
ddl.DataBinding += new EventHandler(ddl_DataBinding); 

        void ddl_DataBinding(object sender, EventArgs e) 
        { 
            try 
            { 
                DropDownList ddl = (DropDownList)sender; 
                possibleTargetOutcome = RetrieveData(); 
 
                ddl.DataSource = possibleTargetOutcome; 
                ddl.DataTextField = "DisplayText"
                ddl.DataValueField = "InputValue"
                ddl.DataBind(); 
            } 
            catch(Exception ex) 
            { 
                lblErrorMessage.Text = ex.Message; 
            } 
        } 

Anyone have solution for this?

Thanks
Viswa

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Jul 2009, 02:49 PM
Hi Viswanathan,

Checkout the following link for some insight about Customizing GridDropDownColumn. I hope this helps in achieving your scenario.
Customize/Configure GridDropDownColumn

-Shinu.
Tags
Grid
Asked by
Viswanathan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or