Webgrid with radiobutton
How to get Particular Cell Value into Controller from Selected Radio Button in webgrid.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Posted Mar 24, 2014, 3:21 AM EDT
kindly explain briefly about you column structure and what you exactly want
Sasi ReddyRank #4,458 · 342 reputationPosted Mar 24, 2014, 4:10 AM EDT
headerStyle: "header",
alternatingRowStyle: "alt",
selectedRowStyle: "selectedrow",
columns: grid.Columns(
grid.Column(header: "Select", format: @
grid.Column("Name","Name"),
grid.Column("Age","Age"),
grid.Column("MobileNo","MobileNo"),
grid.Column("EmailId","EmailId"),
grid.Column("Weight","Weight"),
grid.Column("Height","Height"),
grid.Column("Delete",format: @
))
This is my webgrid, i have to pass radiobutton value into controller what ever i have selected in gridcolumn
Please tell me its very urgent
Anubhav ChaudharyRank #29 · 42K reputationPosted Mar 25, 2014, 12:23 AM EDT
Try these Links:
http://stackoverflow.com/questions/11132039/webgrid-mvc-3-with-radiobutton-get-selected
http://www.c-sharpcorner.com/UploadFile/2b481f/bind-the-radio-button-with-the-webgrid-in-web-api/
http://www.authorcode.com/radio-buttons-in-webgrid-mvc/
Sasi ReddyRank #4,458 · 342 reputationPosted Mar 26, 2014, 3:42 AM EDT
I found solution like this
This is my webgrid in View
@{
var grid = new WebGrid(Model, canPage: true, rowsPerPage:3,
selectionFieldName: "selectedRow",ajaxUpdateContainerId: "gridContent");
grid.Pager(WebGridPagerModes.NextPrevious);}
@grid.GetHtml(tableStyle: "webGrid",
headerStyle: "header",
alternatingRowStyle: "alt",
selectedRowStyle: "selectedrow",
columns: grid.Columns(
grid.Column(header: "Select", format: @ <input name="chck"
TYPE="RADIO" id="chck" value="@item.Id" />),
grid.Column("Name","Name"),
))
<input type="submit" value="Submit" id="save" name="save" onclick="SaveDoctor()"/>
<script type="text/javascript">
function SaveDoctor(response) {
value = $("input[type='radio']:checked").val();
alert(value);
var url = '/MPatientRegistration/User/' + value;
$.ajax({
type: "GET",
url: url,
data: {},
dataType: "html"
});
}
script>