|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Mystery ASP.NET ErrorHow do I force my Page to Page_Load when user clicks browser's Back button? I am trying to avoid this error, that I get when I hit back button on my browser and click on my dynamically generated button: "An error has occurred because a control with auto-generated id '_ctl7' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events." I did Google on this error, but nothing useful came up. At this time, I have a theory that this results from the fact that when I click Back button, my Page_Load function doesn't get invoked (page is cached). Then when I click on my dynamically generated control on the page, I get that error message. I did several posts on this already. However, no one seems to have the slightest clue of what exactly going on when this error is generated. Amelyan ps> Please keep in mind that the error only occurs when I click Back button on my browser, then click my dynamically generated button again. Otherwise, it is working just fine. Hello,
Are you always remaining in the same page during operation? If you are only working on the same page and during operation someone is clicking the "back" button, you can avoid this by setting smart navigation "on", that way the clicks on that page don't enter the history and the back button cannot be pressed. If you do need to press the "back" button, then set the cache timeout for the page to zero, see if that helps: E.g.: <%@ OutputCache Duration="0" Location="Any" VaryByParam="" %> Regards, -Visar Show quoteHide quote "Amelyan" wrote: > this question may be more appropriate for this group. > > How do I force my Page to Page_Load when user clicks browser's Back button? > I am trying to avoid this error, that I get when I hit back button on my > browser and click on my dynamically generated button: > > "An error has occurred because a control with auto-generated id '_ctl7' > could not be located to raise a postback event. To avoid this error, > explicitly set the ID property of controls that raise postback events." > > I did Google on this error, but nothing useful came up. At this time, I > have a theory that this results from the fact that when I click Back button, > my Page_Load function doesn't get invoked (page is cached). Then when I > click on my dynamically generated control on the page, I get that error > message. > > I did several posts on this already. However, no one seems to have the > slightest clue of what exactly going on when this error is generated. > > > Amelyan > > ps> Please keep in mind that the error only occurs when I click Back button > on my browser, then click my dynamically generated button again. Otherwise, > it is working just fine. > > > > Visar,
Yes, I am always staying on the same page. I just reload a different set of controls on post back. So, when someone clicks the back button, he gets the previous set of controls (without going through post back, probably via page caching), and that is when the error occurs when user tries to click control on the page brought from the cache. "An error has occurred because a control with auto-generated id '_ctl7' could not be located to raise a postback event. To avoid this error, explicitly set the ID property of controls that raise postback events." I understand that it happens this way especially after your explanation. However, I am also trying to understand why it happens this way, i.e. why it results in this particular error. Thank you, Amelyan *** Sent via Developersdex http://www.developersdex.com *** It generates the following error
The 'duration' attribute must be set to a positive integer value Show quoteHide quote "Visar Gashi, MCP" <VisarGashi***@discussions.microsoft.com> wrote in message news:6CA32D4A-C6D6-4B53-B763-59050831B72E@microsoft.com... > Hello, > > Are you always remaining in the same page during operation? > > If you are only working on the same page and during operation someone is > clicking the "back" button, you can avoid this by setting smart navigation > "on", that way the clicks on that page don't enter the history and the > back > button cannot be pressed. > > If you do need to press the "back" button, then set the cache timeout for > the page to zero, see if that helps: > > E.g.: > <%@ OutputCache Duration="0" Location="Any" VaryByParam="" %> > > Regards, > -Visar > > "Amelyan" wrote: > >> this question may be more appropriate for this group. >> >> How do I force my Page to Page_Load when user clicks browser's Back >> button? >> I am trying to avoid this error, that I get when I hit back button on my >> browser and click on my dynamically generated button: >> >> "An error has occurred because a control with auto-generated id '_ctl7' >> could not be located to raise a postback event. To avoid this error, >> explicitly set the ID property of controls that raise postback events." >> >> I did Google on this error, but nothing useful came up. At this time, I >> have a theory that this results from the fact that when I click Back >> button, >> my Page_Load function doesn't get invoked (page is cached). Then when I >> click on my dynamically generated control on the page, I get that error >> message. >> >> I did several posts on this already. However, no one seems to have the >> slightest clue of what exactly going on when this error is generated. >> >> >> Amelyan >> >> ps> Please keep in mind that the error only occurs when I click Back >> button >> on my browser, then click my dynamically generated button again. >> Otherwise, >> it is working just fine. >> >> >> >> I have not tried using a chace of 0 before, but you can manipulate the cache
directly from your code using the Response.Cache. This will give you much more controll over the cached page. Regards, -Visar Show quoteHide quote "Amelyan" wrote: > It generates the following error > > The 'duration' attribute must be set to a positive integer value > > > > "Visar Gashi, MCP" <VisarGashi***@discussions.microsoft.com> wrote in > message news:6CA32D4A-C6D6-4B53-B763-59050831B72E@microsoft.com... > > Hello, > > > > Are you always remaining in the same page during operation? > > > > If you are only working on the same page and during operation someone is > > clicking the "back" button, you can avoid this by setting smart navigation > > "on", that way the clicks on that page don't enter the history and the > > back > > button cannot be pressed. > > > > If you do need to press the "back" button, then set the cache timeout for > > the page to zero, see if that helps: > > > > E.g.: > > <%@ OutputCache Duration="0" Location="Any" VaryByParam="" %> > > > > Regards, > > -Visar > > > > "Amelyan" wrote: > > > >> this question may be more appropriate for this group. > >> > >> How do I force my Page to Page_Load when user clicks browser's Back > >> button? > >> I am trying to avoid this error, that I get when I hit back button on my > >> browser and click on my dynamically generated button: > >> > >> "An error has occurred because a control with auto-generated id '_ctl7' > >> could not be located to raise a postback event. To avoid this error, > >> explicitly set the ID property of controls that raise postback events." > >> > >> I did Google on this error, but nothing useful came up. At this time, I > >> have a theory that this results from the fact that when I click Back > >> button, > >> my Page_Load function doesn't get invoked (page is cached). Then when I > >> click on my dynamically generated control on the page, I get that error > >> message. > >> > >> I did several posts on this already. However, no one seems to have the > >> slightest clue of what exactly going on when this error is generated. > >> > >> > >> Amelyan > >> > >> ps> Please keep in mind that the error only occurs when I click Back > >> button > >> on my browser, then click my dynamically generated button again. > >> Otherwise, > >> it is working just fine. > >> > >> > >> > >> > > >
SRE (Simple Rule Engine)
ImageButton bug AddHandler doesn't seem to work. Blinking Controls Help, DropDown Web Control not Retuning "SelectedValue" CUSTOMVALIDATOR works but page goes on on FALSE "Google Suggests" and the AJAX .NET Wrapper? CustomValidator VALIDA pero NO FUNCIONA Drop down listbox - extra properties, possible? REGEX para Email |
|||||||||||||||||||||||