Saturday, June 25, 2011

Page_Load getting called twice

Hi All,

While working on one of my assignments past week I faced a strange problem. The problem was that my Page_Load event handler was getting called twice for apparently no reason. I was absolutely stumped. Then after a bit of trouble shooting and hit & trial, I found that the problem was a image tag.

My page gets post backed twice only in scenarios when source attribute's value of image control was rendering empty. So I just arranged a no image url in cases when there was no actual image url and got rid of my problem.

Similar problem I also faced a few months back, at that time I was working with link button. Then I was using link button for redirect user to some other page on link click. At that time I solved my problem by using hyperlink control in place of link button control.

Both these cases were, more or less magical for me ;)

I shared with you how I got my problem solved but if you know why was this problem occurring then kindly spare a few minutes to share it here. One more thing in both of these cases I was working on DNN.

No comments:

Post a Comment

About Me

My photo
Delhi, India
Fun, music, travel and nature loving, always smiling, computer addict!!