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

GridDropDownColumn prevents data population

2 Answers 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AJ
Top achievements
Rank 1
AJ asked on 08 Apr 2011, 08:14 PM
I'm using Q1 of 2009 version of Telerik tools. Specifcally, I have a seriously of nested RadGrids which have some dropdown boxes populated from an SQLDataSource.

Everything works fine until I try to resize the width of the dropdown box using the columneditorid tag.
Once I attach the columneditorid, the drop down list in edit/insert mode, no longer populates on load, I have to hit the grid refresh button to bind the data items.

Is there any way around this, or another way to resize the dropdown box in edit mode? Thanks

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 11 Apr 2011, 10:50 AM
Hello AJ,

I guess you are using GridDropDownColumn in inner RadGrid. If so try the following code snippet.

ASPX:
<NestedViewTemplate>
    <telerik:RadGrid ID="RadGrid2" runat="server" DataSourceID="SqlDataSource2"
        OnItemDataBound="RadGrid2_ItemDataBound">
        <MasterTableView>
            <Columns>
                <telerik:GridEditCommandColumn>
                </telerik:GridEditCommandColumn>
                <telerik:GridDropDownColumn DataSourceID="SqlDataSource2" DataField="EmployeeID"
                    ListTextField="EmployeeID" ListValueField="EmployeeID" UniqueName="GridDropDownColumn">
                </telerik:GridDropDownColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
</NestedViewTemplate>

C#:
protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
       {
           GridEditFormItem editItem = (GridEditFormItem)e.Item;
           RadComboBox combo = (RadComboBox)editItem["GridDropDownColumn"].Controls[0];
           combo.Width = Unit.Pixel(200);
       }
   }

Thanks,
Princy.
0
AJ
Top achievements
Rank 1
answered on 11 Apr 2011, 02:52 PM
Perfection!

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