I am working on the evaluation copy of the Radgrid
I have a created a radgrid with editing capabilities. Once the user updates the item I am unable to get the edited values.
My code is listed below
ASPX Code
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None"
OnItemDataBound="RadGrid1_ItemDataBound" OnNeedDataSource="RadGrid1_NeedDataSource"
AllowSorting="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
AutoGenerateEditColumn="true" OnItemUpdated="RadGrid1_ItemUpdated" OnUpdateCommand="RadGrid1_UpdateCommand">
<MasterTableView DataKeyNames="username" Width="100%" EditMode="InPlace">
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="username" HeaderText="User Name" UniqueName="username" ReadOnly=true>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="password" HeaderText="Password" UniqueName="password">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Password" UniqueName="TemplateColumn">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
C# Code
protected
void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
{
//Get the GridEditableItem of the RadGrid
GridEditableItem editedItem = e.Item as GridEditableItem;
//Get the primary key value using the DataKeyValue.
string sUserName = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["username"].ToString();
//Access the textbox from the edit form template and store the values in string variables.
string sPassword = (editedItem["password"].Controls[0] as TextBox).Text;
}
Any help is much appreciated.
Regards,
Kaushik