In my scenario, I want to change the value of a table by using radio button selection.
Code for radio button
@Html.RadioButtonFor(m => m.Doctype1, new {
id = "doctype1", @onclick = "DocTypeSelect()"
}) @Html.Label("largedocs")
@Html.RadioButtonFor(m => m.Doctype2, new {
id = "doctype2", @onclick = "DocTypeSelect()"
}) @Html.Label("SmallDocs")
@Html.RadioButtonFor(m => m.Doctype3, new {
id = "doctype3", @onclick = "DocTypeSelect()"
}) @Html.Label("MediumDocs")
@Html.RadioButtonFor(m => m.Doctype4, new {
id = "doctype4", @onclick = "DocTypeSelect()"
}) @Html.Label("VerySmallDocs")
I wrote a logic for hide other dropdown values. By using I'm able to change the dropdown and hiding other 3 buttons.
<td id="DocTypes1">
@Html.DropDownlistfor(m => m.Doctype, new selectlist(m.BigDocs, "Value", "Text", m.BigDocs), new {
@id = "SelectDocType",
@onchange = "ChangeTypes()"
})
<td id="DocTypes2">
@Html.DropDownlistfor(m => m.Doctype, new selectlist(m.BigDocs, "Value", "Text", m.BigDocs), new {
@id = "SelectDocType",
@onchange = "ChangeTypes()"
})
<td id="DocTypes3">
@Html.DropDownlistfor(m => m.Doctype, new selectlist(m.BigDocs, "Value", "Text", m.BigDocs), new {
@id = "SelectDocType",
@onchange = "ChangeTypes()"
})
<td id="DocTypes4">
@Html.DropDownlistfor(m => m.Doctype, new selectlist(m.BigDocs, "Value", "Text", m.BigDocs), new {
@id = "SelectDocType",
@onchange = "ChangeTypes()"
})
In Javascript, If a particular value is selected I want to get that value and and display in a table view of format.
The existing code is always getting the one type of doc value only. I don't know why???
funtion ChangeTypes(){
var docId=$("SelectDocType").val();
var docType=$("SelectDocType option:selected").text();
if(SelectDocType !="")
{
//my logic
}
actually I need to get the data when a user change the dropdown values. Help me to solve this..
Thanks in advance