当前位置:编程学习 > C#/ASP.NET >>

继承母版页的两个页面之间的传值问题;将A页中Gridview中的一条记录值传到另B页

我之间没用母版页传值都没问题.后来我创建了个母版页,把它们移到里边就出问题了.思来想去都搞不定了.请各位高手帮忙看看.谢谢/ --------------------编程问答-------------------- 界面上GirdView中的修改模板列:
<asp:TemplateField HeaderText="修改" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="Button1" runat="server" CausesValidation="False" CommandName="Select"
                            PostBackUrl="~/Admins/UpdateUsers.aspx" Text="修改" />
                    </ItemTemplate>
                </asp:TemplateField> 

.cs里的取值代码:
        GridView gv = (GridView)PreviousPage.FindControl("gvusers");
        if (gv != null)
        {
            Label SourceTextBox = (Label)gv.SelectedRow.FindControl("Label1");
            Label Sourceddlcommission = (Label)gv.SelectedRow.FindControl("Label6");
            Label Sourceddlcommission_bjl = (Label)gv.SelectedRow.FindControl("Label7");
            if (Sourceddlcommission != null)
            {
                ddlCommission.SelectedValue = Sourceddlcommission.Text;
            }
            if (Sourceddlcommission_bjl != null)
            {
                ddlCommission_bjl.SelectedValue = Sourceddlcommission_bjl.Text;
            }
        }
之前没有用母版页.都可以实现.继承之后就不行了.调试结果是gv=null;
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,