TextBox and Button Visible true or false problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peerraghu
    New Member
    • Nov 2007
    • 30

    TextBox and Button Visible true or false problem

    hi
    I am creating travels project, in left part of my datagrid of my default page i placed all the products such as india tour ,world tour etc and if v click any product it will redirect to itennary page according to their ID's
    my problem is i inserted new product as Hotel Booking and i want to place textbox and a button in the itenary page and if v click india tour or world tour i want those textbox and button should be not visible and if v click Hotel booking then those textbox and button should visible
    Please solve my problem its urgent.
    Thank you in advance
    raghu
  • int08h
    New Member
    • Apr 2007
    • 28

    #2
    in Page_Load method
    protected void Page_Load()
    {
    //Only an example, use your way to get ID
    int id = int.Parse(Reque st.QueryString["ID"]);

    if (id == "world tour") //etc...
    {
    TextBox1.Visibl e = false;
    Button1.Visible = false;
    }
    }

    Comment

    • peerraghu
      New Member
      • Nov 2007
      • 30

      #3
      Sorry i am getting error near
      if (id == "world tour")
      Error 1 Operator '==' cannot be applied to operands of type 'int' and 'string'

      Comment

      • priyamv
        New Member
        • Jan 2008
        • 17

        #4
        You have to check for the id from the querry string

        if id from querry string =Hotelmgt id then

        textbox.visible =true
        Buttonid.visibl e=true

        else

        textbox.visible =false
        Buttonid.visibl e=false

        Comment

        • peerraghu
          New Member
          • Nov 2007
          • 30

          #5
          sorry still i am not able to get can u please give me the code in c#

          Comment

          Working...