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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sasi ReddyPosted Mar 26, 2014, 7:42 AM
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>
Anubhav ChaudharyPosted Mar 25, 2014, 4:23 AM
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 ReddyPosted Mar 24, 2014, 8:10 AM
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
Posted Mar 24, 2014, 7:21 AM
kindly explain briefly about you column structure and what you exactly want