Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 03, 2012 06:38 AM by Young Yang - MSFT
Member
8 Points
27 Posts
Mar 27, 2012 08:59 AM|LINK
Hi,
I have the following Check box items in my view in Jquery,
<Label for="Happy">Happy</Label>
<input type="checkbox" />Yes < /br>
<input type="checkbox" />No
I want to GET and POST the selected checkbox item to the database. I am using LINQ to SQL
How do I go about it?
Thanxs in advance.
691 Points
177 Posts
Mar 27, 2012 09:17 AM|LINK
Check out: http://stackoverflow.com/questions/9846589/retrieving-dynamic-checkbox-values-and-label-from-strongly-typed-view-in-mvc3/9847016#9847016
Regards
All-Star
21742 Points
1825 Posts
Microsoft
Apr 03, 2012 06:38 AM|LINK
Hi
I think you'd have to like this:
var value = $('#test:checked').length ? $('#test').val() : $('input[name=test]').eq(1).val();
Or :
var value = $('input[name=test]').eq(!$('#test:checked').length).val();
Note: The "test" is the name of checkbox
Hope this helpful Regards Young Yang
breemstone
Member
8 Points
27 Posts
Jquery GET and POST selected check box Item to the database
Mar 27, 2012 08:59 AM|LINK
Hi,
I have the following Check box items in my view in Jquery,
<Label for="Happy">Happy</Label>
theeyeabove
Member
691 Points
177 Posts
Re: Jquery GET and POST selected check box Item to the database
Mar 27, 2012 09:17 AM|LINK
Check out: http://stackoverflow.com/questions/9846589/retrieving-dynamic-checkbox-values-and-label-from-strongly-typed-view-in-mvc3/9847016#9847016
Regards
Young Yang -...
All-Star
21742 Points
1825 Posts
Microsoft
Re: Jquery GET and POST selected check box Item to the database
Apr 03, 2012 06:38 AM|LINK
Hi
I think you'd have to like this:
var value = $('#test:checked').length ? $('#test').val() : $('input[name=test]').eq(1).val();Or :
var value = $('input[name=test]').eq(!$('#test:checked').length).val();Note: The "test" is the name of checkbox
Hope this helpful
Regards
Young Yang
Feedback to us
Develop and promote your apps in Windows Store