2

是否可以添加多个前一页标签,例如

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

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

默认3.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;   
}

默认4.aspx:

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

Default4.cs

TextBox1.Text = this.PreviousPage.id;

上面的代码工作正常,我的问题是,如果Default4.apsxDefault1.aspx我如何获取 id 调用这个页面?

4

1 回答 1

0

你应该使用

<%@ PreviousPageType TypeName

代替

<%@ PreviousPageType VirtualPath=

在MSDN上看到

编辑:查看URL以获取有关访问类型的更多详细信息..

于 2012-09-10T09:22:07.133 回答