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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fundementals of linking a DataList to a FormView

Status
Not open for further replies.

MustangPriMe

IS-IT--Management
Oct 9, 2002
74
GB
I'm new to ASP.NET, coming from classic ASP, so apologies for what will be a simple problem for anyone with more than a couple of weeks experience, but at least it should be simple to answer!

I'm working on 2 pages currently, one with a DataList to list selected fields from a table, and a second with a FormView to edit all fields from a selected record, or add a new record.

I'd first appreciate someone to confirm my approach, and second to help with a small problem.

The datalist is fine - one field is formatted as a hyperlink to the edit.aspx page, passing the record ID as a querystring.

The FormView has edit as the default mode, and the querystring id as the parameter used for the select and update statements. The OnUpdated event uses a Response.Redirect to pass back to the list.aspx page.

All works fine, but is this the best/easiest approach? I've seen examples with the DataList and the FormView on the same page, but I don't want the user confronted with both views when editing/inserting.

What I'm trying to get to grips with at the moment is how to use that page to insert and delete records as well? How can I use a querystring such as ?mode=insert to change the function of that page, and return to the list page on completion?

Thanks in advance!
Paul
 
this is the recommended approach.

My personal preference is to avoid any gui control with DataSource in it's name. they make it very difficult to debug and do not seperate the concerns of persentaiton and data logic. they also do not provide any room for application logic.

when you navigate to the formview page use the querystring value to set the mode. it's something like FormView.SetMode(mode);

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top