473,378 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Collectiong Data on Server side while adding rows on client side

Hi

I have html table and a Button in an Aspx page. I am adding one row with
some textboxes to Html table each time i click on the Button thru Javascript.

Now problem is when when i try to collect the data in the Textboxes which i
added dynamically from server side, i am not able to do . Alos i tried to
bedug, the total no of rows in Html table does not reflect the dynamically
added rows.

What i mean is, For Ex, If have one row in html tble, and i clciked the
Button twice. It adds 2 rows. Now the total no of rows are 3. But when i
dbug, it stiill shows Table.rows.count is 1.

Any help is appreciated.

Here is my code
Javascript to add rows dynamically
//Adding New Row IncMat
//
function addNewRowInCorrespondingTab1(){

try
{
addRowInIncMaterial();
}
catch(e)
{
alert("Problem in adding new row...");
window.status = "Problem in adding new row...";
return false;
}
return false;
}
//
function addRowInIncMaterial(){

var theTable;
var lastRow;
var row;
var cell;
var el;
var NoOfCol;
//
theTable = document.getElementById('IncomingMateTbl');
lastRow = theTable.rows.length - 1;
row = theTable.insertRow(2);
//
var DDLText = 'Select,Stage,Eng';
//
NoOfCol = parseInt(4);
for(i = 1; i <= (NoOfCol); i++)
{
if (i == 1)
{
aryDDLText = DDLText.split(",");
cell = row.insertCell(i - 1);
cell.setAttribute('align','center');
el = document.createElement('select');
el.setAttribute('Font-Size', '9pt');

el.setAttribute('name', 'IncMat' + (lastRow) + i);
el.setAttribute('id', 'IncMat' + (lastRow) + i);
//
for(id = 0; id < aryDDLText.length; id++)
{
if (id==0)
{
oNewOption = new Option();
oNewOption.text = aryDDLText[id];
oNewOption.value = '0';
}
else
{
oNewOption = new Option();
oNewOption.text = aryDDLText[id];
oNewOption.value = aryDDLText[id];
}
el.add(oNewOption,id);
cell.appendChild(el);
}
}
else
{
cell = row.insertCell(i - 1);
cell.setAttribute('align','center');
el = document.createElement('input');
el.setAttribute('type', 'text');
//
el.setAttribute('name', 'IncMat' + (lastRow) + i);
el.setAttribute('id', 'IncMat' + (lastRow) + i);
//
el.setAttribute('value', '');
el.setAttribute('size', '11');
el.setAttribute('Fontsize', '9pt');
cell.appendChild(el);
}
}
//
}
//

Server Side Code

Dim IncMatIdx As Integer
Dim ctr As Integer
Dim Ptr As New HtmlTableRow()
Dim inputTxt As New HtmlInputText()
Dim InputDDL As New DropDownList()

IncMatIdx = IncomingMateTbl.Rows.Count
For ctr = 1 To ctr <= IncMatIdx
Ptr = IncomingMateTbl.Rows(ctr)
'
InputDDL = CType(Ptr.Controls.Item(0).Controls.Item(0),
DropDownList)
DetailDataObj2.SetIncomingMat("IncMaterial",
InputDDL.SelectedItem.Value)
'
inputTxt = CType(Ptr.Controls.Item(1).Controls.Item(0),
HtmlInputText)
DetailDataObj2.SetIncomingMat("Batch", inputTxt.Value)

inputTxt = CType(Ptr.Controls.Item(2).Controls.Item(0),
HtmlInputText)
DetailDataObj2.SetIncomingMat("PCN", inputTxt.Value)

inputTxt = CType(Ptr.Controls.Item(3).Controls.Item(0),
HtmlInputText)
DetailDataObj2.SetIncomingMat("Qty", inputTxt.Value)
'
InfoObj.AddSMODetail(DetailDataObj2)
Next


Thx in advance
Sileesha
Nov 18 '05 #1
0 1855

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Fawke101 | last post by:
Hi there, I have an application that rips data from an SQL server and displays it in columnar form on an ASP page, using a Do until RS.EOF loop. I wish to add 2 arrows to each column (up and...
11
by: Colin Steadman | last post by:
Hope this makes sense! I'm building an ASP page which allows uses to add items to an invoice via a form, ie: Item No Part No Order No Quanity Units Price VAT ------- ...
5
by: milkyway | last post by:
Hello everyone, I have a few values and variables that I want to post to a server (without using a SUBMIT button). Is there a way to post data from within javascript - do sockets or connections...
4
by: John Smith | last post by:
..Net 2003 C# I get xml from a sql database pull. I put the data into a XMLDomDocument and then the user changes it. I now need to update the database correctly. I need to be able to get the data...
2
by: Dnna | last post by:
I have a table which is bound to an Internet Explorer XML data island. I'm using ASP.NET's client-side validators for an input field in the table. The problem is that if the input fields are in...
9
by: David Harris | last post by:
Ok, so I'm semi-new to .NET, having done everything manually with SQL code back in VB6. So before I program this up completely manually again, I thought I'd ask for better ways to think through...
30
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and...
5
by: Donald Adams | last post by:
Hi, I will have both web and win clients and would like to page my data. I could not find out how the datagrid control does it's paging though I did find some sample code that says they do it...
5
AnuSumesh
by: AnuSumesh | last post by:
Hi All, I am using <asp:Gridview> to display my data. I am adding columns and rows dynamically. I am facing following issues: 1. I want scrollbars around the gridview and for this purpose i...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.