Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Crystal report from .aspx page

 
Thread Tools Search this Thread
Old 07-17-2008, 03:58 AM   #1
Default Crystal report from .aspx page


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


Brock
  Reply With Quote
Old 07-17-2008, 12:49 PM   #2
sloan
 
Posts: n/a
Default Re: Crystal report from .aspx page

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.




"Brock" <> wrote in message
news:1ba04241-1c60-4b95-8213-...
> 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





sloan
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal stops displaying data when new field added to a report nickmellor Software 0 01-14-2009 01:07 AM
changing Crystal report table at run time rakesh201180 Software 1 10-22-2008 10:58 AM
Crystal Report with Java Gajesh Tripathi Software 2 08-02-2007 12:57 PM
slow crystal report guptamkomal Software 0 05-23-2007 01:17 PM
how to integrate crystal report 9 with java arputharaj Software 0 11-10-2006 06:25 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46