Crystal report from .aspx page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brock

    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.EventArg s) 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).G etActionCurrent (Global.UserSec urity.EmpId, Today,
    Global.UserName , Global.UserPass word, Global.appDataS ource)
    pos = (New PositionBroker) .GetPosition(ac t.PositionID,
    Global.UserName , Global.UserPass word, Global.appDataS ource)
    m_department = pos.Department. Name
    Dim emps As Employees = (New
    EmployeeBroker) .GetCurrentEmpl oyeesByDepartme nt(m_department ,
    Global.UserName , Global.UserPass word, Global.appDataS ource)
    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.Dat aSource = dt
    dgEmployees.Dat aBind()
    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).G etActionCurrent (dr.Key, Today, Global.UserName ,
    Global.UserPass word, Global.appDataS ource)
    Dim employee As DataRow = dt.NewRow
    employee("Emp #") = dr.Key
    employee("Last Name") = dr.LastName
    employee("First Name") = dr.FirstName
    employee("Title ") = EmpPos.WorkAgai nstInfo.Title
    dt.Rows.Add(emp loyee)
    End Sub 'SetListViewIte m
  • sloan

    #2
    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" <wade.brock@yah oo.comwrote in message
    news:1ba04241-1c60-4b95-8213-e420bb597fa5@m7 3g2000hsh.googl egroups.com...
    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.EventArg s) 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).G etActionCurrent (Global.UserSec urity.EmpId, Today,
    Global.UserName , Global.UserPass word, Global.appDataS ource)
    pos = (New PositionBroker) .GetPosition(ac t.PositionID,
    Global.UserName , Global.UserPass word, Global.appDataS ource)
    m_department = pos.Department. Name
    Dim emps As Employees = (New
    EmployeeBroker) .GetCurrentEmpl oyeesByDepartme nt(m_department ,
    Global.UserName , Global.UserPass word, Global.appDataS ource)
    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.Dat aSource = dt
    dgEmployees.Dat aBind()
    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).G etActionCurrent (dr.Key, Today, Global.UserName ,
    Global.UserPass word, Global.appDataS ource)
    Dim employee As DataRow = dt.NewRow
    employee("Emp #") = dr.Key
    employee("Last Name") = dr.LastName
    employee("First Name") = dr.FirstName
    employee("Title ") = EmpPos.WorkAgai nstInfo.Title
    dt.Rows.Add(emp loyee)
    End Sub 'SetListViewIte m

    Comment

    Working...