Modal popup extender disappears on gridview refresh - c#

I'm having an update panel which is refreshing the gridview every 2 seconds. I've added modalpopup extender to confirm user action within the gridview. And I've wrapped all other controls in my asp page in another update panel to avoid the page being refreshed everytime.
While I think I'm only refreshing the gridview the whole page is refreshing and the modal popup extender disappear after 2 sec. Please help me with a solution.
strong text
This is how my aspx page looks like.
--Mainupdatepanel--
--div--
--table--
--dropdown--
--button--
--textbox--
--/table--
--updatePanel1
--gridview with item template buttons--
--/updatepanel1--
--updatepanel2--
--confirmbuttonextender--
--confirmbuttonextender>
--modalpopup--
--/modalpopup--
--panel--
--buttons -- for modalpopup
--/panel--
--/updatepanel2--
--/div--
--/MainUpdatepanel--
In the code behind:
Timer_click event I've called updatepanel1.update();
In the click events of the button inside gridview I've called updatepanel2.update();

If you have multiple update panels on the page and you want them to refresh independently you need to make sure you set the UpdateMode property of the update panels to Conditional
Also as it seems both update panels are in turn wrapped in a update panel you will need to alter the ChildrenAsTriggers property to be false else the mainupdatepanel will update with the inner update panels

Related

Bootstrap Modal Popup not working with Update Panel

I have a listview which has a child element(a button) which opens a modal popup upon click. After i add an Update Panel the pop up does not work.
The popup has some fields which when updated should refresh the listview. Tried placing it outside & inside the update panel, nothing seem to work.
Please advise. Thanks.
Try using a ModalPopupExtender and have this refer to a Panel which contains your bootstrap modal markup.
Try this for starters. ModalPopupExtender example

gridview in bootstrap modal popup issue

I used bootstrap modal popup and in that there is need to implement a gridview.
Using update panel,I added gridview and databinding is working properly.
In gridview row, there is a textbox where user can modify the existing values and update with a save button outside the gridview.
But when I fire the Save button command at server side, I am not getting the updated values instead I am getting old values by looping gridview rows controls.
How to get the updated values of from textbox in gridview inside bootstrap modal popup? I have used update panel also.
Please suggest.
In save button event, make sure that you are refreshing the gridview content adding databind() once you have saved the new values
YourGridView.DataSource = TheSource;
YourGridView.DataBind();
after hitting the update and fetching back the updated values you should register back the modal popup from c# at the end of the same event
ScriptManager.RegisterStartupScript(this,this.GetType(),"Pop", "openModal();", true);``
Customize the script according to your need

How to get master page control in content page's update panel in asp.net

Have a label control in master page.Should get this control to content page's update panel.
The code in content page is
ModalPopupExtender popUp = (ModalPopupExtender)Master.FindControl("ModalPopupExtender1");
HtmlGenericControl lblMessage = (HtmlGenericControl)Master.FindControl("InfoMesg");
lblMessage.InnerText = "Invalid page number, Please enter valid page number.";
popUp.Show();
When update panel is place the message in lblMessage is not being displayed.
Can someone please help me achieve this.
First of all, why isn't it working? When postback is triggered by UpdatePanel (so to say), the only part of the page that will be updated on response is the UpdatePanel content. This label is outside of the UpdatePanel; therefore it won't be updated.
How to work around this anyway:
Obvious, but in theory most welcome solution. Move label inside the UpdatePanel, if it is something that logically belongs there. Of course this might not apply to your particular case.
UpdatePanel could register some script that would update the text of the label (make sure to use ClientID).
If your UpdatePanel does not have an UpdateMode set, or it is set to Always (basically this is a default value), afaik all other update panels will be updated as well when this one causes a postback. So you can wrap the label in a separate UpdatePanel.

How to highlight the linkbutton when it's clicked.

Siva here.
I have used Default aspx page with bunch of link buttons in sidebar. Using asp panel i loaded the user control in panel. Here every thing is perfect. I can't highlight the active link button without post back.
ASP has a control called the Update panel (http://msdn.microsoft.com/en-us/library/bb386454(v=vs.100).aspx)
wich basicly allows you to call events while not using the postback trigger.
i hope this helps.

Updating an ajax model pop up in an update panel

I have a page with an update panel, this page also has an ajax model popup. When I click some buttons I make some changes in code behind and then show the popup. For some reason when I click the button in the update panel no changes occur in the popup.
Debugging through the click I see that the changes are applied but the popup is not refreshed.
Any suggestions would be greatly appreciated.
You need to register a post back trigger so that the popup is completely refreshed. This is of course if you want the page to post back, otherwise if you want those changes to be reflected in the popup you will need to use javascript.
example:
asp:PostBackTrigger ControlID="UploadTemplateImageButton"
you have to set the panel visibility to false on page load.
ex: panel1.Visible=false;

Categories