Re: client side add to a table

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ken Dopierala Jr. (kdopierala2_at_wi.rr.com)
Date: 10/01/04


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
> >>
> >>
> >
> >
>
>


Relevant Pages

  • Re: Transaction handling - Read Committed
    ... Yes this behavior is due to the Read Committed Isolation level requirements ... and has nothing really to do with SQL Server. ... As Mark pointed out you can ... >>> This query does not return with results till query 1 completes. ...
    (microsoft.public.sqlserver.programming)
  • Re: long running queries
    ... Mark is right -- you don't have much of an option with SQL Server 2000. ... >> that would result in a large data set and complex query, ... > Some of the client tools will warn you if the query looks like its going ...
    (microsoft.public.sqlserver.olap)
  • Re: How to retrieve stored procedure error code in C#?
    ... Mark and William - thx for the replies, as they pointed me in the right ... > All Sql Server stored procedures have a return value parameter, ... > Please do not send email directly to this alias. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Identity columns with ClientDataSets?
    ... "Mark A. Deal" wrote in message ... > How do you handle Identity columns with SQL Server and ClientDataSets? ... > I'm not having much luck because I get the error, "No corresponding Master ... > GhostFill Certified Consultant ...
    (borland.public.delphi.database.ado)
  • RE: SQLXML Newbie Question...
    ... create SQL Server logins, but how do you pass the credentials to the service? ... Mark ... I want to plae my web service on the public internet but it needs ...
    (microsoft.public.sqlserver.xml)