0

I have a problem and it is like that I have two forms in asp.net, In one form I have Button1 one and in another form I have two buttons, Button1 and Buton2 now when I click Button1 in first web form the buttons of other web form should hide, how this can be done in asp.net

3 Answers3

1

Solution1 : You can use Sessions as below on Button_Click Event

Session["DisableButtons"] = "True"

In 2nd page of Load Event you can check as below

if(!IsPostBack)
{
 if (Session["DisableButtons"] = "True")
 {
 btn1.Visible = False;
 btn2.Visible = False;
 }
}

Solution 2 : You can send a variable's value in the URL when you are doing Response.Redirect and you can fetch from URL using Request.QueryString.

Shubhojit
  • 121
  • 6
  • 1
    We can use Cross Page posting also if we are going to do this with the help of Request.QuertString – Aman May 28 '14 at 07:30
0

Try using jQuery

$(document).ready(function(){
  $("#ButtonID1").click(function(){
    $("#ButtonID2").hide() //or .toggle(); if you want to hide/show
  });
})
Kevin Cloet
  • 2,956
  • 1
  • 19
  • 36
0

Send values from one form to another form

you can use the logic from here for hiding the contents of webfroms using another either you can use Session .

I don't have enough Reputation else it will be posted in comment .

Thank you

Udit Bhardwaj

Community
  • 1
  • 1