I have no clue why, but this code was working yesterday and today it doesn't.
I have the following grid:
With the following javascript:
And the following server side code:
Yesterday, I was able to populate TotalQty with the value from the footer, but today, it is an empty string. The footer textbox shows a number in it. Server side, I am getting access to the footer textbox, but the Text property is an empty string.
I have no clue why it stopped working.
I have the following grid:
<
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
>
<
ClientEvents
OnBatchEditCellValueChanged
=
"CellValueChanged"
/>
</
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
>
With the following javascript:
<
telerik:RadScriptBlock
runat
=
"server"
ID
=
"RadScriptBlock1"
>
<
script
type
=
"text/javascript"
>
var sumInput = null;
var tempValue = 0;
function Load(sender, args) {
sumInput = sender;
}
function Blur(sender, args) {
sumInput.set_value(tempValue + sender.get_value());
}
function Focus(sender, args) {
tempValue = sumInput.get_value() - sender.get_value();
}
function CellValueChanged(sender, args) {
var row = args.get_row();
var rowIndex = row.rowIndex;
var columnName = args.get_columnUniqueName();
var cell = args.get_cell();
var oldValue = args.get_cellValue();
var newValue = '' + args.get_editorValue();
var key = '' + row.cells[0].textContent
//debugger
var hc = document.getElementById('<%= ProductHash.ClientID%>');
if (hc.value == '') {
if (newValue == "0") {
return;
}
aProducts = new Array();
aProducts[key] = newValue;
}
else {
var aProducts = JSON.parse(hc.value);
if (aProducts == null) {
if (newValue == "0") {
return;
}
aProducts = new Array();
aProducts[key] = newValue;
}
else {
aProducts[key] = newValue;
}
}
hc.value = JSON.stringify(aProducts);
}
</
script
>
</
telerik:RadScriptBlock
>
And the following server side code:
Protected Sub btnProcess_Click(sender As Object, e As EventArgs)
Try
'Retrieve total quantity from footer
Dim footer As GridFooterItem = DirectCast(RadGrid1.MasterTableView.GetItems(GridItemType.Footer)(0), GridFooterItem)
Dim TotalQty As String = TryCast(footer.FindControl("TextBox2"), RadNumericTextBox).Text
.......do some stuff
Catch ex As Exception
Response.Write(ex.ToString)
End Try
End Sub
Yesterday, I was able to populate TotalQty with the value from the footer, but today, it is an empty string. The footer textbox shows a number in it. Server side, I am getting access to the footer textbox, but the Text property is an empty string.
I have no clue why it stopped working.