Last post Oct 05, 2014 05:16 PM by AidyF
Oct 02, 2014 08:17 AM|qsoft_developer|LINK
I have a problem with Ajax which does not work in a master page.
I've added 2 image buttons to a master page and by ckicking them the content page changes.
The problem is that the entier page is refreshing and not just the UpdatePanel control.
This is the code I'm using:
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
protected void pageRedirect(object sender, ImageClickEventArgs e)
string PostBackControlID = getPostBackControlName().ToString();//find the control which is responsible for the postback
case "Applications"://STATUS = NEW (1)
I assume it's the Response.Redirect command which is causing the problem.
Can anyone help me with a solution on how to solve this?
Oct 02, 2014 08:43 AM|AidyF|LINK
What is pageRedirect and how is it called?
Oct 02, 2014 08:50 AM|qsoft_developer|LINK
Sorry, I forgot to add the following code:
<span style="position:absolute; left:5px; top:3px;">
<asp:ImageButton ID="Applications" runat="server" Height="25px"
ImageUrl="~/Images/table-edit-icon.png" ToolTip="Applications" onclick="pageRedirect" />
<span style="position:absolute; left:45px; top:3px;">
<asp:ImageButton ID="Queries" runat="server" Height="25px"
ImageUrl="~/Images/table_query_BW.png" ToolTip="Queries" onclick="pageRedirect"/>
This part is from the MasterPage.
Oct 02, 2014 09:00 AM|AidyF|LINK
Where are those controls in relation to the updatepanel?
Oct 02, 2014 10:26 AM|qsoft_developer|LINK
outise the updatePanel, right before it.
Oct 02, 2014 10:56 AM|AidyF|LINK
Oct 05, 2014 03:39 AM|qsoft_developer|LINK
ok, so how do I make it work?
How can I refresh only the content page?
I'm actually trying to use the image buttons as a menu. I prefer not to use the menu control.
Oct 05, 2014 03:53 AM|KathyW|LINK
If you are asking how you redirect to another page without refreshing the whole page: you don't. A new page is a new page. It doesn't matter if it shares identical content as the page before it. If you are under the impression that the master page is
an entity unto itself, to the browser, you are mistaken. Asp.net processes the content page first, then fetches the associated master page and interleaves their lifecycle events (http://msdn.microsoft.com/en-us/library/vstudio/dct97kc3(v=vs.100).aspx ).
The combined result is downloaded to the browser as a single page.
As for UpdatePanels: they give the visual effect of only refreshing part of the page - but that applies to the page they are on. They are not something that has an effect across multiple pages.
If that is not what you are asking, can you explain what you are looking for?
Oct 05, 2014 05:16 PM|AidyF|LINK
There aren't really any built in server controls that will do what you're looking for, you'll have to produce your own ajax solution, updating the pages of the page you want to update by making an ajax call to a web service, or web api, or page method, or
something inside your site. Google for ajax and web services and you'll find lots of examples. Personally I wouldn't bother, it's a lot of effort for no gain.