Have a textbox display the results of a formula

I have four texboxes as follows, numerator, denominator, and one for Gross Acres. I want the fourth Textbox to display the result of what the user inputs for the fields, the ( (numerator/denominator) * Grossacres), I just wasn't sure how to go about this.
GravitaZ24Asked:
Who is Participating?
 
amanolaConnect With a Mentor Commented:
First add a button to this form, like:
<asp:Button ID="Button1" runat="server" Text="Submit" OnClick="SumClick" />

Then create the OnClick method, like:
    protected void SumClick(object sender, EventArgs e)
    {
        double dSum = ((Convert.ToDouble(ASFS_FRACT_NTB.Text) / Convert.ToDouble(ASFS_FRACT_DTB.Text)) * Convert.ToDouble(ASFS_GROSSACTB.Text));
        ASFS_NETACTB.Text = dSum.ToString();
    }
0
 
GravitaZ24Author Commented:
I just want the ASFS_NETACTB textbox to display the solution to ((ASFS_FRACT_NTB /ASFS_FRACT_DTB) * ASFS_GROSSACTB). Is that possible?
Fee Simple</td>	
	    <td>
		<asp:textbox id="ASFS_FRACT_NTB" runat="server" Text='<%# Eval("ASFS_FRACT_N") %>' Width="35px" />
		</td>
		<td>
		<asp:textbox id="ASFS_FRACT_DTB" runat="server" Text='<%# Eval("ASFS_FRACT_D") %>' Width="35px" />
		</td>
		<td>
		<asp:textbox id="ASFS_GROSSACTB" runat="server" Text='<%# Eval("ASFS_GROSSAC") %>' />
		</td>
		<td>				
		<asp:textbox id="ASFS_NETACTB" runat="server"  Text='<%# Eval("ASFS_NETAC") %>' />
		</td>
		<td>
		<asp:textbox id="ASFS_OVERLAPTB" runat="server" Text='<%# Eval("ASFS_OVERLAP") %>' />
		</td>
		<td>
		<asp:textbox id="ASFS_TAXPARCELIDTB" runat="server" Text='<%# Eval("ASFS_TAXPARCELID") %>' />

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.