Reputation: 980
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
Upvotes: 1
Views: 1201
Reputation: 31
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.
Upvotes: 2
Reputation: 6501
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.
Upvotes: 1
Reputation: 115763
Is your databind happening in the page_load event? If not, are you rebinding when the page is reloaded?
Are your controls loaded dynamically?
Upvotes: 0