I'm following the examples to perform a batch update in a radgrid.
However, the HashTable contains the old value for the RadNumericTextBox. I want whatever the user has just typed in. I have some client-side script that format the numbers.
How can I get the most recent value that the user typed in as the qty value?
Here's the template column markup:
Here's the code:
Here's the Javascript:
However, the HashTable contains the old value for the RadNumericTextBox. I want whatever the user has just typed in. I have some client-side script that format the numbers.
How can I get the most recent value that the user typed in as the qty value?
Here's the template column markup:
<telerik:GridTemplateColumn DataField="Qty" DataType="System.Decimal" HeaderText="Qty" SortExpression="Qty" UniqueName="Qty"> <EditItemTemplate> <telerik:RadNumericTextBox Width="40px" MinValue="0" MaxValue="9999999.99" Type="Number" ID="QtyTextBox" Text='<%# Bind("Qty") %>' InvalidStyleDuration="1000" NumberFormat-DecimalDigits="2" runat="server" MaxLength="20"> <ClientEvents OnLoad="RemoveZeros" OnBlur="RemoveZeros" OnValueChanged="RemoveZeros" /> </telerik:RadNumericTextBox> <asp:RangeValidator ID="rngQty" runat="server" ControlToValidate="QtyTextBox" ErrorMessage="<br />Must be a number" Display="Dynamic" MinimumValue="0" MaximumValue="999999999" Type="Double"></asp:RangeValidator> <asp:RequiredFieldValidator ID="reqQty" ControlToValidate="QtyTextBox" runat="server" Display="Dynamic" ErrorMessage="<br />A quantity is required."></asp:RequiredFieldValidator> </EditItemTemplate> <ItemTemplate> <asp:Label ID="QtyLabel" runat="server" Text='<%# FormatDecimalWithoutUnusedDecimals( Eval("Qty")) %>'></asp:Label> </ItemTemplate> <ItemStyle Width="55px" /> <HeaderStyle Width="55px" /> <FooterStyle HorizontalAlign="Right" /> <FooterTemplate> </FooterTemplate> </telerik:GridTemplateColumn>Here's the code:
Protected Sub RadGrid1_ItemCommand(ByVal source As Object, _ ByVal e As Telerik.Web.UI.GridCommandEventArgs) _ Handles RadGrid1.ItemCommand Dim newValues As New Hashtable If e.CommandName = "UpdateAll" Then UpdateShipment(Nothing, Nothing) For Each editedItem As GridEditableItem In RadGrid1.EditItems e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem) Dim QtyTextBox As RadNumericTextBox QtyTextBox = CType(editedItem("Qty").FindControl("QtyTextBox"), RadNumericTextBox) UpdateRowValue(newValues) Next RadGrid1.EditIndexes.Clear() RadGrid1.Rebind() End IfEnd SubHere's the Javascript:
function RemoveZeros(sender, args) { var tbValue = sender._textBoxElement.value; if (tbValue.indexOf(".00") != -1) sender._textBoxElement.value = tbValue.substr(0, tbValue.indexOf(".00")); }