TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Shankar M
NA
3k
3.3m
window.history.forward(1) + Master Page+Panel + Update Panel
Apr 1 2018 9:40 AM
Hi Team,
I have a master Page solution with update panel in WebForm2.aspx which has 2 panel controls. On Page Load I am hiding Panel2 and on click of button in Panel1 I am showing the Panel2. Both these panels are enclosed between Update Panel.
With out update panel on the Web Form2.aspx right clicking the page and clicking back does not load the page from cache. But, with update panel control it displays me the First panel which I need to restrict it. Any help appreciated. Thanks
Code
Site1.Master
<
%@ Master
Language
=
"C#"
AutoEventWireup
=
"true"
CodeBehind
=
"Site1.master.cs"
Inherits
=
"WebApplication2.Site1"
%
>
<!DOCTYPE html
>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
>
</
title
>
<
script
type
=
"text/javascript"
>
window.history.forward(1);
</
script
>
<
asp:ContentPlaceHolder
ID
=
"head"
runat
=
"server"
>
</
asp:ContentPlaceHolder
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
div
>
<
asp:ContentPlaceHolder
ID
=
"ContentPlaceHolder1"
runat
=
"server"
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Button"
OnClick
=
"Button1_Click"
/>
</
asp:ContentPlaceHolder
>
</
div
>
</
form
>
</
body
>
</
html
>
WebForm1.aspx
<
%@ Page
Title
=
""
Language
=
"C#"
MasterPageFile
=
"~/Site1.Master"
AutoEventWireup
=
"true"
CodeBehind
=
"WebForm1.aspx.cs"
Inherits
=
"WebApplication2.WebForm1"
%
>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"head"
runat
=
"server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
runat
=
"server"
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Button"
OnClick
=
"Button1_Click"
/>
</
asp:Content
>
Server code
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
namespace
WebApplication2
{
public
partial
class
WebForm1 : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
protected
void
Button1_Click(
object
sender, EventArgs e)
{
Response.Redirect(
"WebForm2.aspx"
);
}
}
}
WebForm2.aspx
<
%@ Page
Title
=
""
Language
=
"C#"
MasterPageFile
=
"~/Site1.Master"
AutoEventWireup
=
"true"
CodeBehind
=
"WebForm2.aspx.cs"
Inherits
=
"WebApplication2.WebForm2"
%
>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"head"
runat
=
"server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
runat
=
"server"
>
<
asp:UpdatePanel
ID
=
"UpdatePanel1"
runat
=
"server"
>
<
ContentTemplate
>
<
asp:Panel
runat
=
"server"
ID
=
"Panel1"
BackColor
=
"#99CCFF"
Height
=
"50px"
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Button"
OnClick
=
"Button1_Click"
/>
</
asp:Panel
>
<
br
/>
<
br
/>
<
br
/>
<
br
/>
<
asp:Panel
runat
=
"server"
ID
=
"Panel2"
BackColor
=
"#FFCC66"
ForeColor
=
"Gray"
Height
=
"100px"
>
<
asp:Button
ID
=
"Button2"
runat
=
"server"
Text
=
"Button"
/>
</
asp:Panel
>
</
ContentTemplate
>
</
asp:UpdatePanel
>
</
asp:Content
>
Server code - Web Form2.aspx
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
namespace
WebApplication2
{
public
partial
class
WebForm2 : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
Panel2.Visible =
false
;
}
protected
void
Button1_Click(
object
sender, EventArgs e)
{
Panel1.Visible =
false
;
Panel2.Visible =
true
;
}
}
}
Thanks in Advance.
Reply
Answers (
1
)
ASP.NET with MVC And API Key using my website
crystal reports is not displaying data