I need to attach the following 2 little scripts to an ASP.NET Button. I am
having an issue with running both of the Attributes.Add. I can only get on
to work at once. I have also tried to put them both/either in the page_load,
but cannot get it to work.
TIA,
Steve Wofford
www.IntraRELY.com
SUEDO Code:
----------------------
User clicks btnPrint
Sc. 1
btnPrint.Attrib utes.Add("OnCli ck", "javascript:ret urn confirm('Are you sure
you want to print these checks?');")
removed records from the datagrid and redraws it w/o the checks records.
Sc. 2
btnPrint.Attrib utes.Add("oncli ck", "window.open('p rintCheckClient .exe',
1);")
Local vb.net client queries the db for the records that where removed from
the above datagrid.
ACTUAL CODE:
-----------------------
' Sc. 1
btnPrint.Attrib utes.Add("OnCli ck", "javascript:ret urn confirm('Are you sure
you want to print these checks?');")
Dim checkIdItem As DataGridItem
sqlChecks.Open( )
For Each checkIdItem In dgChecks.Items
Dim dgCheckbox As CheckBox = CType(checkIdIt em.Cells(0).Con trols(1),
CheckBox)
If dgCheckbox.Chec ked Then
Dim selectedCheckId = dgChecks.DataKe ys(checkIdItem. ItemIndex)
With cmdChecksPrintU pdate
..Parameters("@ checkId").Value = selectedCheckId
..Parameters("@ printed").Value = 2
End With
Try
Dim eNonQuery = cmdChecksPrintU pdate.ExecuteNo nQuery
With cmdChecksCount
..Parameters("@ printed").Value = globalPrinted
End With
dgChecks.Virtua lItemCount = cmdChecksCount. ExecuteScalar()
Catch ex As SqlClient.SqlEx ception
lblMessage.Text = "Unexplecte d error." + ex.Message
Finally
End Try
End If
Next
If dgChecks.Curren tPageIndex = 0 Then
dgChecks_fill(g lobalPrinted)
Else
If Math.Ceiling(dg Checks.VirtualI temCount / dgChecks.PageSi ze) <
dgChecks.PageCo unt Then
Dim currentPageInde x = dgChecks.Curren tPageIndex
Dim pageCount = dgChecks.PageCo unt
If currentPageInde x + 1 = pageCount Then
dgChecks.Curren tPageIndex = Math.Ceiling(dg Checks.VirtualI temCount /
dgChecks.PageSi ze) - 1
Dim topExclude = (dgChecks.Curre ntPageIndex) * dgChecks.PageSi ze
dgChecks_fill(t opExclude)
Else
Dim topExclude = (dgChecks.Curre ntPageIndex) * dgChecks.PageSi ze
dgChecks_fill(t opExclude)
End If
Else
Dim topExclude = (dgChecks.Curre ntPageIndex) * dgChecks.PageSi ze
dgChecks_fill(t opExclude)
End If
End If
' Sc. 2
btnPrint.Attrib utes.Add("oncli ck", "window.open('p rintCheckClient .exe',
1);")
End Sub