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. Retrieve value from TextBox inside a GridView

Retrieve value from TextBox inside a GridView

Scheduled Pinned Locked Moved ASP.NET
question
9 Posts 4 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.
  • R Offline
    R Offline
    rakeshs312
    wrote on last edited by
    #1

    How can i get the text value of a textbox inside the gridview into a string

    B 1 Reply Last reply
    0
    • R rakeshs312

      How can i get the text value of a textbox inside the gridview into a string

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      What do you mean by

      rakeshs312 wrote:

      How can i get the text value of a textbox inside the gridview into a string

      Can you explain more your case?


      I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

      R 1 Reply Last reply
      0
      • B Blue_Boy

        What do you mean by

        rakeshs312 wrote:

        How can i get the text value of a textbox inside the gridview into a string

        Can you explain more your case?


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

        R Offline
        R Offline
        rakeshs312
        wrote on last edited by
        #3

        Hi, I have a gridview Gdv1 and inside that i have a TextBox txtname i want to retrieve the value inside the textbox into a string Thanks

        B A 2 Replies Last reply
        0
        • R rakeshs312

          Hi, I have a gridview Gdv1 and inside that i have a TextBox txtname i want to retrieve the value inside the textbox into a string Thanks

          B Offline
          B Offline
          Blue_Boy
          wrote on last edited by
          #4

          TextBox is inside TemplateField?


          I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

          R 1 Reply Last reply
          0
          • R rakeshs312

            Hi, I have a gridview Gdv1 and inside that i have a TextBox txtname i want to retrieve the value inside the textbox into a string Thanks

            A Offline
            A Offline
            Anurag Gandhi
            wrote on last edited by
            #5

            Navigate to the row containing TextBox. then, get the string value like: string str = ((TextBox)Row.FindControl("txtName")).Text;

            Anurag Gandhi. http://www.gandhisoft.com Life is a computer program and every one is the programmer of his own life.

            R 1 Reply Last reply
            0
            • B Blue_Boy

              TextBox is inside TemplateField?


              I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

              R Offline
              R Offline
              rakeshs312
              wrote on last edited by
              #6

              yes

              B 1 Reply Last reply
              0
              • A Anurag Gandhi

                Navigate to the row containing TextBox. then, get the string value like: string str = ((TextBox)Row.FindControl("txtName")).Text;

                Anurag Gandhi. http://www.gandhisoft.com Life is a computer program and every one is the programmer of his own life.

                R Offline
                R Offline
                rakeshs312
                wrote on last edited by
                #7

                TextBox txt2 = new TextBox(); txt2 = (TextBox)GridViewName.Rows[2].FindControl("textboxname"); string a = txt2.Text; not working

                A 1 Reply Last reply
                0
                • R rakeshs312

                  yes

                  B Offline
                  B Offline
                  Blue_Boy
                  wrote on last edited by
                  #8

                  Here is good google result on which you can find solution.[^]


                  I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

                  1 Reply Last reply
                  0
                  • R rakeshs312

                    TextBox txt2 = new TextBox(); txt2 = (TextBox)GridViewName.Rows[2].FindControl("textboxname"); string a = txt2.Text; not working

                    A Offline
                    A Offline
                    Abhishek Sur
                    wrote on last edited by
                    #9

                    Use RowDataBound event of Gridview to find the context item.

                    protected void GridView_RowDataBound(Object sender, GridViewRowEventArgs e)
                    {

                    if(e.Row.RowType == DataControlRowType.DataRow)
                    {
                      TextBox tb = e.Row..FindControl("textboxname") as TextBox;
                    }
                    

                    }

                    :cool:

                    Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


                    My Latest Articles-->** Simplify Code Using NDepend
                    Basics of Bing Search API using .NET
                    Microsoft Bing MAP using Javascript

                    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