ASP.NET Page refreshes Twice

Z

Zubair.NET!

Hi,

I am working on somebody else's code built in ASP.NET/C#, during some
of the request, ASP.NET Pages refreshes twice unexpectedly.

My application runs in an IFrame with a LHS navigation tree, I am
passing querystrings using javascript on a HTML button control, which
results in performing different operations on querystring.

Button:

<input type="submit" name="DeleteYes" value="Delete" class="button"
onclick="DoPostBack('yesdelete');" style="WIDTH:95px">


_Javascript:

function DoPostBack(action)
{

document.frmDirectory.hdnAction.value = action;
document.frmDirectory.submit();
}


Using C# - switch-case statement to handle the current operation:

case "yesdelete" :

DeleteCurrentSubDirectory();
break;

Please let me know, what is causing the page to reload twice?
 
B

Bruce Barker

your client script forces two submits. the submit button does one, and the
client script does one.

try:

<input type="submit" name="DeleteYes" value="Delete" class="button"
onclick="document.frmDirectory.hdnAction.value ='yesdelete';"
style="WIDTH:95px">


-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top