I have a DropDownList in a GridView footer cell. It has a HoverExtender that shows a Button which onClick activates a ModalPopUpextender by which a user can add a value to the DropDownList.
The UpdatePanel below is in the <FooterTemplate> of a nested GridView.
I have discovered that when a RowCommand event is activated on the child GridView that Controls are updated.........problem is that I have not been able to figure out how to envoke the RowCommand event from the Button control in the ModalPopupExtender.
It may be eaiser to do this with if I include the ModalPopupExtender and Panel back into the UpdatePanel, but then I am still left with the Button onClick event not firing.
I know there were other reasons why I keep my ModalPopupExtender outside of the UpdatePanel, but they don't come to mind ATM.
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 toAlways, 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 insideUpdatePanel
controls.
If the UpdateMode property is set toConditional, 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 anotherUpdatePanel
control and the parent panel is updated.
When the ChildrenAsTriggers property is set totrue and any child control of the
UpdatePanel control causes a postback. Child controls of nestedUpdatePanel
controls do not cause an update to the outerUpdatePanel control unless they are explicitly defined as triggers for the parent panel.
matt.gulick
Member
75 Points
86 Posts
UpdatePanel Not Refreshing Child Controls
Jan 04, 2013 03:50 PM|LINK
I have a DropDownList in a GridView footer cell. It has a HoverExtender that shows a Button which onClick activates a ModalPopUpextender by which a user can add a value to the DropDownList.
The UpdatePanel below is in the <FooterTemplate> of a nested GridView.
The ModalPopupExtender above activates the Panel below
I am certian that my markup is corrent as it is used elsewhere sucessfully. There is something else that I am not seeing.
Thanks for any assistance you can offer.
Harmeet Sing...
Member
101 Points
17 Posts
Re: UpdatePanel Not Refreshing Child Controls
Jan 04, 2013 04:10 PM|LINK
Change UpdateMode for Update Panel from Conditional to Always
---------------------------------------
Mark it as Answer, if work for you
---------------------------------------
matt.gulick
Member
75 Points
86 Posts
Re: UpdatePanel Not Refreshing Child Controls
Jan 04, 2013 04:30 PM|LINK
Thank-you for your reply but I already tried setting UpdateMode="Always".
radamanthys
Member
228 Points
74 Posts
Re: UpdatePanel Not Refreshing Child Controls
Jan 04, 2013 04:39 PM|LINK
Hi,
How is defined you ScriptManager on ASPX?
Please, we need the complete code.
matt.gulick
Member
75 Points
86 Posts
Re: UpdatePanel Not Refreshing Child Controls
Jan 04, 2013 04:59 PM|LINK
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" EnablePartialRendering="true" runat="server"></asp:ToolkitScriptManager>
is in the Master Page.
I do not believe it is a good idea to paste 1700 + lines of markup here.
radamanthys
Member
228 Points
74 Posts
Re: UpdatePanel Not Refreshing Child Controls
Jan 04, 2013 05:46 PM|LINK
Did you try include the ModalPopupExtender and the content Panel inside the UpdatePanel?
matt.gulick
Member
75 Points
86 Posts
Re: UpdatePanel Not Refreshing Child Controls
Jan 04, 2013 06:54 PM|LINK
Thank-you for your reply.
Yes, on your suggestion I did try, but Button_INSERT_Save_Consumer_OnClick will not fire when inside the UpdatePanel.
It runs the sql insert command among other things.
protected void Button_INSERT_Save_Consumer_OnClick(object sender, EventArgs e) { GridView GridView_Object = (GridView)Code.WebHelper.FindControlRecursive(Page, "GridView2"); SqlDataSource SqlDataSource_Object = (SqlDataSource)UserControl_CreateConsumer.FindControl("SqlDataSource_GridView_Consumer"); SqlConnection sqlConn = new SqlConnection(Master.sqlConnString); SqlCommand sqlCommand = new SqlCommand(SqlDataSource_Object.InsertCommand, sqlConn); sqlCommand.Parameters.Add("@ConsumerName", SqlDbType.VarChar, 50).Value = ((TextBox)UserControl_CreateConsumer.FindControl("TextBox_INSERT_Consumer_Name")).Text; try { sqlConn.Open(); sqlCommand.ExecuteNonQuery(); DropDownList DropDownList_Object = (DropDownList)GridView_Object.FooterRow.FindControl("DropDownList_INSERT_OrderLineItem_Consumer"); DropDownList_Object.Items.Clear(); DropDownList_Object.Items.Add(new ListItem("(Consumer)", "")); DropDownList_Object.DataBind(); UpdatePanel UpdatePanel_Object = (UpdatePanel)GridView_Object.FooterRow.FindControl("UpdatePanel_DropDownList_INSERT_OrderLineItem_Consumer"); UpdatePanel_Object.Update(); ModalPopupExtender ModalPopupExtender_Object = (ModalPopupExtender)GridView_Object.FooterRow.FindControl("ModalPopupExtender_INSERT_Consumer"); ModalPopupExtender_Object.Hide(); } catch (SqlException ex) { ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert('" + Code.WebHelper.GetCurrentMethod() + ": " + ex.Message.ToString().Replace("'", "") + "');</script>"); } finally { sqlCommand.Dispose(); sqlConn.Dispose(); sqlConn.Close(); } }I have discovered that when a RowCommand event is activated on the child GridView that Controls are updated.........problem is that I have not been able to figure out how to envoke the RowCommand event from the Button control in the ModalPopupExtender.
It may be eaiser to do this with if I include the ModalPopupExtender and Panel back into the UpdatePanel, but then I am still left with the Button onClick event not firing.
I know there were other reasons why I keep my ModalPopupExtender outside of the UpdatePanel, but they don't come to mind ATM.
radamanthys
Member
228 Points
74 Posts
Re: UpdatePanel Not Refreshing Child Controls
Jan 04, 2013 07:32 PM|LINK
Defining the AsyncPostBackTrigger with the button, should be enough.
Let me create a quick example related and recreate the scenario, and I told you how solve this issue...
chetan.sarod...
All-Star
66579 Points
11270 Posts
Re: UpdatePanel Not Refreshing Child Controls
Jan 07, 2013 02:13 AM|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 toAlways, 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 insideUpdatePanel controls.
If the UpdateMode property is set toConditional, 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'sUpdate method.
When the UpdatePanel control is nested inside anotherUpdatePanel control and the parent panel is updated.
When the ChildrenAsTriggers property is set totrue and any child control of the UpdatePanel control causes a postback. Child controls of nestedUpdatePanel controls do not cause an update to the outerUpdatePanel control unless they are explicitly defined as triggers for the parent panel.
for the details of updatepanel, please refer to: http://msdn.microsoft.com/en-us/library/bb386454.aspx.
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
matt.gulick
Member
75 Points
86 Posts
Re: UpdatePanel Not Refreshing Child Controls
Jan 07, 2013 11:55 AM|LINK
Thank-you for taking the time to respond. I have already read all about the UpdatePanel and it did not help with my situsation.
I posted here for help because as far as I understand I have done everything correct and yet the UpdatePanel is not functioning as expected.