Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Multiple AutoPostBacks causes page to disappear

Reply
Thread Tools

Multiple AutoPostBacks causes page to disappear

 
 
Rick Lubanovic
Guest
Posts: n/a
 
      10-19-2003
All,

I have a scenario that is causing a major problem in our
ASP.Net Application. I have a page that contains an
asp:textbox and an asp:dropdownlist control which are both
set to AutoPostBack. If the text is changed within the
textbox and the dropdownlist's arrow is clicked, the page
will go blank and never repaint. The application is
now "gone" until it is restarted. This only occurs in
this exact sequence. If the textbox is changed and then
the tab key is hit to go to the dropdownlist, all is
well. It takes the text to be changed, then a click on
the dropdown while the cursor is still in the textbox.

I have tried a number of workarounds to solve this,
including client side javascript in place of the multiple
AutoPostBacks. Nothing I have tried has worked, I wonder
if there is anything I can do to allow the interactivity I
am looking for. Here is the issue:

In this example, the ReturnDate is the textbox and the
Hour and Minute controls are dropdownlists.

Return Date: xx-xx-xxxx Hour: xx Minute: xx

Time Updated: xxxxxxxxx By: xxxxxxxxxxxxx

When either the return date is changed, or the time is
changed, the Time Updated and By fields must be updated,
and they are asp:label controls.

We have built a number of forms with ASP.NET and this is
the only showstopping issue that we have encountered. Any
help would be greatly appreciated.

Thanks,
Rick Lubanovic





 
Reply With Quote
 
 
 
 
Eduardo Mendez
Guest
Posts: n/a
 
      10-20-2003
I have the same problem, but I can give one more clue, it hapens only in
pages contained in a frame

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Rick Lubanovic
Guest
Posts: n/a
 
      10-29-2003
Here is the answer I received from Microsoft Support:

According to the case log, the problem is: Autopostpack
causes page to disappear, and it only occurs on the
specific page with the specific sequence.

It looks to be a known issue of Internet Explorer 6.0. We
can walk around this issue by adding a client script
function to delay the postback of a second. Call the
function in the OnChange event of the DropDownlist
control. The code looks like:

private void Page_Load(object sender, System.EventArgs e)
{
DropDownList1.Attributes.Add("onchange","testdelay ()");
WriteFunction(DropDownList1.UniqueID);
// Put user code to initialize the page here
}

private void WriteFunction(string str)
{
Response.Write("<script language=\"jscript\">");
Response.Write("function testdelay(){");
Response.Write("setTimeout(\"__doPostBack('" + str + "','')
\", 1);");
Response.Write("}");
Response.Write("</script>");
}

I tested the fix and it worked nicely.

Rick

>-----Original Message-----
>I have the same problem, but I can give one more clue, it

hapens only in
>pages contained in a frame
>
>*** Sent via Developersdex http://www.developersdex.com

***
>Don't just participate in USENET...get rewarded for it!
>.
>

 
Reply With Quote
 
Rick Lubanovic
Guest
Posts: n/a
 
      11-05-2003
Looking into the issue further, the fix did not work in
all cases. Here is a better solution:

Page_Load()
{
//
// NOTE: This code must be executed on all calls to
// Page_Load.
//
DelayPostBack();
StartHours.Attributes.Add
( "onchange", "onChangeDelay(" + StartHours.UniqueID
+ ");//" );
StartMinutes.Attributes.Add
( "onchange", "onChangeDelay(" + StartMinutes.UniqueID
+ ");//" );
}

private void DelayPostBack()
{
Response.Write("<script language=\"jscript\">");
Response.Write("function onChangeDelay(str){");
Response.Write("setTimeout(\"__doPostBack('\" +
str + \"','')\", 1);");
Response.Write("}");
Response.Write("</script>");
}

That should do it.
Rick

>-----Original Message-----
>Here is the answer I received from Microsoft Support:
>
>According to the case log, the problem is: Autopostpack
>causes page to disappear, and it only occurs on the
>specific page with the specific sequence.
>
>It looks to be a known issue of Internet Explorer 6.0. We
>can walk around this issue by adding a client script
>function to delay the postback of a second. Call the
>function in the OnChange event of the DropDownlist
>control. The code looks like:
>
>private void Page_Load(object sender, System.EventArgs e)
>{
>DropDownList1.Attributes.Add("onchange","testdela y()");
>WriteFunction(DropDownList1.UniqueID);
>// Put user code to initialize the page here
>}
>
>private void WriteFunction(string str)
>{
>Response.Write("<script language=\"jscript\">");
>Response.Write("function testdelay(){");
>Response.Write("setTimeout(\"__doPostBack('" + str

+ "','')
>\", 1);");
>Response.Write("}");
>Response.Write("</script>");
>}
>
>I tested the fix and it worked nicely.
>
>Rick
>
>>-----Original Message-----
>>I have the same problem, but I can give one more clue,

it
>hapens only in
>>pages contained in a frame
>>
>>*** Sent via Developersdex http://www.developersdex.com

>***
>>Don't just participate in USENET...get rewarded for it!
>>.
>>

>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delaying autopostbacks on dropdownlists daokfella ASP .Net 1 06-03-2008 07:56 PM
What causes session to disappear? gnewsgroup ASP .Net 8 01-20-2008 02:01 PM
Office 2007 causes html icon to disappear on 64bit Windows Vista. Cat Windows 64bit 2 09-10-2007 01:18 PM
Outlook Express Messages Disappear, Bookmarks in Internet Explorer Disappear rchrdcarlisle@NOTyahoo.com Computer Support 19 07-30-2006 09:41 PM
Textboxes and autopostbacks Alex Shirley ASP .Net 2 07-15-2004 07:04 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57