Folks using VStudio 2010 with UI for ASP.NET AJAX Q2 2014 SP1.
I have 3 RadNumericText Boxes (txtRadOriginalPages, txtRadCopies and txtRadCopyQty1) in a Form.
Basically it does do Client Side Total based on txtRadOriginalPages & txtRadCopies and populate txtRadCopyQty1.
I would like to Populate txtRadCopies with 0.00 if it is null and populate the Total txtRadCopyQty1 from the Value of txtRadOriginalPages in Client Side.
Below is my complete Code Description and attached is my desired result.
Thanks for any help.
gc_0620
I have 3 RadNumericText Boxes (txtRadOriginalPages, txtRadCopies and txtRadCopyQty1) in a Form.
Basically it does do Client Side Total based on txtRadOriginalPages & txtRadCopies and populate txtRadCopyQty1.
I would like to Populate txtRadCopies with 0.00 if it is null and populate the Total txtRadCopyQty1 from the Value of txtRadOriginalPages in Client Side.
Below is my complete Code Description and attached is my desired result.
Thanks for any help.
gc_0620
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
script
runat
=
"server"
>
protected void RadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
DataTable dt = new DataTable();
DataRow dr;
int colsNum = 4;
int rowsNum = 5;
string colName = "Column";
for (int j = 1; j <= colsNum; j++)
{
dt.Columns.Add(String.Format("{0}{1}", colName, j));
}
for (int i = 1; i <= rowsNum; i++)
{
dr = dt.NewRow();
for (int k = 1; k <= colsNum; k++)
{
dr[String.Format("{0}{1}", colName, k)] = String.Format("{0}{1} Row{2}", colName, k, i);
}
dt.Rows.Add(dr);
}
(sender as RadGrid).DataSource = dt;
}
</
script
>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
<
meta
http-equiv
=
"content-type"
content
=
"text/html;charset=utf-8"
/>
<
title
>RadControls</
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
/>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
Transparency
=
"50"
BackColor
=
"Yellow"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
DefaultLoadingPanelID
=
"RadAjaxLoadingPanel1"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateEditColumn
=
"true"
OnNeedDataSource
=
"RadGrid_NeedDataSource"
>
<
MasterTableView
EditMode
=
"EditForms"
>
<
EditFormSettings
EditFormType
=
"Template"
/>
<
EditFormSettings
>
<
FormTemplate
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
//Calculate the original pages * the copies and input the result to copy quantity
var ActualIndex;
var index;
var txtRadOriginalPages = null;
var txtRadCopies = null;
var txtRadCopyQty1 = null;
function updateTotals(sender, args) {
var v1 = txtOriginalPages.get_value();
var v2 = txtCopies.get_value();
var finalValue = parseFloat(v1) + parseFloat(v2);
txtRadCopyQty1.set_value(parseFloat(finalValue));
}
function setIndex(sender, args) {
index = args.get_itemIndexHierarchical();
}
function setActualIndex() {
ActualIndex = index;
}
function Load1(sender, args) {
txtOriginalPages = sender;
}
function Load2(sender, args) {
txtCopies = sender;
}
function Load3(sender, args) {
txtRadCopyQty1 = sender;
}
</
script
>
</
telerik:RadScriptBlock
>
<
table
>
<
tr
>
<
td
align
=
"left"
>
<
asp:Label
ID
=
"lblOriginalPages"
runat
=
"server"
Text
=
"Original Pages:"
></
asp:Label
>
</
td
>
<
td
align
=
"left"
>
<
telerik:RadNumericTextBox
ID
=
"txtRadOriginalPages"
runat
=
"server"
NumberFormat-DecimalDigits
=
"2"
NumberFormat-DecimalSeparator
=
"."
NumberFormat-GroupSeparator
=
","
NumberFormat-GroupSizes
=
"3"
NumberFormat-AllowRounding
=
"true"
Type
=
"Number"
>
<
ClientEvents
OnValueChanged
=
"updateTotals"
OnFocus
=
"setActualIndex"
OnLoad
=
"Load1"
/>
</
telerik:RadNumericTextBox
>
</
td
>
<
td
align
=
"left"
>
<
asp:Label
ID
=
"lblCopies"
runat
=
"server"
Text
=
"Copies:"
></
asp:Label
>
</
td
>
<
td
align
=
"left"
>
<
telerik:RadNumericTextBox
ID
=
"txtRadCopies"
runat
=
"server"
NumberFormat-DecimalDigits
=
"2"
NumberFormat-DecimalSeparator
=
"."
NumberFormat-GroupSeparator
=
","
NumberFormat-GroupSizes
=
"3"
NumberFormat-AllowRounding
=
"true"
Type
=
"Number"
>
<
ClientEvents
OnValueChanged
=
"updateTotals"
OnFocus
=
"setActualIndex"
OnLoad
=
"Load2"
/>
</
telerik:RadNumericTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"left"
>
<
asp:Label
ID
=
"lblCopyQty1"
runat
=
"server"
Text
=
"Original Pages + Copy:"
></
asp:Label
>
</
td
>
<
td
align
=
"left"
>
<
telerik:RadNumericTextBox
ID
=
"txtRadCopyQty1"
runat
=
"server"
NumberFormat-DecimalDigits
=
"2"
NumberFormat-DecimalSeparator
=
"."
NumberFormat-GroupSeparator
=
","
NumberFormat-GroupSizes
=
"3"
NumberFormat-AllowRounding
=
"true"
Type
=
"Number"
>
<
ClientEvents
OnLoad
=
"Load3"
/>
</
telerik:RadNumericTextBox
>
</
td
>
<
td
align
=
"left"
>
<
asp:Label
ID
=
"lblInkType1"
runat
=
"server"
Text
=
"Ink Type 1:"
></
asp:Label
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"right"
colspan
=
"6"
>
<
asp:ImageButton
ID
=
"ImageButtonDemoMainUpdateInsert"
ToolTip='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'
runat="server" ImageUrl="~/Images/GridUpdateEditInsert.gif" />
<
asp:ImageButton
ID
=
"ImageButtonDemoMainCancelUpdateInsert"
ToolTip
=
"Cancel"
CommandName
=
"Cancel"
CausesValidation
=
"false"
runat
=
"server"
ImageUrl
=
"~/Images/GridCancelEditInsert.gif"
/>
</
td
>
</
tr
>
</
table
>
</
FormTemplate
>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
form
>
</
body
>
</
html
>