Older
thread explains how to use two submit buttons. For some reason my
My code does not execute IsPost after one or the other button was pressed.
I don't see why.
I am also getting a message about loader lock:
LoaderLock was detected
Message: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
Something about the call stack only containing external code.
This is way over my understanding on how this all works.
Any suggestions on how to tackle this problem?
if (IsPost) { //this code does not execute
if(Request["action"] == "Send")
{
code here
}
else
{
code here
}
<form method="post">
<input type="submit" name="action" value="Send">
<form method="post">
<input type="submit" name="action" value = "Agree">
It works fine for me. You obviously have some other issue going on.
wavemaster
I am also getting a message about loader lock:
LoaderLock was detected
Message: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
Don't know what that is, but it has nothing to do with ASP.NET. Might be a WebMatrix app issue.
wavemaster
Participant
1279 Points
1125 Posts
code is not hitting my IsPost - two submit buttons
Nov 29, 2012 04:06 AM|LINK
Older thread explains how to use two submit buttons. For some reason my
My code does not execute IsPost after one or the other button was pressed.
I don't see why.
I am also getting a message about loader lock:
LoaderLock was detected
Message: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
Something about the call stack only containing external code.
This is way over my understanding on how this all works.
Any suggestions on how to tackle this problem?
if (IsPost) { //this code does not execute if(Request["action"] == "Send") { code here } else { code here } <form method="post"> <input type="submit" name="action" value="Send"> <form method="post"> <input type="submit" name="action" value = "Agree">Mikesdotnett...
All-Star
154830 Points
19854 Posts
Moderator
MVP
Re: code is not hitting my IsPost - two submit buttons
Nov 29, 2012 04:54 AM|LINK
It works fine for me. You obviously have some other issue going on.
Don't know what that is, but it has nothing to do with ASP.NET. Might be a WebMatrix app issue.
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
Afzaal.Ahmad...
Contributor
2660 Points
1039 Posts
Re: code is not hitting my IsPost - two submit buttons
Nov 29, 2012 04:22 PM|LINK
Why you want to do this thing so difficultly ??
You can use only one form and just try to get the value from two radio buttons. This will do the same work.
~~! FIREWALL !~~
wavemaster
Participant
1279 Points
1125 Posts
Re: code is not hitting my IsPost - two submit buttons
Nov 29, 2012 07:48 PM|LINK
I am not making any progress, in fact more chaos seems to be a result of my actions.
Look at this. Here is the content of one of my tabs. The intention is that the user selects a few checkboxes then hits submit.
As things are now, as soon as one of the check boxes is set, the code proceeds but it never set the IsPost.
Why?
<h3>Purchase</h3> <p></p> <form method="post"> <table> <tr><td>Buy1:</td><td></td><td><input type="checkbox" name="buy1" /></td></tr> <tr><td>Buy2:</td><td></td><td><input type="checkbox" name="buy2" /></td></tr> <tr><td>Buy3:</td><td></td><td><input type="checkbox" name="buy3" /></td></tr> <tr><td>Release:</td><td></td><td><input type="checkbox" name="release" /></td></tr> </table> <div class="message info"> <p>Purchase</p> <h5>You agree to</h5> <p>Release</p> <h5>You agree to</h5> <p>Terms</p> <h5>You agree to</h5> <p></p> <h5>By clicking Agree you have accepted these terms.</h5> </div> <input type="submit" name="action" value="Agree"> </form> </div>GmGregori
Contributor
5444 Points
733 Posts
Re: code is not hitting my IsPost - two submit buttons
Nov 29, 2012 10:08 PM|LINK
The only problem in your code is that you must assign the same name to all the checkboxes and specify a different value for each.
This works for me:
<form method="post"> <table> <tr><td>Buy1:</td><td></td><td><input type="checkbox" name="buy" value="buy1"/></td></tr> <tr><td>Buy2:</td><td></td><td><input type="checkbox" name="buy" value="buy2" /></td></tr> <tr><td>Buy3:</td><td></td><td><input type="checkbox" name="buy" value="buy3" /></td></tr> <tr><td>Release:</td><td></td><td><input type="checkbox" name="buy" value="release" /></td></tr> </table> <div class="message info"> <p>Purchase</p> <h5>You agree to</h5> <p>Release</p> <h5>You agree to</h5> <p>Terms</p> <h5>You agree to</h5> <p></p> <h5>By clicking Agree you have accepted these terms.</h5> </div> <input type="submit" name="action" value="Agree"> </form>wavemaster
Participant
1279 Points
1125 Posts
Re: code is not hitting my IsPost - two submit buttons
Nov 30, 2012 04:09 AM|LINK
I was able to make some progress with your suggestions.
Apparently I have not stumbled into another problem as clicking on of those checkboxes causes a Javascript Runtime Erro: unhandled exception: value
Now, this code lives in a jquery dialog and one of the jquery tabs.
But, it is straight HTML, why would JS be involved in this?
wavemaster
Participant
1279 Points
1125 Posts
Re: code is not hitting my IsPost - two submit buttons
Nov 30, 2012 04:10 AM|LINK
You were right, there was something else.
I had lost the action on one of the forms. It didn't know which file to Post to.
That is fixed now.