Insert Record from Textbox into GridView
-
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.
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. :)
-
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.
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.
-
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.
Oh, i thought his TextBox and Button are outside Grid. :-D
-
Oh, i thought his TextBox and Button are outside Grid. :-D
-
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.
Yes you are right. But let him break the suspence. ;P
-
Yes you are right. But let him break the suspence. ;P
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); }
-
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); }
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.