View Link

Discussion in 'ASP .Net Web Controls' started by Morris Neuman, Jun 17, 2009.

  1. 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?
    --
    Thanks
    Morris
    Morris Neuman, Jun 17, 2009
    #1
    1. Advertising

  2. 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.

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

    >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?
    >--
    >Thanks
    >Morris
    >
    Thomas Sun [MSFT], Jun 17, 2009
    #2
    1. Advertising

  3. 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

    </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#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?
    >>--
    >>Thanks
    >>Morris
    >>

    >
    >
    Thomas Sun [MSFT], Jun 19, 2009
    #3
  4. Sorry for not replying sooner. You suggestions worked. I have used method 2
    - setting href.
    --
    Thanks for your help.
    Morris


    "Thomas Sun [MSFT]" wrote:

    > 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

    > </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> </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?
    > >>--
    > >>Thanks
    > >>Morris
    > >>

    > >
    > >

    >
    >
    Morris Neuman, Jun 22, 2009
    #4
  5. 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 [MSFT]" wrote:
    >
    >> 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

    >> </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> </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?
    >> >>--
    >> >>Thanks
    >> >>Morris
    >> >>
    >> >
    >> >

    >>
    >>

    >
    Thomas Sun [MSFT], Jun 23, 2009
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VB Programmer
    Replies:
    1
    Views:
    571
    VB Programmer
    Jul 10, 2003
  2. =?Utf-8?B?UmFlZCBTYXdhbGhh?=

    Icon View and list View in ASP.NET

    =?Utf-8?B?UmFlZCBTYXdhbGhh?=, Mar 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    473
    =?Utf-8?B?UmFlZCBTYXdhbGhh?=
    Mar 7, 2005
  3. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    782
    Kevin Spencer
    May 17, 2005
  4. Luqman
    Replies:
    2
    Views:
    3,781
    Luqman
    Feb 1, 2006
  5. Parthiv Joshi
    Replies:
    1
    Views:
    629
    Samuel L Matzen
    Jul 6, 2004
Loading...

Share This Page