![]() |
|
|
|||||||
![]() |
ASP Net - Crystal report from .aspx page |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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. 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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |