Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Mon, 7 Jul 2008 14:06:06 -0700,    group: microsoft.public.dotnet.framework.aspnet.webcontrols        back       


FindControl in a gridview's dynamically-added template   
I dynamically add data-bound templates to a gridview in my ascx control. 
    while this works correctly when the gridview is databound to the 
datatable, i'm having issues on postback.

i would like to iterate thru the gridview's rows, examine the databound 
controls, then perform a database action.  for some reason, i can't find 
the controls.

i have a two templates: one that uses a label the other uses a textbox 
to display data.  when the InstantiateIn fires, i set the Id property 
equal to 'Label_' +  the name of the databound column, add the control 
to the container and add the onDataBinding event handler.

what am i missing?

thanks,

Craig buchanan
date: Mon, 07 Jul 2008 15:15:07 -0500   author:   Craig Buchanan

An attempt to dynamically assign RDLC's to Report viewers   
I have a routine that uses a sqlDataReader to determine whether or not to 
display a chart in a grid slot of possible 20 slots- thus far, it 
successfully assigns the 'reportpath' to the report viewer dynamically, 
enabling a contigious set of charts to appear, whether 3 in a row, or 20- 
instead of having say-3 charts take up wasted space of 20 unused grid slots.

To illustrate, the portion that works 90% to my requirements is:

Do While dr.Read


            'determine the report to insert based on the MeasureID that it 
found
            strMeasure = dr("MeasureID")
            strReportPath = "Reports/rptPCPQual_" & strMeasure & ".rdlc"


            i = i + 1

            Select Case i

                Case 1
                    rv1.Visible = True
                    rv1.Reportpath = strReportPath

                    
                Case 2
                     rv2.Visible = True
                    rv2.Reportpath = strReportPath
                Case 3 .....


Of course, I then discovered that the report definition needs to be 
completely removed and rebuilt in order of this to work properly so I'd like 
to use the following code in place of the line rv.ReportPath = strReportpath 
-- to read
ClearReport(Me.rv1, strReportPath)
(Me.rv1 is changed in each iteration to Me.rv2, Me.rv3...)
And here's what I'm attempting:

Private Sub ClearReport(ByVal CurRV As 
Microsoft.Reporting.WebForms.ReportViewer, ByVal strReportPath As String)
        Dim cc As ControlCollection = CurRV.Parent.Controls
        'get index of previous ReportViewer so we can swap it out. 
        Dim prevIndex As Integer = cc.IndexOf(CurRV)
        Dim RV As Microsoft.Reporting.WebForms.ReportViewer

        ' Remove previous ReportViewer 
        cc.Remove(CurRV)

        'add new instance of ReportViewer. 
        RV = New Microsoft.Reporting.WebForms.ReportViewer()

        ' Reset report properties. 
        RV.ID = CurRV.ID
        RV.Height = Unit.Parse("336px")
        RV.Width = Unit.Parse("448px")


        'Add the new ReportViewer to the previous ReportViewer location. 
        cc.AddAt(prevIndex, CurRV)

        ' Clear out any previous datasources. 
        RV.LocalReport.DataSources.Clear()

        'Set report mode for local processing. 
        RV.ProcessingMode = ProcessingMode.Local

        
        RV.LocalReport.ReportPath = strReportPath

        RV.LocalReport.DataSources.Add(New 
Microsoft.Reporting.WebForms.ReportDataSource("GetPCPQualityDataforallMonths", Me.odsPCPQual))
        ' Refresh the ReportViewer 
        RV.LocalReport.Refresh()
    End Sub

Theoretically it should work, but I just see a blank sheet - 
What did I miss?
date: Mon, 7 Jul 2008 14:06:06 -0700   author:   Plateriot

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us