P
Peter Afonin
Hello,
I'm creating an application in ASP.NET 1.1. I need to check whether at least
one checkbox in my datagrid has been checked. To do this, I'm using
Javascript - I'm adding this code to Page_Load event:
Dim iCount As Int32
Dim sClientSideValidate As New StringBuilder
iCount = dgReport.Items.Count
For i As Int32 = 2 To iCount + 1
If Not i = iCount + 1 Then
sClientSideValidate.Append("dgReport__ctl" & i & "_chkConf.checked ||")
Else
sClientSideValidate.Append("dgReport__ctl" & i & "_chkConf.checked")
End If
Next
btnSubmit.Attributes.Add("onClick", "if (!(" & sClientSideValidate.ToString
& ")){ return confirm('You have not selected any DRs. Are you sure you want
to submit change?');}")
'RELEASE RESOURCES
sClientSideValidate = Nothing
This works great. The problem is that if I use this script, my other ASP.NET
validation controls on this page no longer work. I can see why - since the
Javascript runs on button onclick (client) event, I guess all other
Javascript on this page is ignored.
I wonder - is there a way to use both - javascript validation and ASP.NET
1.1 validation contols on the same page, or I have to put all validation in
JS?
I would appreciate your help.
Thank you,
I'm creating an application in ASP.NET 1.1. I need to check whether at least
one checkbox in my datagrid has been checked. To do this, I'm using
Javascript - I'm adding this code to Page_Load event:
Dim iCount As Int32
Dim sClientSideValidate As New StringBuilder
iCount = dgReport.Items.Count
For i As Int32 = 2 To iCount + 1
If Not i = iCount + 1 Then
sClientSideValidate.Append("dgReport__ctl" & i & "_chkConf.checked ||")
Else
sClientSideValidate.Append("dgReport__ctl" & i & "_chkConf.checked")
End If
Next
btnSubmit.Attributes.Add("onClick", "if (!(" & sClientSideValidate.ToString
& ")){ return confirm('You have not selected any DRs. Are you sure you want
to submit change?');}")
'RELEASE RESOURCES
sClientSideValidate = Nothing
This works great. The problem is that if I use this script, my other ASP.NET
validation controls on this page no longer work. I can see why - since the
Javascript runs on button onclick (client) event, I guess all other
Javascript on this page is ignored.
I wonder - is there a way to use both - javascript validation and ASP.NET
1.1 validation contols on the same page, or I have to put all validation in
JS?
I would appreciate your help.
Thank you,