Have a textbox display the results of a formula

Posted on 2008-11-10
Last Modified: 2012-06-21
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.
Question by:GravitaZ24

    Author Comment

    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>	
    		<asp:textbox id="ASFS_FRACT_NTB" runat="server" Text='<%# Eval("ASFS_FRACT_N") %>' Width="35px" />
    		<asp:textbox id="ASFS_FRACT_DTB" runat="server" Text='<%# Eval("ASFS_FRACT_D") %>' Width="35px" />
    		<asp:textbox id="ASFS_GROSSACTB" runat="server" Text='<%# Eval("ASFS_GROSSAC") %>' />
    		<asp:textbox id="ASFS_NETACTB" runat="server"  Text='<%# Eval("ASFS_NETAC") %>' />
    		<asp:textbox id="ASFS_OVERLAPTB" runat="server" Text='<%# Eval("ASFS_OVERLAP") %>' />
    		<asp:textbox id="ASFS_TAXPARCELIDTB" runat="server" Text='<%# Eval("ASFS_TAXPARCELID") %>' />

    Open in new window

    LVL 3

    Accepted Solution

    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();

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now