jQuery + ASP.net MVC

jQuery + ASP.net MVC

Here is the problem. lets say I have a product category table and a product table. by using foreach statement getting categories making them a html table and putting products inside the table as a radio group. so 3 product categories makes three different html table and inside the tablo i m listing the product as radio buttons.

when user selects an product i'm using jquery post statement and send some data. I'm using below jquery to understand which radio button selected.

$(document).ready(function () {     $("input[name='AD']:radio").change(function () {         var data = $("input[name='AD']:checked").val();         $.post("/Configure/UpdateAd/", { id: $(this).val() }, function (data) {             update($("#bottomRightA"), data);         });     }); }); 

And it works! but

here I have a problem.


I m using this way to differentiate radio groups based on category.

input type="radio" name="<%: model.CategoryName%> value="<%:model.CategoryId%>" 

if I make all radio buttons name 'up', they become the same group as expected. and I cant tell the jquery which radio group is selected. Is there a way to use jquery with some kind of mvc nuggets?. Like below

input[name='" + <%: model.CategoryName + "'] 

or anything I can do with jQuery?

asp.net mvc int property bind exception


How do I pass a list of integers to an MVC action?
If I understand you right, you want to hook up all radio although tons, although treat the categories separately.. MVC.net form post/anti forgery You must pick up the name of the changed radio although ton and use this in the code:. MVC - Changing or adding a class for either 'Html.ValidationMessage' or 'Html.TextBox'
$(function () {   $("input:radio").change(function () {     var name = $(this).attr("name");     var data = $("input[name='"+name+"']:checked").val();     $.post("/Configure/Update"+name+"/", { id: data }, function (data) {       update($("#bottomRightA"), data);     });   }); }); 
Should my ViewModel's constructor populate the ViewModel's data?

64 out of 100 based on 24 user ratings 144 reviews