displaying multiple forms in asp.net
I have a page where i enter the number of members i need to add now suppose i chose 3 so on next page i have get a display like member1 enter details(name, address, phone etc) just below that again member2 enter details(name, address, 开发者_开发知识库phone etc) and member3 enter details(name, address, phone etc)in short the no of forms displayed in a page depends on the no of member an user want to add and on submitting the data's of 3(no. provided by the user)member has to be inserted. As i am a rookie to asp.net its hard for me to imagine the logic and implementing them, what to do about tose textfied id's? how to generate the id's and how to separate the codes in .cs and .aspx etc
There are problems with using multiple server side forms with asp.net (if you are not using ASP.net MVC. I think this limitation was overcome in ASP.net MVC). Like Abe said, your best bet is to go with ListView or a GridView. Also, you don't need to have them in 2 separate pages. In fact you can give the user to dynamically Add/update/Delete records in gridview.
I Googled it and Here is an example
I'm not sure how much information you are entering per employee but you may consider using a ListView. This is usually what I will do if i'm not entering a ton of information about something. ListViews also allow you to use a lot of auto Create Update Retrieve Delete (CRUD) functionality when used in conjunction with a LinqDataSource or SqlDataSource.
Take a look at these two links and see if it fits what you are trying to do:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.aspx
http://www.codeproject.com/KB/webforms/CompleteListView.aspx
I'm not an ASP user, but the logic is the same for all languages:
Input fields can look like this:
Member 1
<input type="text" name="1;name" value="John Doe" />
<input type="text" name="1;address" value="John Street" />
Member 2
<input type="text" name="2;name" value="Jane Doe" />
<input type="text" name="2;address" value="Jane Street" />
Now when you submit your form you will know to which member the name, address, etc belongs.
精彩评论