web stats analysis

Archive for November, 2013

Disabling the right click on images in asp.net.

How to disable right click on images in asp.net?

Add below script between head tag


<script language="JavaScript" type="text/javascript">

var msg = "Right click disable.";
function click(e) {
if (document.all) {
if (event.button == 2 || event.button == 3) {
alert(msg);
return false;
}
}
else {
if (e.button == 2 || e.button == 3) {
e.preventDefault();
e.stopPropagation();
alert(msg);
return false;
}
}
}
if (document.all) {
document.onmousedown = click;
}
else {
document.onclick = click;
}
</script>
}

Add below code between body tag


<div>

Right click on page

</div>

How to use radio button list in asp.net mvc?

Radio button list in mvc

Radio button list in mvc razor.

Follow below Solution:-

@Html.RadioButtonFor(Model => Model.Gender, true) Male

@Html.RadioButtonFor(Model => Model.Gender, false) Female