Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How i can access Text Box in query

How i can access Text Box in query

Scheduled Pinned Locked Moved ASP.NET
databasealgorithms
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Saba02
    wrote on last edited by
    #1

    Hello all, I have a Mster Page contained some control for Search:DropDownList,TextBox,Button I have another page named Search.aspx i don't know how i can access the textbox in query: switch((Master.FindControl("DropDownList1") as DropDownList).SelectedValue) { case "Title": DataList1.DataSource = SqlDataSource1; break; . . . } my sqldatasource1 :select * from table where title=myTextbox.text but i don't know how i can access to this textbox that placed in master page. i don't know this work for Searching is true or no,if it's false i be glad for your saying. Thank you,

    Hoda

    C L 2 Replies Last reply
    0
    • S Saba02

      Hello all, I have a Mster Page contained some control for Search:DropDownList,TextBox,Button I have another page named Search.aspx i don't know how i can access the textbox in query: switch((Master.FindControl("DropDownList1") as DropDownList).SelectedValue) { case "Title": DataList1.DataSource = SqlDataSource1; break; . . . } my sqldatasource1 :select * from table where title=myTextbox.text but i don't know how i can access to this textbox that placed in master page. i don't know this work for Searching is true or no,if it's false i be glad for your saying. Thank you,

      Hoda

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      The way I'd do it is this: write a base class for all your pages. Add a property there that returns your specific Master page class, not the generic class you get from the base page. To the master page, add a public propery to get the text from the textbox. FindControl is just nastiness, why go searching when you can specify where it is ?

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      1 Reply Last reply
      0
      • S Saba02

        Hello all, I have a Mster Page contained some control for Search:DropDownList,TextBox,Button I have another page named Search.aspx i don't know how i can access the textbox in query: switch((Master.FindControl("DropDownList1") as DropDownList).SelectedValue) { case "Title": DataList1.DataSource = SqlDataSource1; break; . . . } my sqldatasource1 :select * from table where title=myTextbox.text but i don't know how i can access to this textbox that placed in master page. i don't know this work for Searching is true or no,if it's false i be glad for your saying. Thank you,

        Hoda

        L Offline
        L Offline
        Laxmikant Lad
        wrote on last edited by
        #3

        add this direcvtive in html ]]> and you can access the master pages text box like MasterPage pg = new MasterPage(); TextBox tb = (TextBox)pg.FindControl("Text1"); :laugh:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups