I have the following grid:
and I am trying to access the values to perform an update after the user selects update. What gets created in edit mode for the columns above, and how do I access them?
I tried the following, but the items are null:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowSorting
=
"true"
Width
=
"100%"
GridLines
=
"None"
PageSize
=
"25"
AllowPaging
=
"True"
AutoGenerateColumns
=
"False"
AllowAutomaticDeletes
=
"True"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
OnUpdateCommand
=
"RadGrid1_UpdateCommand"
OnDeleteCommand
=
"RadGrid1_DeleteCommand"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
MasterTableView
Width
=
"100%"
CommandItemDisplay
=
"Top"
HorizontalAlign
=
"NotSet"
AutoGenerateColumns
=
"False"
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
/>
<
telerik:GridBoundColumn
DataField
=
"Id"
UniqueName
=
"Id"
SortExpression
=
"Id"
HeaderText
=
"Id"
ReadOnly
=
"true"
/>
<
telerik:GridBoundColumn
DataField
=
"FirstName"
UniqueName
=
"FirstName"
SortExpression
=
"FirstName"
HeaderText
=
"First Name"
MaxLength
=
"128"
/>
<
telerik:GridBoundColumn
DataField
=
"LastName"
UniqueName
=
"LastName"
SortExpression
=
"LastName"
HeaderText
=
"Last Name"
MaxLength
=
"128"
/>
<
telerik:GridBoundColumn
DataField
=
"Email"
UniqueName
=
"Email"
SortExpression
=
"Email"
HeaderText
=
"Email"
MaxLength
=
"128"
/>
<
telerik:GridBoundColumn
DataField
=
"CreateDate"
UniqueName
=
"CreateDate"
SortExpression
=
"CreateDate"
HeaderText
=
"Create Date"
DataFormatString
=
"{0:d}"
ReadOnly
=
"true"
/>
<
telerik:GridCheckBoxColumn
DataField
=
"IsApproved"
UniqueName
=
"IsApproved"
SortExpression
=
"IsApproved"
HeaderText
=
"Is Approved"
/>
<
telerik:GridCheckBoxColumn
DataField
=
"IsComplete"
UniqueName
=
"IsComplete"
SortExpression
=
"IsComplete"
HeaderText
=
"Is Complete"
/>
<
telerik:GridCheckBoxColumn
DataField
=
"IsProcessed"
UniqueName
=
"IsProcessed"
SortExpression
=
"IsProcessed"
HeaderText
=
"Is Processed"
/>
<
telerik:GridButtonColumn
Text
=
"Delete"
CommandName
=
"Delete"
ConfirmText
=
"Are you sure you want to delete this application?"
ItemStyle-CssClass
=
"cursor"
ButtonType
=
"ImageButton"
/>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"true"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
and I am trying to access the values to perform an update after the user selects update. What gets created in edit mode for the columns above, and how do I access them?
I tried the following, but the items are null:
protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
{
var item = (GridEditFormItem)e.Item;
var firstName = e.Item.FindControl("TextBox1") as TextBox;
var lastName = e.Item.FindControl("TextBox2") as TextBox;
var email = e.Item.FindControl("TextBox3") as TextBox;
var isApproved = e.Item.FindControl("CheckBox1") as CheckBox;
var IsComplete = e.Item.FindControl("CheckBox2") as CheckBox;
var IsProcessed = e.Item.FindControl("CheckBox3") as CheckBox;