I have a grid that has a GridTemplateColumn, with an EditItemTemplate inside. Inside the EditItemTemplate is a RadNumericTextBox. I'm trying to loop through the rows in the grid server side, outside the normal RadGrid events. I have a button that when clicked sends me server side and in that event I need to loop through and grab the values from all the rows.
I have no problem grabbing the DataKeyValue for the row, it's just the value of txtQuantity I am unable to get.
Here is my ASCX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowPaging
=
"True"
DataSourceID
=
"Products"
Skin
=
"Forest"
GridLines
=
"None"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
Width
=
"50%"
>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
SaveScrollPosition
=
"true"
></
Scrolling
>
</
ClientSettings
>
<
MasterTableView
ShowFooter
=
"true"
AutoGenerateColumns
=
"False"
CurrentResetPageIndexAction
=
"SetPageIndexToFirst"
DataKeyNames
=
"ID"
DataSourceID
=
"Products"
Dir
=
"LTR"
Frame
=
"Border"
TableLayout
=
"Auto"
EditMode
=
"Batch"
BatchEditingSettings-OpenEditingEvent
=
"Click"
CommandItemDisplay
=
"None"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ID"
DataType
=
"System.Int32"
ReadOnly
=
"True"
UniqueName
=
"ID"
/>
<
telerik:GridBoundColumn
DataField
=
"ProductName"
ReadOnly
=
"true"
HeaderText
=
"Product"
UniqueName
=
"ProductName"
/>
<
telerik:GridTemplateColumn
DataField
=
"Quantity"
UniqueName
=
"Quantity"
HeaderText
=
"Quantity"
DataType
=
"System.Int32"
>
<
ItemTemplate
>
<%# Eval("Quantity")%>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"txtQuantity"
runat
=
"server"
Width
=
"40px"
DataType
=
"System.Int32"
NumberFormat-DecimalDigits
=
"0"
Skin
=
"Forest"
>
<
ClientEvents
OnBlur
=
"Blur"
OnFocus
=
"Focus"
/>
</
telerik:RadNumericTextBox
>
</
EditItemTemplate
>
<
FooterTemplate
>
<
telerik:RadNumericTextBox
ID
=
"TextBox2"
runat
=
"server"
Width
=
"40px"
DataType
=
"System.Int32"
NumberFormat-DecimalDigits
=
"0"
Skin
=
"Forest"
ReadOnly
=
"True"
>
<
ClientEvents
OnLoad
=
"Load"
/>
</
telerik:RadNumericTextBox
>
</
FooterTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
</
telerik:RadGrid
>
Here is my Server side:
Protected Sub btnProcess_Click(sender As Object, e As EventArgs)
Try
For Each row As GridDataItem In RadGrid1.MasterTableView.Items
Dim key As String = row.GetDataKeyValue("ID")
Dim qty As RadNumericTextBox = DirectCast(row("Quantity").FindControl("txtQuantity"), RadNumericTextBox)
Next
Catch ex As Exception
Response.Write(ex.ToString)
End Try
End Sub