P
Peter Afonin
Hello,
I'm not an expert in Javascript, so I'm seeking an advice.
As I mentioned in my previous post, I use Javascript to check whether at
least one checkbox in the datagrid has been checked. I have to use
Stringbuilder to do this:
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
But now I my validation controls don't work, and I need to validate two more
controls. I need to make sure that a texbox txtReason has a value, and that
the ddlSystem.SelectedItem.Value <> 0.
I could just write a Javascript function to do all this without any
Stringbuilder and ASP.NET code, except checking datagrid. To do this I have
to use Stringbuilder. And I cannot figure out how to put all this validation
in a single string and make it work with Stringbuilder.
I would appreciate your suggestions very much.
Thank you,
I'm not an expert in Javascript, so I'm seeking an advice.
As I mentioned in my previous post, I use Javascript to check whether at
least one checkbox in the datagrid has been checked. I have to use
Stringbuilder to do this:
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
But now I my validation controls don't work, and I need to validate two more
controls. I need to make sure that a texbox txtReason has a value, and that
the ddlSystem.SelectedItem.Value <> 0.
I could just write a Javascript function to do all this without any
Stringbuilder and ASP.NET code, except checking datagrid. To do this I have
to use Stringbuilder. And I cannot figure out how to put all this validation
in a single string and make it work with Stringbuilder.
I would appreciate your suggestions very much.
Thank you,