Click here to Skip to main content
15,037,388 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Password Reset works in debug environment but does not work after deployment Pin
A_Griffin18-Oct-17 21:49
MemberA_Griffin18-Oct-17 21:49 
GeneralRe: Password Reset works in debug environment but does not work after deployment Pin
Philip Hall19-Oct-17 5:10
MemberPhilip Hall19-Oct-17 5:10 
Generalcode for solving zero distortion tecniqueof image steganography Pin
Member 1346535714-Oct-17 9:43
MemberMember 1346535714-Oct-17 9:43 
SuggestionRe: code for solving zero distortion tecniqueof image steganography Pin
Kornfeld Eliyahu Peter14-Oct-17 22:53
professionalKornfeld Eliyahu Peter14-Oct-17 22:53 
QuestionCode is inserting only one row of records. Any ideas? Pin
samflex9-Oct-17 5:16
Membersamflex9-Oct-17 5:16 
AnswerRe: Code is inserting only one row of records. Any ideas? Pin
F-ES Sitecore11-Oct-17 0:54
mveF-ES Sitecore11-Oct-17 0:54 
AnswerRe: Code is inserting only one row of records. Any ideas? Pin
ZurdoDev11-Oct-17 9:44
professionalZurdoDev11-Oct-17 9:44 
QuestionHave a form result invisible until submission? Pin
The Rarispy8-Oct-17 16:48
MemberThe Rarispy8-Oct-17 16:48 
I wasn't completely sure which forum to put this in, ASP or JavaScript. Feel free to move it if it's not the appropriate spot.

I have a simple web application where the user inputs three integers into a form and receives the sum as a result.

My question is this: I'd like to have the actual sum value not appear until the user has Submitted. Meaning, when the page is opened up, the ViewBag just displays nothing. And then after submission, the ViewBag content appears. Is it possible for me to do this with the current code I have?

I'm aware this will probably require a JavaScript function. I just don't have very much experience integrating JS with C#.

View:
@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<!-- HTML form with "Post" method initiated. -->
<form action="" method="post">

    Enter the 1st Number: <input id="firstInt" name="firstInt" type="text" value="0" /><br />
    Enter the 2nd Number: <input id="secondInt" name="secondInt" type="text" value="0" /><br />
    Enter the 3rd Number: <input id="thirdInt" name="thirdInt" type="text" value="0" /><br />

    <input id="Submit" type="submit" value="submit" />
    <input id="Reset" type="reset" value="reset" /><br /><br />
    Sum = @ViewBag.result
</form>


Controller:
public class HomeController : Controller
    {
        // GET: Home
        // Integers initiated in the index parameters.
        public ActionResult Index(int firstInt = 0, int secondInt = 0, int thirdInt = 0)
        {
            // Calculates sum of the three integers, and then sends result to the View.
            int sum = firstInt + secondInt + thirdInt;
            ViewBag.result = sum;
            return View();
        }
    }


modified 8-Oct-17 22:58pm.

AnswerRe: Have a form result invisible until submission? Pin
Richard Deeming9-Oct-17 8:42
mveRichard Deeming9-Oct-17 8:42 
QuestionChanging the text of a GridView buttonfield text dynamically Pin
holdorf7-Oct-17 15:10
Memberholdorf7-Oct-17 15:10 
QuestionASP.Net Core and global.asax Pin
Mou_kol5-Oct-17 23:21
MemberMou_kol5-Oct-17 23:21 
AnswerRe: ASP.Net Core and global.asax Pin
Afzaal Ahmad Zeeshan11-Oct-17 12:31
mveAfzaal Ahmad Zeeshan11-Oct-17 12:31 
QuestionDesktop application "communicating" with ASP.NET Pin
The Junior4-Oct-17 23:02
MemberThe Junior4-Oct-17 23:02 
AnswerRe: Desktop application "communicating" with ASP.NET Pin
Atlapure Ambrish5-Oct-17 4:04
professionalAtlapure Ambrish5-Oct-17 4:04 
GeneralRe: Desktop application "communicating" with ASP.NET Pin
The Junior5-Oct-17 4:24
MemberThe Junior5-Oct-17 4:24 
SuggestionRe: Desktop application "communicating" with ASP.NET Pin
Richard Deeming5-Oct-17 4:08
mveRichard Deeming5-Oct-17 4:08 
GeneralRe: Desktop application "communicating" with ASP.NET Pin
The Junior5-Oct-17 4:21
MemberThe Junior5-Oct-17 4:21 
GeneralRe: Desktop application "communicating" with ASP.NET Pin
David Mujica5-Oct-17 9:08
MemberDavid Mujica5-Oct-17 9:08 
GeneralRe: Desktop application "communicating" with ASP.NET Pin
The Junior5-Oct-17 21:34
MemberThe Junior5-Oct-17 21:34 
QuestionProgramming Chat supports video and audio and the number of connected high Pin
Member 1343772929-Sep-17 12:07
professionalMember 1343772929-Sep-17 12:07 
AnswerRe: Programming Chat supports video and audio and the number of connected high Pin
ZurdoDev2-Oct-17 4:10
professionalZurdoDev2-Oct-17 4:10 
QuestionImplementation advice for quiz with 4 choice questions Pin
Farhad Eft28-Sep-17 10:09
MemberFarhad Eft28-Sep-17 10:09 
AnswerRe: Implementation advice for quiz with 4 choice questions Pin
Farhad Eft30-Sep-17 6:31
MemberFarhad Eft30-Sep-17 6:31 
QuestionASP.NET authorization Pin
SaeedPol27-Sep-17 8:30
MemberSaeedPol27-Sep-17 8:30 
AnswerRe: ASP.NET authorization Pin
The Junior5-Oct-17 4:34
MemberThe Junior5-Oct-17 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.