Crystal report from .aspx page


B

Brock

Thanks for any help. I'm not new to Crystal Reports and use them
routinely in vb.net for desktop applications, but I don't know where
to start for using them in my asp.net apps. I currently have an .aspx
page with a datagrid populated by two compliled DLL's which make the
fields available to the datagrid with this code below. Should I have
a
popup screen that contains the ReportViewer from the toolbox? How can
I in my crystal report set the datasource. It would be really cool if
I could simply use the data in the datagrid as my source. Is this
possible?

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim act As Action
Dim pos As Position
Dim empname As String
Dim lvi As ListItem
Dim Employee As Employee
Dim empcount As Integer
act = (New
ActionBroker).GetActionCurrent(Global.UserSecurity.EmpId, Today,
Global.UserName, Global.UserPassword, Global.appDataSource)
pos = (New PositionBroker).GetPosition(act.PositionID,
Global.UserName, Global.UserPassword, Global.appDataSource)
m_department = pos.Department.Name
Dim emps As Employees = (New
EmployeeBroker).GetCurrentEmployeesByDepartment(m_department,
Global.UserName, Global.UserPassword, Global.appDataSource)
Dim dt As New DataTable
Dim count As Integer = 0
For Each emp As Employee In emps
SetListViewItem(emp, dt, count)
count = count + 1
Next
dgEmployees.DataSource = dt
dgEmployees.DataBind()
End Sub


Private Sub SetListViewItem(ByVal dr As Employee, ByVal dt As
DataTable, ByVal count As Integer)
If count = 0 Then
dt.Columns.Add("Emp #")
dt.Columns.Add("Last Name")
dt.Columns.Add("First Name")
dt.Columns.Add("Title")
End If
Dim EmpPos As Action = (New
ActionBroker).GetActionCurrent(dr.Key, Today, Global.UserName,
Global.UserPassword, Global.appDataSource)
Dim employee As DataRow = dt.NewRow
employee("Emp #") = dr.Key
employee("Last Name") = dr.LastName
employee("First Name") = dr.FirstName
employee("Title") = EmpPos.WorkAgainstInfo.Title
dt.Rows.Add(employee)
End Sub 'SetListViewItem
 
Ad

Advertisements

S

sloan

I would go with the PUSH method of CR (crystal report) development.
And instead of worrying about the datagrid as the SOURCE, cache (session?)
the dataset (or datatable possibly) and use it as the source for the
datagrid AND then the report.

Google
Crystal Reports PUSH PULL
and then you can read about the differences, and stick with the PUSH method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top