TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chandrasekaran C
NA
159
6.1k
How to I get values of n numbers of table row input in asp?
Aug 31 2019 2:11 AM
Hi
I done the input field as custom if cusomer need we create n numbers, But How I get this N number value to store db
//Asp.Net
//Web Page
<table id="epcgCon">
<tr>
<th>S.No</th>
<th>Description of Items</th>
<th>Quantity</th>
<th></th>
</tr>
<tr>
<td>//S.NO
</td>
<td>
//Description Item String value
</td>
<td>
//Qty in integer
</td>
<td>// Remove button
</td>
</tr>
</table>
<div>
<input type="button" onclick="AddRow('epcgCon')" value="ADD ROW" />
</div>
<div>
<input type="button" onclick="Submit()" value="Submit" />
</div>
//JavaScript Coding...
var count = "1";
function AddRow(in_tbl_name) {
var tbody = document.getElementById(in_tbl_name).getElementsByTagName("TBODY")[0];
// create row
var row = document.createElement("TR");
// create table cell 2
var td1 = document.createElement("TD")
var strHtml2 = ""+count;
td1.innerHTML = strHtml2.replace(/!count!/g, count);
// create table cell 3
var td2 = document.createElement("TD")
var strHtml3 = "<input type=\"text\" name=\"Descr\" />";
td2.innerHTML = strHtml3.replace(/!count!/g, count);
// create table cell 4
var td3 = document.createElement("TD")
var strHtml4 = "<input type=\"text\" name=\"Qty\" />";
td3.innerHTML = strHtml4.replace(/!count!/g, count);
// create table cell 5
var td4 = document.createElement("TD")
var strHtml5 = "<input type=\"button\" value=\"Remove\" onClick=\"delRow()\"/>";
td4.innerHTML = strHtml5.replace(/!count!/g, count);
// append data to row
row.appendChild(td1);
row.appendChild(td2);
row.appendChild(td3);
row.appendChild(td4);
count = parseInt(count) + 1;
// add to count variable
// append row to table
tbody.appendChild(row);
}
function delRow() {
var current = window.event.srcElement;
//here we will delete the line
while ((current = current.parentElement) && current.tagName != "TR");
current.parentElement.removeChild(current);
}//Delete Row END
Submit()
{
var desc=document.getElementByName('Descr');
var qty=document.getElementByName('Qty');
// I need help on this How to I get value from if n numbers and insert into DB
}
Reply
Answers (
3
)
How to convert User class object to json file when success l
SQL Query vs Asp.net gridview