Muhammad Ibrar Muhammad Ibrar - 1 year ago 66
ASP.NET (C#) Question

Accessing Properties of checkbox from link button of another page in ASP.NET

I am creating a web application using I'd like to know how to alter properties of a checkbox of one page from another page: Eg: my Page2.aspx page has a checkbox with id checkbox1 and by default its visibility is false. Now i need to set the visibility of checkbox1 to true from another page Page1.aspx with click event of a link button with id linkbutton1.
any help in this regards please?

Answer Source

You can use this approach also


<html xmlns="">
<head runat="server">

    <form id="form1" runat="server">
    <asp:linkbutton ID="Linkbutton1" runat="server" onclick="Linkbutton1_Click">LinkButton</asp:linkbutton>


protected void Linkbutton1_Click(object sender, EventArgs e)
        Response.Redirect("page2.aspx?visible=1");//this is how to control the visibility 

and page2.aspx.cs

protected void Page_Load(object sender, EventArgs e)
        //Request.QueryString["visible"].ToString() will be same

        if (Request.QueryString[0].ToString() != "1")
            CheckBox1.Visible = false;
            CheckBox1.Visible = true;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download