Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP to .NET Question 1

Status
Not open for further replies.

codestorm

Programmer
Apr 11, 2001
504
AU
Here's a scenario I'm interested in opinions on:

Let's say in ASP I've got a page the maintains a table.
This page encapsulates all aspects of maintaining that table - listing it's contents, adding, modifying and deleting records for the table.
Now the way I typically handle this currently is:
1. Get Request and database items into local vars.
2. Get the page's current state (ins/upd/del/sel).
3. If necessary, complete an ins/upd/del (and go to 4a).
4. If necessary, build pre ins/upd/del html, OR
4a. List the contents of the table.

Now in the example above, the page can have different appearances depending on if it's an initiated or completed ins/upd/del, or simply listing contents.

What would be the best way to design this in .NET?
I want to keep it all in one page (and perhaps a code-behind page).
What's the best way of one page showing differently (different forms, etc)?
codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
<insert witticism here>
 
The dataset combined with a datagrid control is perfectly suited to this type of application. All columns and styles of the datagrid can be set programmatically based on conditions that you can specify in the code-behind. I wouldn't even attempt to try to go into specifics at this high level of inquiry, though. Although setting up a datagrid is very simple, advanced functionality can get very complicated, and would be covered much more thoroughly on a site like:


or the like.


has some good stuff on it, as well as many others out there. I'd search google on 'datagrid examples' and just start walking through.

You can even set up a datagrid to encapsulate all these functions into one single view. It can display the data along with extra button columns (edit, delete, info, etc...), and the edit button can be made to change the appearance of that particular row into editable text boxes, dropdowns, etc... to facilitate updating a row of data right there while you're still looking at all of the records. Very very very nice. The dataset has updating capabilities built right in, as well so that you can take your changes right back to the datastore lickety split.

Additionally, the dataset is a disconnected object, and could nearly accurately be described as an in-memory relational database with contraints, multiple tables, etc... It even has a .writeXML() method that can plop out the entire dataset into a well-formed XML file, which can then be either ported, stored, or used to later populate the same datagrid. I am nowhere near having my head around all of its functionality.

Just as an aside, I can tell you that google is just about the best example finder of .net stuff I have come across. Pick keywords carefully, and you can come up with just about anything. I find it much more helpful than the MS site (go figure), since you get such a wider berth of examples.

good luck! :)
paul
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top