A
Andrew
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, clicks a button, and the
address tied to that ID (based on a SQL Server query) is placed in a
DataGrid. The user can then put in a new IDNumber, click the button again,
and the address tied to the second IDNumber is *added* to the DataGrid. The
user continues this process until they have entered all applicable
IDNumbers, and then clicks an "All Done" button where some other stuff will
happen. My hang-up is with this process loop I just described.
I have made a stored procedure on the SQL Server that will return to me the
address per the supplied IDNumber (a record that is four fields). In
debugging the application I am successful in creating a connection, command
object, and datareader, all to go get the applicable address based on the
IDNumber.
I can populate the DataGrid no problem that first time, but what about the
second time? The third? And so on? If I simply call the
DataGrid.DataBind() method each time after I run to get the address record,
I loose the data from the previous run. I don't care about sort order,
ordering, paging, or things of that nature, I just want to keep from loosing
any data on previous runs to the SQL Server.
So, the question is basically, how do I add a new row of data to a DataGrid
that may or may not contain rows from previous runs to the database, without
loosing any data already in those rows, and have this work over/across
multiple page reloads/postbacks?
Again, I am fairly new to the ASP.Net arena, so I ask for your patience with
your responses, but I am grateful for any and all responses sent. Thanks!!
-- Andrew
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, clicks a button, and the
address tied to that ID (based on a SQL Server query) is placed in a
DataGrid. The user can then put in a new IDNumber, click the button again,
and the address tied to the second IDNumber is *added* to the DataGrid. The
user continues this process until they have entered all applicable
IDNumbers, and then clicks an "All Done" button where some other stuff will
happen. My hang-up is with this process loop I just described.
I have made a stored procedure on the SQL Server that will return to me the
address per the supplied IDNumber (a record that is four fields). In
debugging the application I am successful in creating a connection, command
object, and datareader, all to go get the applicable address based on the
IDNumber.
I can populate the DataGrid no problem that first time, but what about the
second time? The third? And so on? If I simply call the
DataGrid.DataBind() method each time after I run to get the address record,
I loose the data from the previous run. I don't care about sort order,
ordering, paging, or things of that nature, I just want to keep from loosing
any data on previous runs to the SQL Server.
So, the question is basically, how do I add a new row of data to a DataGrid
that may or may not contain rows from previous runs to the database, without
loosing any data already in those rows, and have this work over/across
multiple page reloads/postbacks?
Again, I am fairly new to the ASP.Net arena, so I ask for your patience with
your responses, but I am grateful for any and all responses sent. Thanks!!
-- Andrew