A
Ante Perkovic
Hi,
I'm trying to make a client side validation in a datagrid. Here is
what I did:
in mypage.aspx, I put:
<script language=javascript>
function isItValid(){ // just testing the functionality
if (document.Form1.txtIme.value != "ok"){
alert("!= OK")
return false
}else{
alert("OK")
return true
}
}
</script>
and in codeBehind file, I put:
Private Sub dgRezervirano_ItemDataBound(ByVal sender As Object,
ByVal e As DataGridItemEventArgs) Handles dgRezervirano.ItemDataBound
If e.Item.ItemType = ListItemType.EditItem Then
Dim btn as New Button()
btn = CType(e.Item.Cells(4).Controls(0), Button)
btn.Attributes("onclick") = "return isItValid()"
But, in html that is generated, I can see:
<input type="submit" name="dgRezervirano:_ctl4:_ctl0" value="ok"
onclick="if (typeof(Page_ClientValidate) == 'function')
Page_ClientValidate(); " language="javascript" onclick="return
isItValid()" />
Looks like
if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();
causes
onclick="return isItValid()"
to be ignored!(?)
How can I change this?
BTW, what is this Page_ClientValidate thing doing. How can I use it?
Thanks,
Ante
I'm trying to make a client side validation in a datagrid. Here is
what I did:
in mypage.aspx, I put:
<script language=javascript>
function isItValid(){ // just testing the functionality
if (document.Form1.txtIme.value != "ok"){
alert("!= OK")
return false
}else{
alert("OK")
return true
}
}
</script>
and in codeBehind file, I put:
Private Sub dgRezervirano_ItemDataBound(ByVal sender As Object,
ByVal e As DataGridItemEventArgs) Handles dgRezervirano.ItemDataBound
If e.Item.ItemType = ListItemType.EditItem Then
Dim btn as New Button()
btn = CType(e.Item.Cells(4).Controls(0), Button)
btn.Attributes("onclick") = "return isItValid()"
But, in html that is generated, I can see:
<input type="submit" name="dgRezervirano:_ctl4:_ctl0" value="ok"
onclick="if (typeof(Page_ClientValidate) == 'function')
Page_ClientValidate(); " language="javascript" onclick="return
isItValid()" />
Looks like
if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();
causes
onclick="return isItValid()"
to be ignored!(?)
How can I change this?
BTW, what is this Page_ClientValidate thing doing. How can I use it?
Thanks,
Ante