View Link

M

Morris Neuman

Hi,

I am trying to link from an href or linkbutton on page1 to a view (View3) on
page2.

How do I link to this view and make it active at the same time?
 
T

Thomas Sun [MSFT]

Hi,

From your description, I understand that you want to know how to activate a
View of ASP.NET MultiView control when page is requested. If I have
misunderstood you, please feel free to let me know.

When page is loading, we can specify which View will be activated in
PageLoad event by setting MultiView's ActiveViewIndex property. In this
case, the page is redirected from another page, we can use query string in
URL or Session object to pass which view will be activated.

For example, there are two pages, PageA and PageB, and MultiView exists in
PageB.

##1. Use LinkButton's Click event to set active View's index and redirect
to PageB. In PageB, we get index from Session and activate View in PageLoad
event.

PageA=================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void LinkButton1_Click(object sender, EventArgs e)
{
Session["ViewIndex"] = 2;
Response.Redirect("DefaultB.aspx");
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Use LinkButton <asp:linkbutton ID="LinkButton1" runat="server"
OnClick="LinkButton1_Click">LinkButton</asp:linkbutton><br /><br />
</div>
</form>
</body>
</html>

PageB===================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
if (Session["ViewIndex"] != null)
{
int iIndex = 0;
try
{
iIndex = Convert.ToInt32(Session["ViewIndex"]);
}
catch
{
}

if (iIndex > 0 && iIndex < MultiView1.Views.Count)
{
MultiView1.ActiveViewIndex = iIndex;
}
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:multiview ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:view ID="View1" runat="server" >
This is View1.</asp:view>
<asp:view ID="View2" runat="server">
This is View2.</asp:view>
<asp:view ID="View3" runat="server">
This is View3.</asp:view>
</asp:multiview>&nbsp;</div>
</form>
</body>
</html>

##2. To use HTML link, we can specify View index in it. For example:

<a href="DefaultB.aspx?ViewIndex=2">Redirect Page B and activate View 3 </a>

In PageB, we retrieve value from requested URL in PageLoad event:
=====================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
string strIndex = Request.QueryString["ViewIndex"].ToString();

int iIndex = 0;
try
{
iIndex = Convert.ToInt32(strIndex);
}
catch
{
}

if (iIndex > 0 && iIndex < MultiView1.Views.Count)
{
MultiView1.ActiveViewIndex = iIndex;
}

}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:multiview ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:view ID="View1" runat="server" >
This is View1.</asp:view>
<asp:view ID="View2" runat="server">
This is View2.</asp:view>
<asp:view ID="View3" runat="server">
This is View3.</asp:view>
</asp:multiview>&nbsp;</div>
</form>
</body>
</html>

For more information about PageLoad event, see
http://msdn.microsoft.com/en-us/library/ms178472.aspx
For more information about passing value between pages, see
http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx
For more information about MultiView and View Web Server Controls, see
http://msdn.microsoft.com/en-us/library/ms227665(VS.85).aspx

I look forward to receiving your test results.


--
Best Regards,
Thomas Sun

Microsoft Online Partner Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
T

Thomas Sun [MSFT]

Hi Morris,

How are things going? I would appreciate it if you could post here to let
me know the status of the issue.

If you have any questions or concerns, please don't hesitate to let me
know.

I am happy to be of assistance and look forward to hearing from you.


--
Best Regards,
Thomas Sun

Microsoft Online Partner Support


Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontrols:4739
NNTP-Posting-Host: tk2tomimport1.phx.gbl 10.230.18.247

Hi,

From your description, I understand that you want to know how to activate a
View of ASP.NET MultiView control when page is requested. If I have
misunderstood you, please feel free to let me know.

When page is loading, we can specify which View will be activated in
PageLoad event by setting MultiView's ActiveViewIndex property. In this
case, the page is redirected from another page, we can use query string in
URL or Session object to pass which view will be activated.

For example, there are two pages, PageA and PageB, and MultiView exists in
PageB.

##1. Use LinkButton's Click event to set active View's index and redirect
to PageB. In PageB, we get index from Session and activate View in PageLoad
event.

PageA=================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void LinkButton1_Click(object sender, EventArgs e)
{
Session["ViewIndex"] = 2;
Response.Redirect("DefaultB.aspx");
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Use LinkButton <asp:linkbutton ID="LinkButton1" runat="server"
OnClick="LinkButton1_Click">LinkButton</asp:linkbutton><br /><br />
</div>
</form>
</body>
</html>

PageB===================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
if (Session["ViewIndex"] != null)
{
int iIndex = 0;
try
{
iIndex = Convert.ToInt32(Session["ViewIndex"]);
}
catch
{
}

if (iIndex > 0 && iIndex < MultiView1.Views.Count)
{
MultiView1.ActiveViewIndex = iIndex;
}
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:multiview ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:view ID="View1" runat="server" >
This is View1.</asp:view>
<asp:view ID="View2" runat="server">
This is View2.</asp:view>
<asp:view ID="View3" runat="server">
This is View3.</asp:view>
</asp:multiview>&nbsp;</div>
</form>
</body>
</html>

##2. To use HTML link, we can specify View index in it. For example:

<a href="DefaultB.aspx?ViewIndex=2">Redirect Page B and activate View 3
In PageB, we retrieve value from requested URL in PageLoad event:
=====================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
string strIndex = Request.QueryString["ViewIndex"].ToString();

int iIndex = 0;
try
{
iIndex = Convert.ToInt32(strIndex);
}
catch
{
}

if (iIndex > 0 && iIndex < MultiView1.Views.Count)
{
MultiView1.ActiveViewIndex = iIndex;
}

}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:multiview ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:view ID="View1" runat="server" >
This is View1.</asp:view>
<asp:view ID="View2" runat="server">
This is View2.</asp:view>
<asp:view ID="View3" runat="server">
This is View3.</asp:view>
</asp:multiview>&nbsp;</div>
</form>
</body>
</html>

For more information about PageLoad event, see
http://msdn.microsoft.com/en-us/library/ms178472.aspx
For more information about passing value between pages, see
http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx
For more information about MultiView and View Web Server Controls, see
http://msdn.microsoft.com/en-us/library/ms227665(VS.85).aspx

I look forward to receiving your test results.


--
Best Regards,
Thomas Sun

Microsoft Online Partner Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#noti f
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
M

Morris Neuman

Sorry for not replying sooner. You suggestions worked. I have used method 2
- setting href.
--
Thanks for your help.
Morris


Thomas Sun said:
Hi Morris,

How are things going? I would appreciate it if you could post here to let
me know the status of the issue.

If you have any questions or concerns, please don't hesitate to let me
know.

I am happy to be of assistance and look forward to hearing from you.


--
Best Regards,
Thomas Sun

Microsoft Online Partner Support


Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontrols:4739
NNTP-Posting-Host: tk2tomimport1.phx.gbl 10.230.18.247

Hi,

From your description, I understand that you want to know how to activate a
View of ASP.NET MultiView control when page is requested. If I have
misunderstood you, please feel free to let me know.

When page is loading, we can specify which View will be activated in
PageLoad event by setting MultiView's ActiveViewIndex property. In this
case, the page is redirected from another page, we can use query string in
URL or Session object to pass which view will be activated.

For example, there are two pages, PageA and PageB, and MultiView exists in
PageB.

##1. Use LinkButton's Click event to set active View's index and redirect
to PageB. In PageB, we get index from Session and activate View in PageLoad
event.

PageA=================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void LinkButton1_Click(object sender, EventArgs e)
{
Session["ViewIndex"] = 2;
Response.Redirect("DefaultB.aspx");
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Use LinkButton <asp:linkbutton ID="LinkButton1" runat="server"
OnClick="LinkButton1_Click">LinkButton</asp:linkbutton><br /><br />
</div>
</form>
</body>
</html>

PageB===================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
if (Session["ViewIndex"] != null)
{
int iIndex = 0;
try
{
iIndex = Convert.ToInt32(Session["ViewIndex"]);
}
catch
{
}

if (iIndex > 0 && iIndex < MultiView1.Views.Count)
{
MultiView1.ActiveViewIndex = iIndex;
}
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:multiview ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:view ID="View1" runat="server" >
This is View1.</asp:view>
<asp:view ID="View2" runat="server">
This is View2.</asp:view>
<asp:view ID="View3" runat="server">
This is View3.</asp:view>
</asp:multiview> </div>
</form>
</body>
</html>

##2. To use HTML link, we can specify View index in it. For example:

<a href="DefaultB.aspx?ViewIndex=2">Redirect Page B and activate View 3
In PageB, we retrieve value from requested URL in PageLoad event:
=====================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
string strIndex = Request.QueryString["ViewIndex"].ToString();

int iIndex = 0;
try
{
iIndex = Convert.ToInt32(strIndex);
}
catch
{
}

if (iIndex > 0 && iIndex < MultiView1.Views.Count)
{
MultiView1.ActiveViewIndex = iIndex;
}

}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:multiview ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:view ID="View1" runat="server" >
This is View1.</asp:view>
<asp:view ID="View2" runat="server">
This is View2.</asp:view>
<asp:view ID="View3" runat="server">
This is View3.</asp:view>
</asp:multiview> </div>
</form>
</body>
</html>

For more information about PageLoad event, see
http://msdn.microsoft.com/en-us/library/ms178472.aspx
For more information about passing value between pages, see
http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx
For more information about MultiView and View Web Server Controls, see
http://msdn.microsoft.com/en-us/library/ms227665(VS.85).aspx

I look forward to receiving your test results.


--
Best Regards,
Thomas Sun

Microsoft Online Partner Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#noti f
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols

Hi,

I am trying to link from an href or linkbutton on page1 to a view (View3) on
page2.

How do I link to this view and make it active at the same time?
 
T

Thomas Sun [MSFT]

Hi Morris,

Thanks for your response and I am glad that my reply can help you.

If you have any farther question, please feel free to post it here.


--
Best Regards,
Thomas Sun

Microsoft Online Partner Support

==================================================


--------------------
Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontrols:4745
NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols

Sorry for not replying sooner. You suggestions worked. I have used method 2
- setting href.
--
Thanks for your help.
Morris


Thomas Sun said:
Hi Morris,

How are things going? I would appreciate it if you could post here to let
me know the status of the issue.

If you have any questions or concerns, please don't hesitate to let me
know.

I am happy to be of assistance and look forward to hearing from you.


--
Best Regards,
Thomas Sun

Microsoft Online Partner Support


Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontrols:4739
NNTP-Posting-Host: tk2tomimport1.phx.gbl 10.230.18.247

Hi,

From your description, I understand that you want to know how to
activate
a
View of ASP.NET MultiView control when page is requested. If I have
misunderstood you, please feel free to let me know.

When page is loading, we can specify which View will be activated in
PageLoad event by setting MultiView's ActiveViewIndex property. In this
case, the page is redirected from another page, we can use query string in
URL or Session object to pass which view will be activated.

For example, there are two pages, PageA and PageB, and MultiView exists in
PageB.

##1. Use LinkButton's Click event to set active View's index and redirect
to PageB. In PageB, we get index from Session and activate View in PageLoad
event.

PageA=================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void LinkButton1_Click(object sender, EventArgs e)
{
Session["ViewIndex"] = 2;
Response.Redirect("DefaultB.aspx");
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Use LinkButton <asp:linkbutton ID="LinkButton1" runat="server"
OnClick="LinkButton1_Click">LinkButton</asp:linkbutton><br /><br />
</div>
</form>
</body>
</html>

PageB===================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
if (Session["ViewIndex"] != null)
{
int iIndex = 0;
try
{
iIndex = Convert.ToInt32(Session["ViewIndex"]);
}
catch
{
}

if (iIndex > 0 && iIndex < MultiView1.Views.Count)
{
MultiView1.ActiveViewIndex = iIndex;
}
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:multiview ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:view ID="View1" runat="server" >
This is View1.</asp:view>
<asp:view ID="View2" runat="server">
This is View2.</asp:view>
<asp:view ID="View3" runat="server">
This is View3.</asp:view>
</asp:multiview> </div>
</form>
</body>
</html>

##2. To use HTML link, we can specify View index in it. For example:

<a href="DefaultB.aspx?ViewIndex=2">Redirect Page B and activate View 3
In PageB, we retrieve value from requested URL in PageLoad event:
=====================
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
string strIndex = Request.QueryString["ViewIndex"].ToString();

int iIndex = 0;
try
{
iIndex = Convert.ToInt32(strIndex);
}
catch
{
}

if (iIndex > 0 && iIndex < MultiView1.Views.Count)
{
MultiView1.ActiveViewIndex = iIndex;
}

}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:multiview ID="MultiView1" runat="server" ActiveViewIndex="0" >
<asp:view ID="View1" runat="server" >
This is View1.</asp:view>
<asp:view ID="View2" runat="server">
This is View2.</asp:view>
<asp:view ID="View3" runat="server">
This is View3.</asp:view>
</asp:multiview> </div>
</form>
</body>
</html>

For more information about PageLoad event, see
http://msdn.microsoft.com/en-us/library/ms178472.aspx
For more information about passing value between pages, see
http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx
For more information about MultiView and View Web Server Controls, see
http://msdn.microsoft.com/en-us/library/ms227665(VS.85).aspx

I look forward to receiving your test results.


--
Best Regards,
Thomas Sun

Microsoft Online Partner Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#noti
f
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------

X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols

Hi,

I am trying to link from an href or linkbutton on page1 to a view (View3)
on
page2.

How do I link to this view and make it active at the same time?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top