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

GridDropDownColumn update command

3 Answers 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rikard Hultén
Top achievements
Rank 1
Rikard Hultén asked on 22 Apr 2010, 11:50 AM
Hi, I have a RadGrid with a GridDropDownColumn

<

 

telerik:RadGrid

 

 

    ID="referencesForCaseGrid"

 

 

    Skin="MainGrid"

     

EnableEmbeddedSkins="false"

 

     

ShowStatusBar="false"

 

     

runat="server"

 

     

AutoGenerateColumns="False"

 

 

    AllowSorting="True"

 

    AllowMultiRowSelection="False"

 

    GridLines="None"

 

    Style="border: 0; outline: none;
    
HeaderStyle-Height="25"

 

    AllowAutomaticInserts="false"

 

    AllowAutomaticDeletes="false"

 

    AllowAutomaticUpdates="false"

 

    EnableViewState="false">

 

 

 

 

<ItemStyle Wrap="true" VerticalAlign="Top" />
<AlternatingItemStyle Wrap="true" VerticalAlign="Top" />

 

<ClientSettings>

 

    <Selecting AllowRowSelect="false" />

 

    <Scrolling AllowScroll="false" />

 

</ClientSettings>

 


<
MasterTableView

 

    AllowPaging="true"

 

    PageSize="10"

 

    PagerStyle-AlwaysVisible="true"

 

    AllowMultiColumnSorting="True"

 

    EnableColumnsViewState="false"

 

    AllowCustomSorting="false"

 

    TableLayout="Fixed"

 

    EditMode="InPlace">

 

 

 

<Columns
    
<telerik:GridDropDownColumn

 

        UniqueName="RelationStatus"

 

        HeaderText="Relation Status"

 

        DataField="RelationStatusTypeID"

 

        ListDataMember="RelationStatusTypes"

        

ListTextField="Title"

 

 

        ListValueField="ID"

 

        SortExpression="Title"

 

        DropDownControlType="RadComboBox"

 

        HeaderStyle-Width="150px" />

 

    <telerik:GridEditCommandColumn />

 

</Columns>

 

</MasterTableView>

 

</telerik:RadGrid>

So when i press edit, I can choose a value in the dropdown, press update and the update command -event fires.

void

 

caseGrid_UpdateCommand(object source, GridCommandEventArgs e)

 

{

 

if(e.CommandName.Equals("Update") && e.Item is GridEditableItem)

 

{

 

 

var item = e.Item as GridDataItem;

 

 

int oldRelationTypeID = int.Parse(item.GetDataKeyValue("RelationStatusTypeID").ToString());

 

 

RadComboBox ddl = item["RelationStatus"].Controls[0] as RadComboBox;

 

 

int newRelationTypeID = int.Parse(ddl.SelectedValue);

 

 

GridEditableItem item2 = e.Item as GridEditableItem;

 

 

GridEditManager man = item2.EditManager;

 

 

RadComboBox operCombo = (man.GetColumnEditor("RelationStatus") as GridDropDownListColumnEditor).ComboBoxControl;

 

 

string operId = operCombo.SelectedValue;

 

 

// also returns preselected value

 

 

 

 

}

}

 

 

 

 

The problem here is that the value I get is the preselected one, not the one selected in the dropdown.

 

 

 

3 Answers, 1 is accepted

Sort by
0
Rikard Hultén
Top achievements
Rank 1
answered on 22 Apr 2010, 11:59 AM
My god, I apologize for the layout, can't get that code-block thing to work, script timeout it say :/

I went back, deleted all inserted CRs but they reappeared so I give up.
0
Yavor
Telerik team
answered on 28 Apr 2010, 09:30 AM
Hello Rikard,

Can you please enable the ViewState for the grid instance, and let me know if this eliminates the issue.

Sincerely yours,
Yavor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Rikard Hultén
Top achievements
Rank 1
answered on 28 Apr 2010, 09:43 AM
I'm sorry to inform you that it didn't.

For the time being I've switched to a template-column and add a regular dropdown to it in when in edit mode which works fine but is not as elegant...
Tags
Grid
Asked by
Rikard Hultén
Top achievements
Rank 1
Answers by
Rikard Hultén
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or