Hi all,
I added a text box in item data bound method of datagrid.Now what i want the user can only enter a number in that text box.whenever a chracter is entered i got a pop up error message You must enter a number.and secondly how to set background color of that text in code behined in item data bound.I am working in visual studio 2003
thanx
function
validateValue(obj){
if(isNaN(obj.value)){
obj.value=
"";obj.focus();
alert(
"Please enter numeric value.");returnfalse;}
}
Put this in java script and install validation.js in ur solution explorer then it will run
to run this write Button1.Attribute.Add("onclick",
"return Validate('Spcification');"); in codebehin file
so that it will run fine
I would add a validation control to the row and set the control to validate in the Item_DataBind event handler. I think you would want to use the UniqueId, but I could be wrong on this.
86 ProtectedSub rptrBooks_ItemDataBound(ByVal senderAsObject, _
87 ByVal eAs System.Web.UI.WebControls.RepeaterItemEventArgs)Handles rptrBooks.ItemDataBound
91 Dim vMyValidatorAs RequiredFieldValidator = e.Item.FindControl("vMyValidator")
113 IfNot IsNothing(vMyValidator)Then
114 vMyValidator.ControlToValidate = txtTitle.UniqueID
115 EndIf
124
125 EndIf
126
127 EndSub
No comments:
Post a Comment