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

[Solved] radgrid

1 Answer 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ayesha
Top achievements
Rank 1
Ayesha asked on 04 Aug 2009, 02:56 AM
Hi,

I've a radgrid with a template column which contains the raddropdownlist .By default when the page loads, all my dropdownlist columns in my template column should get filled in. this I'm taking care in the item databound event. but my question is the first value in eACH dropdownlist in the template column should be a blank value(empty white space) and then all it's values.

How do i get the blank value in all the dropdownlist controls in my templete columns in the radgrid.

Pls help me with code.

Thanks Telerik team. u guys do an awesome job.

Thanks for all your help.

ZR

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Aug 2009, 05:11 AM
Hello Zaheka,

You can try out the following code to populate your dropdown and also set the first item of the dropdown as a blank value:
c#:
protected void RadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
       if (e.Item is GridDataItem) 
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
            DropDownList ddl = (DropDownList)dataItem.FindControl("DropDownListID"); 
            ddl.AppendDataBoundItems = true
            ddl.DataSourceID = "SqlDataSource1";             
            ddl.DataTextField = "FirstName"
            ddl.Items.Insert(0, ""); 
            ddl.DataBind(); 
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
Ayesha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or