I'm generating a list of radio buttons within my asp.net mvc Application and want to call an javascript method if the radio button is clicked.
This is the Razor Codeline:
@Html.RadioButton("selectedArticleMediaAsset", value, new { onClick = "loadData()"})
The generated HTML-Line looks like this:
<input name="selectedArticleMediaAsset" id="selectedArticleMediaAsset" onclick="loadData()" type="radio" value="../../Content/Images/Bilder_640x640/O20130_XC6_F_Rot_1.jpg|Detailbild 1"/>
In Firefox & Chrome everything is running fine, just the Internet Explorer is making problems because the onClick method is generated to onclick with lower case c. If I change this with the IE-Developer Tool it works.
Any ideas how to generate the correct onClick?
Thanks in advance,
Have you considered using jquery instead of html attributes?
@Html.RadioButton("selectedArticleMediaAsset", value)
<input name="selectedArticleMediaAsset" id="selectedArticleMediaAsset"
type="radio"
value="../../Content/Images/Bilder_640x640/O20130_XC6_F_Rot_1.jpg|D..."/>
$(function() {
$('#selectedArticleMediaAsset').click(function() {
loadData();
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.