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

DropDownColumn in RadGrid

2 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vinita
Top achievements
Rank 1
Vinita asked on 12 Feb 2009, 05:41 AM

Hi,

 

I have created an inline editable grid and has added a dropdowncolumn to the grid. When i am trying to add empty rows to the grid, all other columns are coming as empty but the dropdown column is getting pouplated with the first value in dropdown. I want that column to be empty.
While editing the row how to make the dropdown to display the selected value as the column value.
If have assigned same xml datasource to dropdown columns will it cause any problem?
And I am not able to bind one of my dropdown columns in the grid.

It is throwing the exception: 
System.Web.HttpException: DataBinding: 'System.String' does not contain a property with the name 'ows_InvoiceStatus'.

Thanks in advance,
Vinita

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 12 Feb 2009, 07:50 AM
Hello Vinita,

Inorder to display an empty value in the dropdowncontrol for a GridDropDownColumn, you can try adding the following code:
cs:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
      if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
        { 
            GridEditableItem editItem = (GridEditableItem)e.Item; 
            DropDownList ddl = (DropDownList)editItem["DropDown"].Controls[0]; 
            ddl.AppendDataBoundItems = true
            ddl.Items.Insert(0,"");            
        } 
     } 

Thanks
Princy.
0
Vinita
Top achievements
Rank 1
answered on 12 Feb 2009, 12:38 PM
And what about the exception which i am getting?
Tags
Grid
Asked by
Vinita
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Vinita
Top achievements
Rank 1
Share this question
or