I’m new to using DevExpress controls and Javascript and would like to enter a value into 2 textboxes and for the result to be returned in the 3rd textbox. Code below:
function sum() {
var num1 = +txtValue1.GetValue();
var num2 = +txtValue2.GetValue();
var result = parseInt(txtValue1.GetValue) + parseInt(txtValue2.GetValue);
}
</script>
<style type="text/css">
#form1 {
align-content: center;
display: block;
height: 288px;
margin-top: 0px;
}
</style>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Toms Test Form</div>
<br />
<dx:ASPxLabel ID="lblValue1" ClientInstanceName="lblValue_1" runat="server" Text="Value 1:" ></dx:ASPxLabel> <br />
<dx:ASPxTextBox ID="txtValue1" runat="server" Width="180px" Height="5px">
<ValidationSettings ValidationGroup="vgtxtValue1">
<RequiredField IsRequired="True" ErrorText="You must enter a value" />
</ValidationSettings>
</dx:ASPxTextBox>
<dx:ASPxLabel ID="lblValue2" ClientInstanceName="lblValue2" runat="server" Text="Value 2:"></dx:ASPxLabel>
<dx:ASPxTextBox ID="txtValue2" runat="server" Width="180px" Height="5px">
<ValidationSettings ValidationGroup="vgtxtValue2">
<RequiredField IsRequired="True" ErrorText="You must enter a value"/>
</ValidationSettings>
</dx:ASPxTextBox>
<dx:ASPxLabel ID="lblTotal" runat="server" Text="Value Total:" ></dx:ASPxLabel>
<dx:ASPxTextBox ID="txtTotal" runat="server" Width="180px" Height="5px" readonly="true"></dx:ASPxTextBox> <br />
<dx:ASPxButton ID="btnTotal" runat="server" Text="Calculate Total" >
<ClientSideEvents Click="sum"/></dx:ASPxButton>
<div />```