Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 19, 2011 06:41 AM by lovedota21
Member
411 Points
190 Posts
Jan 18, 2011 03:02 AM|LINK
Hey I have a Database
Customer(Id,Name),
Phone(Id,CustomerId,Number)
Contact(Id,CustomerId,Name,Address)
In My Form
Customer Name : <Textbox>
Phone : <TextBox> <button> : button to Add More <Textbox> Phone to add multiple Phone
Contact Name : <TextBox>
Address : <TextBox> <button> : button to Add More Form Contact add multiple Contact
I don't know how to solve this problem, someone give me some suggests.Thanks in advance !
All-Star
24675 Points
4250 Posts
Jan 18, 2011 03:20 AM|LINK
Hi,
Take a look here to see a sample of how to post back a list:
http://forums.asp.net/t/1640342.aspx
Jan 19, 2011 01:26 AM|LINK
I read the Haack's Topic Model binding a List but List<Item> is defined before,but what i want is when I click button add,add and add I create a ListItem to Post to Server. I don't know how to do this. Could you help me ? thanks !
Jan 19, 2011 04:40 AM|LINK
So you need to add line items from the client side, edit the values and then post to the server, am I correct?
Jan 19, 2011 05:52 AM|LINK
Yeah you're right. In this Mr.Haacked'topics i read it.
<% for (int i = 0; i < 3; i++) { %>
<%: Html.TextBoxFor(m => m[i].Title) %>
<%: Html.ValidationMessageFor(m => m[i].Title) %>
<%: Html.TextBoxFor(m => m[i].Author) %>
<%: Html.ValidationMessageFor(m => m[i].Author) %>
<%: Html.TextBoxFor(m => m[i].DatePublished) %>
<%: Html.ValidationMessageFor(m => m[i].DatePublished) %>
<% } %>
What i want to create this dynamic based on button add new Book,and give it [i] like this code.Sory for bothering you.i'm recently code in MVC.
Jan 19, 2011 06:21 AM|LINK
Have a look at this:
http://weblogs.asp.net/jacqueseloff/archive/2009/04/17/creating-dynamic-forms-with-mvc-and-jquery.aspx
Jan 19, 2011 06:41 AM|LINK
Thank you very much ! Have a Nice Day !
lovedota21
Member
411 Points
190 Posts
How to Post a List Model in MVC
Jan 18, 2011 03:02 AM|LINK
Hey I have a Database
Customer(Id,Name),
Phone(Id,CustomerId,Number)
Contact(Id,CustomerId,Name,Address)
In My Form
Customer Name : <Textbox>
Phone : <TextBox> <button> : button to Add More <Textbox> Phone to add multiple Phone
Contact Name : <TextBox>
Address : <TextBox> <button> : button to Add More Form Contact add multiple Contact
I don't know how to solve this problem, someone give me some suggests.Thanks in advance !
raduenuca
All-Star
24675 Points
4250 Posts
Re: How to Post a List Model in MVC
Jan 18, 2011 03:20 AM|LINK
Hi,
Take a look here to see a sample of how to post back a list:
http://forums.asp.net/t/1640342.aspx
Radu Enuca | Blog
lovedota21
Member
411 Points
190 Posts
Re: How to Post a List Model in MVC
Jan 19, 2011 01:26 AM|LINK
I read the Haack's Topic Model binding a List but List<Item> is defined before,but what i want is when I click button add,add and add I create a ListItem to Post to Server. I don't know how to do this. Could you help me ? thanks !
raduenuca
All-Star
24675 Points
4250 Posts
Re: How to Post a List Model in MVC
Jan 19, 2011 04:40 AM|LINK
So you need to add line items from the client side, edit the values and then post to the server, am I correct?
Radu Enuca | Blog
lovedota21
Member
411 Points
190 Posts
Re: How to Post a List Model in MVC
Jan 19, 2011 05:52 AM|LINK
Yeah you're right. In this Mr.Haacked'topics i read it.
<% for (int i = 0; i < 3; i++) { %>
<%: Html.TextBoxFor(m => m[i].Title) %>
<%: Html.ValidationMessageFor(m => m[i].Title) %>
<%: Html.TextBoxFor(m => m[i].Author) %>
<%: Html.ValidationMessageFor(m => m[i].Author) %>
<%: Html.TextBoxFor(m => m[i].DatePublished) %>
<%: Html.ValidationMessageFor(m => m[i].DatePublished) %>
<% } %>
What i want to create this dynamic based on button add new Book,and give it [i] like this code.Sory for bothering you.i'm recently code in MVC.
raduenuca
All-Star
24675 Points
4250 Posts
Re: How to Post a List Model in MVC
Jan 19, 2011 06:21 AM|LINK
Have a look at this:
http://weblogs.asp.net/jacqueseloff/archive/2009/04/17/creating-dynamic-forms-with-mvc-and-jquery.aspx
Radu Enuca | Blog
lovedota21
Member
411 Points
190 Posts
Re: How to Post a List Model in MVC
Jan 19, 2011 06:41 AM|LINK
Thank you very much ! Have a Nice Day !