when i change the dropdownlist selectedindexchange everything is ok and just the updatepanel content is being updated,but when is lick mybuton to just update lblTime value then the updatepanel content is being updated too,why is it that way although i set
the updatemode of updatepanel to conditional??????
Because the button will cause a full postback which also updates the updatepanel content.
What the updatepanel does is always you to conditionally update content based on triggers. So any trigger will ONLY updates the updatepanel. But any other control that causes a postback will also update the updatepanel unless you put that control in a separate
updatepanel with updatemode conditional.
The following list describes the property settings of the UpdatePanel control that determine when a panel's content is updated during partial-page
rendering.
If the UpdateMode property is set to
Always, the
UpdatePanel control’s content is updated on every postback that originates from anywhere on the page. This includes asynchronous postbacks from controls
that are inside other UpdatePanel controls, and postbacks from controls that are not inside
UpdatePanel controls.
If the UpdateMode property is set to
Conditional, the
UpdatePanel control’s content is updated when one of the following is true:
When the postback is caused by a trigger for that UpdatePanel control.
When the UpdatePanel control is nested inside another
UpdatePanel control and the parent panel is updated.
When the ChildrenAsTriggers property is set to
true and any child control of the UpdatePanel control causes a postback. Child controls of nested
UpdatePanel controls do not cause an update to the outer
UpdatePanel control unless they are explicitly defined as triggers for the parent panel.
Chetan Sarode
Team Lead, Product Development
Approva Systems Pvt Ltd, Pune, India.
None
0 Points
2 Posts
Problem With UpdatePanel
Dec 28, 2013 03:22 PM|Moya|LINK
hi everyone,
my problem is that i have one updatepanel in aspx page,i set it's updatemode to "conditional" and i sert an asynchpostbacktrigger for it as below:
as you see i have a button that is outside of updatepanel and my button code behid is : lblTime.Text = DateTime.Now.ToLongTimeString();
and pageload of the page is:
protected void Page_Load(object sender, EventArgs e)
{
lblTime.Text = DateTime.Now.ToLongTimeString();
lblUpdatepnel.Text = DateTime.Now.ToLongTimeString();
}
when i change the dropdownlist selectedindexchange everything is ok and just the updatepanel content is being updated,but when is lick mybuton to just update lblTime value then the updatepanel content is being updated too,why is it that way although i set the updatemode of updatepanel to conditional??????
All-Star
101931 Points
20703 Posts
Re: Problem With UpdatePanel
Dec 29, 2013 01:22 AM|MetalAsp.Net|LINK
Because the button will cause a full postback which also updates the updatepanel content.
What the updatepanel does is always you to conditionally update content based on triggers. So any trigger will ONLY updates the updatepanel. But any other control that causes a postback will also update the updatepanel unless you put that control in a separate updatepanel with updatemode conditional.
All-Star
48393 Points
12161 Posts
Re: Problem With UpdatePanel
Dec 29, 2013 10:38 PM|chetan.sarode|LINK
How UpdatePanel Controls Are Refreshed
The following list describes the property settings of the UpdatePanel control that determine when a panel's content is updated during partial-page rendering.
If the UpdateMode property is set to Always, the UpdatePanel control’s content is updated on every postback that originates from anywhere on the page. This includes asynchronous postbacks from controls that are inside other UpdatePanel controls, and postbacks from controls that are not inside UpdatePanel controls.
If the UpdateMode property is set to Conditional, the UpdatePanel control’s content is updated when one of the following is true:
When the postback is caused by a trigger for that UpdatePanel control.
When you explicitly call the UpdatePanel control's Update method.
When the UpdatePanel control is nested inside another UpdatePanel control and the parent panel is updated.
When the ChildrenAsTriggers property is set to true and any child control of the UpdatePanel control causes a postback. Child controls of nested UpdatePanel controls do not cause an update to the outer UpdatePanel control unless they are explicitly defined as triggers for the parent panel.
Team Lead, Product Development
Approva Systems Pvt Ltd, Pune, India.