2

is it possible to add more than one previous page tag like

<%@ PreviousPageType VirtualPath="~/Default3.aspx" %>
<%@ PreviousPageType VirtualPath="~/Default3.aspx" %> 

Default3.aspx:

 <asp:GridView ID="grdexample" runat="server" 
     AutoGenerateColumns="False"  onrowcommand="grdexample_RowCommand">
    <Columns>
        <asp:TemplateField>
            <ItemTemplate>
                **<asp:LinkButton ID="lnkbtn" runat="server" Text="Edit" PostBackUrl="~/Default4.aspx" />**
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField HeaderText="Name" DataField="ActMasNm" />
        <asp:BoundField HeaderText="ID" DataField="ActMasId" />
        <asp:TemplateField>
            <ItemTemplate>
                <asp:HiddenField ID="hdnso" runat="server" Value='<%# Eval("ActMasId") %>' />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

Default3.cs:

public string id { get; set; }
protected void grdexample_RowCommand(object sender, GridViewCommandEventArgs e)
{
    GridViewRow gvrw = (GridViewRow)((Control)e.CommandSource).Parent.Parent;<br>
    int rwIndex = gvrw.RowIndex;<br>
    HiddenField hdn = (HiddenField)gvrw.FindControl("hdnso");<br>
    id = hdn.Value;   
}

Default4.aspx:

< PreviousPageType VirtualPath="~/Default3.aspx" >

Default4.cs

TextBox1.Text = this.PreviousPage.id;

Above code is working fine, my problem is, if call this page Default4.apsx from Default1.aspx how can i fetch id?

Mayank Pathak
  • 3,621
  • 5
  • 39
  • 67
user1645200
  • 135
  • 2
  • 13

1 Answers1

0

You shoud use

<%@ PreviousPageType TypeName

instead of

<%@ PreviousPageType VirtualPath=

see it on MSDN

EDIT : Chek this URL for more Details on accessing types..

Mayank Pathak
  • 3,621
  • 5
  • 39
  • 67