Mystery ASP.NET Error (No one seems to have a clue)

A

Amelyan

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
 
S

souri challa

Amelyan,

Did you try setting an explict ID property for your dynamically
created controls at the time of creation. This should resolve the
issue. Without setting an ID, the asp.net page parser may build a
control tree with unpredictable IDs which causes a problem like the one
you mentioned.

-Souri Challa
 
S

Sosh123

The error message kind of gave it away didn't it!

"To avoid this error,
explicitly set the ID property of controls that raise postback events"

Lol
 
B

B Amelyan

You are right, the error message is kind of self explanatory.

However, the mystery question that no one has answered, yet. Why does
it only happen when I click the Back button on my browser and click my
dynamically generated button again? Otherwise, it is working just fine.
 

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,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top