Re: client side add to a table
From: Ken Dopierala Jr. (kdopierala2_at_wi.rr.com)
Date: 10/01/04
- Next message: Hans Kesting: "Re: number of online users?"
- Previous message: Michael Tkachev: "Re: Local Maibox .. Urgent.."
- In reply to: John Smith: "Re: client side add to a table"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 1 Oct 2004 07:43:53 -0500
Hi Mark,
If you are putting input controls (i.e. <input type='text' ....>) in your
table, then create a global variable in the <head> section of your page. I
use Counter. Every time I add a row I use the same ID for the controls but
append an incremented Counter (txtName1, txtName2). Then when you submit
your form assign Counter to a hidden input field that you have set to
runat="server":
<input id="hidNumberOfLines" type="hidden" name="hidNumberOfLines"
runat="server">
In your server side code check the value of this hidden control. If it is
greater than 0 then loop and get all your values:
intNumberOfLineItems = CInt(hidNumberOfLines.Value)
For intCounter = 1 To intNumberOfLineItems
strFirstName = CStr(Request("txtFirstName" + CStr(intCounter)))
strLastName = CStr(Request("txtLastName" + CStr(intCounter)))
strAge = CInt(Request("txtAge" + CStr(intCounter)))
.
.
.
'Write to SQL Server.
.
.
.
Next
Good luck! Ken.
-- Ken Dopierala Jr. For great ASP.Net web hosting try: http://www.webhost4life.com/default.asp?refid=Spinlight If you sign up under me and need help, email me. "John Smith" <johnsmith@microsoft.com> wrote in message news:eVXa9h2pEHA.536@TK2MSFTNGP09.phx.gbl... > How do you get the table data back into an sql server? > > thank you > mark > > "Ken Dopierala Jr." <kdopierala2@wi.rr.com> wrote in message > news:OpTTYyupEHA.3300@TK2MSFTNGP12.phx.gbl... > > Hi Mark, > > > > This is how I do it, it is a little complicated but once you get used it > > you'll have no problems: > > > > var tblMyTable = document.getElementById('tblNames'); > > var Rows = tblMyTable.getElementsByTagName('tr'); > > var NewRow; > > var NewCell; > > > > NewRow = tblMyTable.insertRow(Rows.length); > > NewCell = NewRow.insertCell(0); > > NewCell.innerHTML = "John"; > > NewCell = NewRow.insertCell(1); > > NewCell.innerHTML = "Smith"; > > > > Now you have a table with 1 row and 2 columns. I recommend putting: > > debugger; after the NewCell = NewRow.insertCell(0) line. Then looking at > > NewCell in the watch pane. There you will see the huge number of > > properties > > (i.e. NewCell.bgColor, NewCell.width, and etc.) that you can manipulate. > > You can do the same for NewRow and tblMyTable and you'll get a feel for > > everything you can do. Good luck! Ken. > > > > -- > > Ken Dopierala Jr. > > For great ASP.Net web hosting try: > > http://www.webhost4life.com/default.asp?refid=Spinlight > > > > "John Smith" <johnsmith@microsoft.com> wrote in message > > news:u7fYWprpEHA.3724@TK2MSFTNGP10.phx.gbl... > >> ASP.NET SQL C# > >> I would like to get data from sql server and display it in a web page > > table > >> and be able to edit add delete rows without having to do server pulls. > >> When the user is finished the user pushes commit button and the data is > >> transferred back to the sql server. > >> I would appreciate being pointed at an example of how to do this. > >> thank you > >> mark > >> > >> > > > > > >
- Next message: Hans Kesting: "Re: number of online users?"
- Previous message: Michael Tkachev: "Re: Local Maibox .. Urgent.."
- In reply to: John Smith: "Re: client side add to a table"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|