如何在搜索按钮后禁用主表单?

How to Disabled Master Form After Search Button?

**

这是我的搜索按钮代码,我想在搜索注册后禁用母版页**

try
            {
                signUp signUp = new signUp();
                signUp.Username = txtUserName.Text;
                Session["user"] = signUp.Authentication();
                Response.Redirect("BooksInformation.aspx");
                
            }
            catch (Exception ex)
            {
                lblOutput.Text = ex.Message;
            }

假设您在母版页中有这样的内容:

<a href="Student.aspx">Students</a>

为标签添加 runat="server"id 属性

<a href="Student.aspx" id="studentLink" runat="server">Students</a>

然后在 BooksInformation.aspxPage_Load 事件中确保用户已登录并隐藏链接:[​​=17=]

var studentLink = Master.FindControl("studentLink") as HtmlControl;
studentLink.Visible = false;