Help learning asp.net
I am currently building an asp.net application. Its supposed to be pretty simple. The problem is, I've only experience with asp.net mvc and for this app I'm limited to .net 2.0 so no mvc.
The only requirement is this.
I have a table of about 2000 records with these columns: Id, Code1(unique), Code2(unique), Name, LastName, Email.
The table is alrea开发者_如何转开发dy populated with Id, Code1, Code2.
Now, the idea is that when someone looks up their record (through Code1 or Code2) they are able to fill the rest of the fields (Name, LastName, Email).
So, search -> if no email, name, lastname set =>edit=>display
What do I need? please help. I have tried Details View but Im not sure how to allow edit only if the email field is blank. Do I need something else?
I think the easiest way to go is the following:
2 textboxes, 1 button (Search), 1 GridView, 1 SqlDataSource.
- Gridview should be hooked up to SqlDataSource, which in turn should take 2 parameters (textbox values)
- use textboxes for searching, on Search click, GridView.DataBind()
- Make sure your SqlDataSource has the Update command specified
Check out ASP.NET Data tutorials for more info, got to Step 3 in this tutorial for GridView Updating help.
You'd be able to edit 1 record at a time, I wish I could give you more details on setting up the Gridview for automatic Updates, but it's been a while since I've worked with it (Google should help you with this though).
精彩评论