1

HI everyone, I'm having the following issue that is really driving me crazy.

After I perform any sort of postback, several controls do not rebind themselves, for instance

DetailsView with an attached ObjectDataSource (in my case ObjectContainerDataSource) LoginView is not showing the LoggedInTemplate but LoginStatus is showing me as logged in.

I'm almost desperate and I like to know if you've had the same issue or similar in the past and can give me some hint.

Thanks in advance

3 Answers 3

2

If the binding is performed in the Page_Load method, make sure that it is inside the if not postback loop.

if (!IsPostBack) { //Your code to bind data } 

After each postback, the page load event is triggered. So if the controls are not made to bind inside the above given loop, the binding will take place each time the postback occurs.

Sign up to request clarification or add additional context in comments.

Comments

1

Without seeing any of your actual code I would suggest you look at EnableViewState settings for the page and for the individual controls.

This is a good article on managing viewstate.

You should also look for code in a section like this in your page_load()

if(!IsPostback) { // code to bind some of your controls } 

That code would only be called the first time you enter the page, but not in the postback. If you leave the page and come back then that bind code would run again.

Comments

0

Is your databind happening in the page_load event? If not, are you rebinding when the page is reloaded?

Are your controls loaded dynamically?

1 Comment

-1 for what?? Curious who gave this -ve vote and didn't manage to leave any comment. (+1 from me)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.