473,398 Members | 2,525 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,398 software developers and data experts.

question about table list in asp.net

Dear All,

in my asp.net, i have

- a textbox to input a text
- a "add row" button, after it has been clicked the text in the textbox will
add to the table
- a submit button, the user can add a lot of the rows until submit button is
pressed. during that, the data added in the table will be insert into the
database

here is the screenshot to show the notion

1) an empty table
http://destiny.xfiles.to/ubbthreads/files/615866-1.jpg

2) enter "Row 1" in the textbox and press add row, "Row 1" will be added
into the table
http://destiny.xfiles.to/ubbthreads/files/615867-2.jpg

3) enter "Row 2" in the textbox and press add row, "Row 2" will be added
into the table
http://destiny.xfiles.to/ubbthreads/files/615868-3.jpg

...............etc...............

the data will store into the database after "submit" button has been
pressed.
Here is my background:

I am using the DataTable to store the DataRow and the reord each time add
"row button" has been pressed.
after that, the result datagrid will be updated by the DataTable by binding
the datasource again.

My problem is:

as each time we press the "row button" the form will be repost again. so,
whenever i add the "add row" button,
the previous record added will be empty.

What can i do?

Thank you.
Regards,
scli
Nov 18 '05 #1
4 1277
How are you currently handling the DataTable object during a postback? Are
you storing/retrieving the DataTable object via Page.Session?

Todd Casey
"angus" <an***@angus.com> wrote in message
news:uZ*************@TK2MSFTNGP11.phx.gbl...
Dear All,

in my asp.net, i have

- a textbox to input a text
- a "add row" button, after it has been clicked the text in the textbox
will
add to the table
- a submit button, the user can add a lot of the rows until submit button
is
pressed. during that, the data added in the table will be insert into the
database

here is the screenshot to show the notion

1) an empty table
http://destiny.xfiles.to/ubbthreads/files/615866-1.jpg

2) enter "Row 1" in the textbox and press add row, "Row 1" will be added
into the table
http://destiny.xfiles.to/ubbthreads/files/615867-2.jpg

3) enter "Row 2" in the textbox and press add row, "Row 2" will be added
into the table
http://destiny.xfiles.to/ubbthreads/files/615868-3.jpg

..............etc...............

the data will store into the database after "submit" button has been
pressed.
Here is my background:

I am using the DataTable to store the DataRow and the reord each time add
"row button" has been pressed.
after that, the result datagrid will be updated by the DataTable by
binding
the datasource again.

My problem is:

as each time we press the "row button" the form will be repost again. so,
whenever i add the "add row" button,
the previous record added will be empty.

What can i do?

Thank you.
Regards,
scli

Nov 18 '05 #2
No, i haven't.
Are you storing/retrieving the DataTable object via Page.Session?
is it in the "Add Row" button listener, write something like

--------------------------------------------------------
Dim dt As New DataTable = Session("dt")

' add rows in datatable

Session("dt") = dt
--------------------------------------------------------

is it a command way to handle this stuffs?
"Todd Casey" <todd@_SPAMMER_GET_A_LIFE_velocitywest.com> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl... How are you currently handling the DataTable object during a postback? Are
you storing/retrieving the DataTable object via Page.Session?

Todd Casey
"angus" <an***@angus.com> wrote in message
news:uZ*************@TK2MSFTNGP11.phx.gbl...
Dear All,

in my asp.net, i have

- a textbox to input a text
- a "add row" button, after it has been clicked the text in the textbox
will
add to the table
- a submit button, the user can add a lot of the rows until submit button is
pressed. during that, the data added in the table will be insert into the database

here is the screenshot to show the notion

1) an empty table
http://destiny.xfiles.to/ubbthreads/files/615866-1.jpg

2) enter "Row 1" in the textbox and press add row, "Row 1" will be added
into the table
http://destiny.xfiles.to/ubbthreads/files/615867-2.jpg

3) enter "Row 2" in the textbox and press add row, "Row 2" will be added
into the table
http://destiny.xfiles.to/ubbthreads/files/615868-3.jpg

..............etc...............

the data will store into the database after "submit" button has been
pressed.
Here is my background:

I am using the DataTable to store the DataRow and the reord each time add "row button" has been pressed.
after that, the result datagrid will be updated by the DataTable by
binding
the datasource again.

My problem is:

as each time we press the "row button" the form will be repost again. so, whenever i add the "add row" button,
the previous record added will be empty.

What can i do?

Thank you.
Regards,
scli


Nov 18 '05 #3
You will need to store the DataTable object so that it is not reset during a
postback. You can use the Page_Load event handler with the combination of
IsPostBack to initialize the DataTable object. Once the DataTable is
initialized you should save that object to the Session. Then on any further
Page_Load events where IsPostBack == true then you can load the DataTable
from the Session.

Does that make sense?

http://msdn.microsoft.com/library/de...ssionState.asp

Todd Casey

"angus" <an***@angus.com> wrote in message
news:eS**************@TK2MSFTNGP10.phx.gbl...
No, i haven't.
Are you storing/retrieving the DataTable object via Page.Session?


is it in the "Add Row" button listener, write something like

--------------------------------------------------------
Dim dt As New DataTable = Session("dt")

' add rows in datatable

Session("dt") = dt
--------------------------------------------------------

is it a command way to handle this stuffs?
"Todd Casey" <todd@_SPAMMER_GET_A_LIFE_velocitywest.com> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...
How are you currently handling the DataTable object during a postback?
Are
you storing/retrieving the DataTable object via Page.Session?

Todd Casey
"angus" <an***@angus.com> wrote in message
news:uZ*************@TK2MSFTNGP11.phx.gbl...
> Dear All,
>
> in my asp.net, i have
>
> - a textbox to input a text
> - a "add row" button, after it has been clicked the text in the textbox
> will
> add to the table
> - a submit button, the user can add a lot of the rows until submit button > is
> pressed. during that, the data added in the table will be insert into the > database
>
> here is the screenshot to show the notion
>
> 1) an empty table
> http://destiny.xfiles.to/ubbthreads/files/615866-1.jpg
>
> 2) enter "Row 1" in the textbox and press add row, "Row 1" will be
> added
> into the table
> http://destiny.xfiles.to/ubbthreads/files/615867-2.jpg
>
> 3) enter "Row 2" in the textbox and press add row, "Row 2" will be
> added
> into the table
> http://destiny.xfiles.to/ubbthreads/files/615868-3.jpg
>
> ..............etc...............
>
> the data will store into the database after "submit" button has been
> pressed.
>
>
> Here is my background:
>
> I am using the DataTable to store the DataRow and the reord each time add > "row button" has been pressed.
> after that, the result datagrid will be updated by the DataTable by
> binding
> the datasource again.
>
> My problem is:
>
> as each time we press the "row button" the form will be repost again. so, > whenever i add the "add row" button,
> the previous record added will be empty.
>
> What can i do?
>
> Thank you.
>
>
> Regards,
> scli
>
>



Nov 18 '05 #4
"angus" <an***@angus.com> wrote in message
news:eS**************@TK2MSFTNGP10.phx.gbl...
No, i haven't.
Are you storing/retrieving the DataTable object via Page.Session?


is it in the "Add Row" button listener, write something like

--------------------------------------------------------
Dim dt As New DataTable = Session("dt")


Do not use "New DataTable", just "DataTable". I don't know whether this will
solve your problem, but you'll at least not be creating a new DataTable
object and then immediately replacing it with whatever is in Session("dt").
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #5

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

Similar topics

9
by: Dave H | last post by:
Hello, I have a query regarding definition lists. Is it good practice semantically to use the dt and dd elements to mark up questions and answers in a frequently asked questions list, or FAQ? ...
1
by: Johnfcf | last post by:
I have a database consisting of 3 tables, the main table with main contact info, a second table with additional address info and a third table consisting of additional contact information, or more...
9
by: Riley DeWiley | last post by:
I have a programming problem in OLEDB and C++ that seems to be pointing me toward using layered views and hierarchical rowsets. However, I am uncertain of the precise implementation and need...
1
by: Fraggle | last post by:
I have a repeater with controls added at run time. the <template> also contains a <asp:textbox that is made visible on some repeater elements. when I come to read the text info out it has...
2
by: Robert Smith jr. | last post by:
Hello, Please pardon my newbie question ... I am building an ASP.NET page that displays a recordset with a Delete statement enabled (this all works fine). I want to Insert the current row...
2
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request :...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
39
by: Daz | last post by:
Hello all, my question is more regarding advice on a script design. I have about 3600 entries in my database, the user submits a list, which is then checked against those in the database to...
2
by: Dorish3 | last post by:
I want to apologize ahead of time for being a novice with MS Access and VBA. I desperately need help with 2 queries that I am trying to put together. I want to thank anyone that can help me out...
2
by: smadden | last post by:
I have a simple Access database with 4 tables so far. Here is my question: Talble 2 lists "vulns" and there descriptions. Each has its own primary key and relates to table 1. Table 3 lists...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.