473,763 Members | 6,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1294
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.co m> wrote in message
news:uZ******** *****@TK2MSFTNG P11.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

..............e tc............. ..

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_velo citywest.com> wrote in message
news:uS******** ******@TK2MSFTN GP12.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.co m> wrote in message
news:uZ******** *****@TK2MSFTNG P11.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

..............e tc............. ..

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.co m> wrote in message
news:eS******** ******@TK2MSFTN GP10.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_velo citywest.com> wrote in message
news:uS******** ******@TK2MSFTN GP12.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.co m> wrote in message
news:uZ******** *****@TK2MSFTNG P11.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
>
> ..............e tc............. ..
>
> 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.co m> wrote in message
news:eS******** ******@TK2MSFTN GP10.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
johnwsaundersii i at hotmail
Nov 18 '05 #5

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

Similar topics

9
3751
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? Here is an example of just such a usage: <dl class="faq"> <di>
1
1829
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 specifically 'other names sometimes used to identify the main contact person'. I have related the tables, the main contact info table being the main table on the one side, and the other two tables hold additonal data and are on the many side.
9
2003
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 guidance from someone experienced in those areas. The problem, in the abstract, is how to select a set of records in one table, each one of which has a relation to every one of a set of records in another table, the tables being joined in a...
1
2327
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 disapeared. The read is done on a button click. I can read the selected items from the other controls in the repeater, demo page here
2
6550
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 *that is going to be deleted* into another table, before the original data is deleted. I am trying to use the RowDeleting method to call an Update or Insert
2
3210
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 : INSERT INTO temp_tab VALUES (1,2,3)
29
3576
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 one data field - but i'm not sure) :-) Background info:
39
1855
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 confirm whether or not they already own a particular item. If they do, then it's not added to the user table, whereas if it is, then it _is_ added to the user table. However, if the item is not in the database, the user is advised of this. So...
2
1604
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 with this situation. I want to put a select query(Query1) that uses one table and the criteria would be . When an event number is entered it will give me the Event Number, Event Name, Event Date, Event time, and House Size. Next, I need to...
2
1671
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 "controls" and there descriptions. Each has its own primary key. Many of each can relate to many in table 2. Table 4 is a Merge Table, listing each primary key from table 2 and its relation (primary key) from table 3.
0
10144
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9937
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7366
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.