You have to do some sort of request back to the server, whether it's a POST from a form button or an Ajax POST or GET request.
Form button:
Or, Ajax (with jquery):
jQuery('input[name=SelectedObject]').click(function() {
jQuery.ajax({
url: '/MyApp/HandleClick/',
data: {
SelectedObject: this.value,
}
success: function() {
// Process success data...
}
});
});
Then your controller:
public class MyAppController : Controller
{
[HttpPost]
public ActionResult HandleClick(string value)
{
// Handle persisting value to database...
// If posting
return RedirectToAction("OtherAction");
// If Ajax
return Json("Success!");
}
}
That's the simplest example - can't answer more without more details about exactly what you're trying to accomplish.