HI,
I have the rad grid in which i have the edit item template. The aspx is as follows:
In the update command, i am trying to access the column as below:
I am getting the error as "Cannot find a cell bound to column name 'RadtxtPrdNumber', when the code hits "string strProductNumbervalue".
How to fix this?
Thanks
I have the rad grid in which i have the edit item template. The aspx is as follows:
<
telerik:RadGrid
ID
=
"radgrid1"
runat
=
"server"
EnableViewState
=
"true"
ShowStatusBar
=
"true"
AllowAutomaticUpdates
=
"false"
ShowFooter
=
"True"
OnInsertCommand
=
"radgrid1_InsertCommand"
OnUpdateCommand
=
"radgrid1_UpdateCommand"
OnNeedDataSource
=
"radgrid1_NeedDataSource"
>
<
MasterTableView
DataKeyNames
=
"ProductNumber"
AutoGenerateColumns
=
"false"
EditMode
=
"InPlace"
CommandItemDisplay
=
"TopAndBottom"
CommandItemSettings-AddNewRecordText
=
"Add New Purchase Order"
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
ConfirmText
=
"Delete this product?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
ConfirmDialogHeight
=
"100px"
ConfirmDialogWidth
=
"220px"
>
</
telerik:GridButtonColumn
>
<
telerik:GridTemplateColumn
DataField
=
"ProductNumber"
HeaderText
=
"Product Number"
UniqueName
=
"ProductNumber"
Visible
=
"true"
>
<
InsertItemTemplate
>
<
telerik:RadTextBox
ID
=
"RadtxtPrdNumber"
runat
=
"server"
Text
=
""
>
</
telerik:RadTextBox
>
</
InsertItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadTextBox
ID
=
"RadtxtPrdNumber"
runat
=
"server"
Text='<%# Eval("ProductNumber") %>'>
</
telerik:RadTextBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
telerik:RadTextBox
ID
=
"RadtxtPrdNumber"
ReadOnly
=
"true"
runat
=
"server"
Text='<%# Eval("ProductNumber") %>' />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
In the update command, i am trying to access the column as below:
GridEditableItem editedItem = e.Item
as
GridEditableItem;
//Get the primary key value using the DataKeyValue.
string
ProductID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex][
"ProductNumber"
].ToString();
//Access the textbox from the edit form template and store the values in string variables.
string
strProductNumbervalue = (editedItem[
"RadtxtPrdNumber"
].Controls[0]
as
RadTextBox).Text;
I am getting the error as "Cannot find a cell bound to column name 'RadtxtPrdNumber', when the code hits "string strProductNumbervalue".
How to fix this?
Thanks