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. Insert Record from Textbox into GridView

Insert Record from Textbox into GridView

Scheduled Pinned Locked Moved ASP.NET
database
8 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.
  • N Offline
    N Offline
    NET India
    wrote on last edited by
    #1

    Hello Friends, I've a textbox and Button As i click on button it should generate a new row to insert and insert the data into GridView's row from textbox. Actually i've to save the data into gridview and finally into database from gridview.

    N S 2 Replies Last reply
    0
    • N NET India

      Hello Friends, I've a textbox and Button As i click on button it should generate a new row to insert and insert the data into GridView's row from textbox. Actually i've to save the data into gridview and finally into database from gridview.

      N Offline
      N Offline
      nagendrathecoder
      wrote on last edited by
      #2

      The simplest thing you can do is cast the DataSource of GridView to a DataTable, add a new row to DataTable from TextBox and bind it to GridView on ButtonClick. :)

      1 Reply Last reply
      0
      • N NET India

        Hello Friends, I've a textbox and Button As i click on button it should generate a new row to insert and insert the data into GridView's row from textbox. Actually i've to save the data into gridview and finally into database from gridview.

        S Offline
        S Offline
        sashidhar
        wrote on last edited by
        #3

        Are u talking Abt Grid View Insert If Yes..! GridView with insert line[^] Extended GridView with Insert Functionality[^]

        LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

        N 1 Reply Last reply
        0
        • S sashidhar

          Are u talking Abt Grid View Insert If Yes..! GridView with insert line[^] Extended GridView with Insert Functionality[^]

          LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

          N Offline
          N Offline
          nagendrathecoder
          wrote on last edited by
          #4

          Oh, i thought his TextBox and Button are outside Grid. :-D

          S 1 Reply Last reply
          0
          • N nagendrathecoder

            Oh, i thought his TextBox and Button are outside Grid. :-D

            S Offline
            S Offline
            sashidhar
            wrote on last edited by
            #5

            LOL..! ITs a repeated question from Beginners i assume like tht ..! it may not be true..!:cool:

            LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

            N 1 Reply Last reply
            0
            • S sashidhar

              LOL..! ITs a repeated question from Beginners i assume like tht ..! it may not be true..!:cool:

              LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

              N Offline
              N Offline
              nagendrathecoder
              wrote on last edited by
              #6

              Yes you are right. But let him break the suspence. ;P

              N 1 Reply Last reply
              0
              • N nagendrathecoder

                Yes you are right. But let him break the suspence. ;P

                N Offline
                N Offline
                NET India
                wrote on last edited by
                #7

                It may be very easier for you to do but not for me. Actually I've to add row with data into gridview using javascript. And i've reached to an extent. But i'm not getting how to insert the record into gridview. I've done to add into a 'tbody' tag. Please suggest me the way or what changes i should make in my code. I'm giving my code below. { var myTable = document.getElementById("ctl00_cphAdminMaster_GridView1"); var tBody = myTable.getElementsByTagName('tbody')[0]; var newTR = document.createElement('tr'); var newTD = document.createElement('td'); newTD.innerHTML=document.getElementById("ctl00_cphAdminMaster_txtName").value; newTR.appendChild (newTD); //tBody.appendChild(newTR); myTable.appendChild(newTR); }

                S 1 Reply Last reply
                0
                • N NET India

                  It may be very easier for you to do but not for me. Actually I've to add row with data into gridview using javascript. And i've reached to an extent. But i'm not getting how to insert the record into gridview. I've done to add into a 'tbody' tag. Please suggest me the way or what changes i should make in my code. I'm giving my code below. { var myTable = document.getElementById("ctl00_cphAdminMaster_GridView1"); var tBody = myTable.getElementsByTagName('tbody')[0]; var newTR = document.createElement('tr'); var newTD = document.createElement('td'); newTD.innerHTML=document.getElementById("ctl00_cphAdminMaster_txtName").value; newTR.appendChild (newTD); //tBody.appendChild(newTR); myTable.appendChild(newTR); }

                  S Offline
                  S Offline
                  sashidhar
                  wrote on last edited by
                  #8

                  Wow Amazing..! :doh: You have to tell your Requirements Exactly wat u r trying to Do ..! Why Would You want to use java script..! IF you want to add data You want to add it in Database not in the Grid view..! tRY TO UNDERSTAND THE framework first..! If your requirement is like tht..! REFER THE LINK BELOW http://www.codeguru.com/forum/showthread.php?t=446823[^]

                  LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

                  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