Dim lblID, lbla, lblb, lblc, lbld, lble As Label
Dim i As Integer
Dim a, b, c, d, f As String
For i = 0 To DataGrid1.Items.Count - 1
lblID = DataGrid1.Items(i).FindControl("lblFiscal")
lbla = DataGrid1.Items(i).FindControl("lblACCode")
lblb = DataGrid1.Items(i).FindControl("lblCR")
lblc = DataGrid1.Items(i).FindControl("lblDept")
lbld = DataGrid1.Items(i).FindControl("lblLoc")
lble = DataGrid1.Items(i).FindControl("lblsubject")
Session("Fiscal") = lblID.Text
Session("AC") = lbla.Text
Session("CR") = lblb.Text
Session("Deptcd") = lblc.Text
Session("Loc") = lbld.Text
Session("Subject") = lble.Text
If e.CommandName = "Img" Then
printpic() 'ตรงนี้ไป print Report แบบรูปภาพอันนี้อีก Case นึงเดี๋ยวกระทู้หน้าแล้วกันครับเอาข้างล่างนี้ก่อน
ElseIf e.CommandName = "Select" Then
Response.Redirect("Show_Data_CMS.aspx")
End If
Next
Tag : .NET, Ms SQL Server 2005, Crystal Report, Web (ASP.NET), VS 2003 (.NET 1.1)
Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand
Dim lblID, lbla, lblb, lblc, lbld, lble As Label
Dim i As Integer
Dim a, b, c, d, f As String
For i = 0 To DataGrid1.Items.Count - 1
lblID = DataGrid1.Items(i).FindControl("lblFiscal")
lbla = DataGrid1.Items(i).FindControl("lblACCode")
lblb = DataGrid1.Items(i).FindControl("lblCR")
lblc = DataGrid1.Items(i).FindControl("lblDept")
lbld = DataGrid1.Items(i).FindControl("lblLoc")
lble = DataGrid1.Items(i).FindControl("lblsubject")
Session("Fiscal") = lblID.Text
Session("AC") = lbla.Text
Session("CR") = lblb.Text
Session("Deptcd") = lblc.Text
Session("Loc") = lbld.Text
Session("Subject") = lble.Text
If e.CommandName = "Img" Then
printpic()
ElseIf e.CommandName = "Select" Then
Response.Redirect("Show_Data_CMS.aspx")
End If
Next
End Sub