Click here to Skip to main content
15,905,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a master page and content pages. In master page I have some buttons which on click would
take to respective content page. What happens is whenever I click a button in master page, the
whole master page is refreshing alongwith the content page. I want to know how stop this master page refreshing. When I searched Google I got an idea of using two lines under head tag of master page like 'meta..', 'meta..'. This also not helping. Even if I dont use Update Panel it doesnt work. Even if updatemode=conditional is removed it doesnt work. The buttons (not shown here) are within Update Panel. I submit my code:

XML
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
<meta http-equiv ="Page-Enter" content ="blendTrans(Duration=0)"/>
<meta http-equiv="Page-Exit"content="blendTrans(Duration=0)"/>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
  <form id="form1" runat="server">
  <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"   >
  </asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel133" runat="server"  UpdateMode="Conditional">
    <ContentTemplate>
    <div>
       <asp:Panel ID="Panel1" runat="server" Width="943"  Style=" margin-left:285px; margin-top:2px;" Height="200" >
        <table class="" style=" margin-left:-1px; margin-top:-1px" width="178">
       <tr>
       <td>
      <asp:Image ID="Image3" runat="server" DescriptionUrl="~/good food logo.jpg"
       Height="200px" ImageUrl="~/good food logo.jpg"   Width="220px" />
       </td>
       </tr>
       </table>
Posted
Updated 15-Nov-18 2:14am
Comments
[no name] 20-Feb-14 3:35am    
Use AJAX update panel to without page reload.

1 solution

you forgot to put this
before the contenttemplate

C#
 <triggers>
  <asp:asyncpostbacktrigger controlid="name of your button" eventname="the click event" />
</triggers>
 
Share this answer
 
v4
Comments
S.Rajendran from Coimbatore 20-Feb-14 3:56am    
For the button I tried like this but get an exception like:
'could not find an event named 'btnherbal_click' on associated control 'Button5' for the trigger in UpdatePanel'dd'.'

<asp:UpdatePanel ID="dd" runat="server" UpdateMode="Conditional">
<triggers>
<asp:asyncpostbacktrigger controlid="Button5" eventname="btnherbal_click" />
</triggers>
<contenttemplate>
<asp:Button ID="Button5" runat="server" Text='Herbals ' Font-Size="Small" BackColor="AliceBlue" CausesValidation="false" OnClick="btnherbal_click" ForeColor="Black" Style=" cursor:pointer; font-family:Arial Black; font-weight:500; margin-top:28px " BorderStyle="None" />

The14thNoah 20-Feb-14 4:10am    
I see. . .I will be back tom, time to go home now
S.Rajendran from Coimbatore 20-Feb-14 4:53am    
I changed <asp:asyncpostbacktrigger controlid="Button5" eventname="click" />, no use.
The14thNoah 20-Feb-14 18:44pm    
<asp:asyncpostbacktrigger controlid="Button5" eventname="Button5_Click" /> use this. . .or click your button in Html then it will redirect you to the click event of the button in code behind see the void event then copy it to eventname

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900