473,666 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add rows to datatable after page post back

HI,

I have 4 text boxes and one button in my page. When ever I
fill the text boxes and click the button the data should be add to a
datagrid with out inserting a record in database. For this I used
datatable to insert the records but when ever I click the add button my
aspx page is submitting. When page submits new datatable instance is
creating and I lost old data. How can we keep old rows and ad new
datarow in data table. Sorry for my english. Please help me in this
regard
Thanks in advance

-- srinivas

Jan 17 '07 #1
1 2470
If you don't want to reload the table, you should make it persistent. You
can do it in a session variable. IsPostBack property tells you if you are in
a postback that you will know you need to restore the datatable from the
session variable rather that load it from the database.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"srinivas" <ni********@gma il.comwrote in message
news:11******** **************@ 38g2000cwa.goog legroups.com...
HI,

I have 4 text boxes and one button in my page. When ever I
fill the text boxes and click the button the data should be add to a
datagrid with out inserting a record in database. For this I used
datatable to insert the records but when ever I click the add button my
aspx page is submitting. When page submits new datatable instance is
creating and I lost old data. How can we keep old rows and ad new
datarow in data table. Sorry for my english. Please help me in this
regard
Thanks in advance

-- srinivas

Jan 17 '07 #2

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

Similar topics

3
2779
by: Tome73 | last post by:
How can I easily add the rows of DataTable1 to the rows of DataTable2. Both queries are from the same table. I can always use the column names with myRow, but I was wishing for a shortcut. When I try this it doesn’t work. for (int i = 0; i < dataTable1.Rows.Count; i++) { myRow = dataTable2.NewRow(); myRow = dataTable1.Rows; dataTable2.Rows.Add(myRow);
1
3278
by: Andrew | last post by:
Hey all, I am very new to ASP.Net (and .Net in general), but that isn't stopping the boss from wanting to begin new projects in it. This latest project has me kinda stumped and after a couple days of struggling, I figure asking you all (the experts) will keep me from going down some dark and dangerous road. The project I have is a fairly simple one, in theory anyway. The gist is to create a page where the user enters an IDNumber,...
7
3913
by: GaryB | last post by:
I have an untyped datatable that has financial numbers and controls that were populated by code (not a simple fill from a DA). Now I want to insert subtotals into it. I wrote a sub to do so that uses InsertAt(myrow,i). When I trace through the sub it is doing the insertat and the value of i is correct. But when I bind my dataset to a datagrid all of my inserted rows are at the end? code is below. What am I doing wrong? thanks, G
3
2885
by: Bijoy Naick | last post by:
I have something strange going on.. My .aspx page contains a file upload control, a "Import Data" button, a "newTransactions" <asp:table>, a"SaveTrans" button and an confMsg label. First the user selects a file, then clicks Import Data. The page now reads the PostedFile and displays each line as a new row in the newTransactions table. All of this works fine. For now, I've programmed SaveTrans_Click to display the number of rows in the...
0
1695
by: bryanp10 | last post by:
I have a DataList on my page which contains multiple DropDownLists. My page defaults to showing six rows in the DataList. I want the ability to dynamically add rows if needed. Right now I'm just using an empty table with X rows, and adding a new row to the table that the DataList is bound to. However, I can't figure out a way to do this and at the same time maintain the current viewstate of the existing controls. When I call...
31
1781
by: One Handed Man \( OHM - Terry Burns \) | last post by:
My Brain is dead !!!!! I modify a single row in a DataTable By setting the FirstName column in a specific row to another name. ( Without Accepting Changes ). However, this statement still returns the rows with the 'New Value in it' shouldnt it be the values before I made the change or have I missed something. r = Ds1.Tables(0).Select(Nothing, Nothing, DataViewRowState.OriginalRows)
12
1993
by: Graham Blandford | last post by:
Hi all, Would someone be able to tell me the most 'graceful' way of removing unwanted rows from a dataset based on a condition prior to update? OR, resetting the rows all to unchanged after they are initally added to the recordset. I create a dataset, which begins empty after the initial .Fill. Then I create several rows with some default information, leaving one
3
5399
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some example first:
1
2483
by: snowrupa | last post by:
Here is my code.while i am trying to run this code.Error is raising.Can any one help me in this? Column 'Trans Seq No' does not belong to table . protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { AddingItemstoGridView();
0
8454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8362
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8878
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...
0
8785
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8644
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5671
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4200
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...
1
2776
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
2
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.