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

Adding an extra value to a GridDropDownColumn

2 Answers 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris McGrath
Top achievements
Rank 1
Chris McGrath asked on 11 Nov 2010, 10:20 PM
Hi, I have an editable grid where one of the fields uses a GridDropDownColumn to select the data, and is currently being populated using an SqlDataSource object.  I would like to be able to add one additional item to the dropdown list to allow the user to select "nothing".  Is there a way to do this?  I know that I could add a blank value in my stored procedure but I would prefer not to do it that way if possible. 

I'm also willing to populate my drop down field differently if need be.  In fact, I do have instances where I will want to build the list of items from scratch in code, so if you could provide code to do this that would be a great help as well!

Here is the ASP code for the grid.  It's the GLFundingID column that I want to add an item to.

<telerik:RadGrid ID="FundingFeesGrid" runat="server" Skin="Sunset" AutoGenerateColumns="false" AllowPaging="false" OnDeleteCommand="FundingFeesGrid_DeleteCommand" OnDetailTableDataBind="FundingFeesGrid_DetailTableDataBind" OnInsertCommand="FundingFeesGrid_InsertCommand" OnItemDataBound="FundingFeesGrid_ItemDataBound" OnNeedDataSource="FundingFeesGrid_NeedDataSource" OnUpdateCommand="FundingFeesGrid_UpdateCommand" OnItemCreated="FundingFeesGrid_ItemCreated">
    <MasterTableView EditMode="InPlace" CommandItemDisplay="Top">
        <Columns>
            <telerik:GridBoundColumn DataField="GLFundingFeeID" Visible="false" />
            <telerik:GridDropDownColumn DataField="GLFundingID" HeaderText="Funding Type" DataSourceID="FundingList" ListTextField="TypeName" ListValueField="GLFundingID" />
            <telerik:GridBoundColumn DataField="FeeName" />
            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" HeaderText="Edit" HeaderStyle-Width="60px" HeaderStyle-HorizontalAlign="Center" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 12 Nov 2010, 06:36 AM
Hello Chris,



The following help documentation will help you in customizing the GridDropDownColumn.
Customize/Configure GridDropDownColumn


-Shinu.
0
Chris McGrath
Top achievements
Rank 1
answered on 12 Nov 2010, 05:11 PM
Thanks Shinu, that was a good start!  The EnableEmptyListItem property works like a charm, and your link led me to the information I needed about populating my own dropdowns.
Tags
Grid
Asked by
Chris McGrath
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Chris McGrath
Top achievements
Rank 1
Share this question
or