e.preventDefault() is the key method, to disable the default operations to proceed further. We first stop the event from further bubbling up to other parent controls and put any custom logic.
@"e" is a event.
Example:
$('#<%=textbox.ClientID%>').bind('cut copy paste',
function (e) {
e.preventDefault();
alert("Cut / Copy / Paste are not allowed.");
});
Wednesday, August 29, 2012
JQuery:preventDefault() method will do.
Tuesday, August 28, 2012
MVC: set Default value in Html.TextboxFor Helper In Asp.Net MVC 2
Html.TextBoxFor in MVC 2 doesn't allow the setting of the value property using the object html attributes.
syntax -
<%= Html.TextBoxFor(model => model.city, new { maxlength = "40" })%>
If you need to set a default value on a textbox field, you need to use the old
syntax -
<%= Html.TextBox("city", "New Delhi", new { maxlength = "40" })%>
Subscribe to:
Comments (Atom)
Hash Table in C#
The Hashtable is a non-generic collection and used to store the key/value pairs based on the hash code of the key. Key will be used to acce...
-
Html.TextBoxFor in MVC 2 doesn't allow the setting of the value property using the object html attributes. syntax - <%= Html.Text...
-
Dictionary<string, string> DicSearch; DicSearch = new Dictionary<string, string>(); DicSearch.Add("1", "Mohi...
-
e.preventDefault() is the key method, to disable the default operations to proceed further. We first stop the event from further bubbli...
-
****************** Type 1 ********************* System.Nullable<DateTime> dt; dt = null; ****************** Type 2 **************...