Home All Groups Group Topic Archive Search About

ReportViewer/ObjectDataSource Problem

Author
22 Dec 2005 1:59 AM
Houston Lucifer
I have a report viewer on my webpage and it is linked to an objectdatasource.
The parameter is a control on the form (Dropdownlist). But, when i change the
selection in the dropdownlist and click the go button (on the web page), the
reportviewer doesn't refresh.

What i have done so far is i have the go button coded to do a select on the
objectdatasource like ObjectDataSource1.Select(). I assign the parameter
values in the Objectdatasource selecting event. This one calls the Function i
have in the business object but the retrieve of the report viewer shows the
same data. I even issued the ReportViewer.DataBind() in the Object datasource
selected event. What am i doing wrong?

Author
29 Dec 2005 12:12 AM
Mike MacMillan
Houston,
  a) what event are you doing your databinding in(OnInit, OnLoad,
etc...)?
  b) can you post a little code?

  thanks,
  Mike MacMillan

Houston Lucifer wrote:
Show quoteHide quote
> I have a report viewer on my webpage and it is linked to an objectdatasource.
> The parameter is a control on the form (Dropdownlist). But, when i change the
> selection in the dropdownlist and click the go button (on the web page), the
> reportviewer doesn't refresh.
>
> What i have done so far is i have the go button coded to do a select on the
> objectdatasource like ObjectDataSource1.Select(). I assign the parameter
> values in the Objectdatasource selecting event. This one calls the Function i
> have in the business object but the retrieve of the report viewer shows the
> same data. I even issued the ReportViewer.DataBind() in the Object datasource
> selected event. What am i doing wrong?
Author
29 Dec 2005 1:31 AM
Houston Lucifer
In the Page Load Event
If Not isPostBack() Then
   ddlApproval.DataBind()
End If

In the page markup
               <rsweb:ReportViewer ID="ReportViewer1" runat="server"
Font-Names="Verdana" Font-Size="8pt"
                    Height="400px" Width="100%">
                    <LocalReport ReportPath="ItemStatusReport.rdlc"
DisplayName="Item Status">
                        <DataSources>
                            <rsweb:ReportDataSource
DataSourceId="ObjectDataSource1" Name="ItemStatusDS_ApprovalTable" />
                        </DataSources>
                    </LocalReport>
                </rsweb:ReportViewer>
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="GetItemsDenied"
                    TypeName="ReportClass">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddlApproval"
DefaultValue="D" Name="approvalFlag"
                            PropertyName="SelectedValue" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>

As soon as the page loads it picks up the first value in the dropdown and
retrieves the report, but when i change the value in the dropdown
(autopostback = yes) the report does not refresh. I called the
ObjectDataSource.Select method in the DDL selectedindexchanged event it
didn't help. I am wasting lot of time figuring out which is hopefully a
simple problem.

Show quoteHide quote
"Mike MacMillan" wrote:

> Houston,
>   a) what event are you doing your databinding in(OnInit, OnLoad,
> etc...)?
>   b) can you post a little code?
>
>   thanks,
>   Mike MacMillan
>
> Houston Lucifer wrote:
> > I have a report viewer on my webpage and it is linked to an objectdatasource.
> > The parameter is a control on the form (Dropdownlist). But, when i change the
> > selection in the dropdownlist and click the go button (on the web page), the
> > reportviewer doesn't refresh.
> >
> > What i have done so far is i have the go button coded to do a select on the
> > objectdatasource like ObjectDataSource1.Select(). I assign the parameter
> > values in the Objectdatasource selecting event. This one calls the Function i
> > have in the business object but the retrieve of the report viewer shows the
> > same data. I even issued the ReportViewer.DataBind() in the Object datasource
> > selected event. What am i doing wrong?
>
>
Author
29 Dec 2005 1:47 AM
Mike MacMillan
Houston,
  i don't see the code for the dropdown in the snippet you provided, is
this control created dynamically, or does the rsweb:ReportViewer
control create a dropdownlist?  you are basically changing the report
based on the selected item in the dropdownlist correct?  is the
dropdownlist populated upon postback (ie, are you sure viewstate is
working correctly?).

  Mike MacMillan



Houston Lucifer wrote:
Show quoteHide quote
> In the Page Load Event
> If Not isPostBack() Then
>    ddlApproval.DataBind()
> End If
>
> In the page markup
>                <rsweb:ReportViewer ID="ReportViewer1" runat="server"
> Font-Names="Verdana" Font-Size="8pt"
>                     Height="400px" Width="100%">
>                     <LocalReport ReportPath="ItemStatusReport.rdlc"
> DisplayName="Item Status">
>                         <DataSources>
>                             <rsweb:ReportDataSource
> DataSourceId="ObjectDataSource1" Name="ItemStatusDS_ApprovalTable" />
>                         </DataSources>
>                     </LocalReport>
>                 </rsweb:ReportViewer>
>                 <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
> SelectMethod="GetItemsDenied"
>                     TypeName="ReportClass">
>                     <SelectParameters>
>                         <asp:ControlParameter ControlID="ddlApproval"
> DefaultValue="D" Name="approvalFlag"
>                             PropertyName="SelectedValue" Type="String" />
>                     </SelectParameters>
>                 </asp:ObjectDataSource>
>
> As soon as the page loads it picks up the first value in the dropdown and
> retrieves the report, but when i change the value in the dropdown
> (autopostback = yes) the report does not refresh. I called the
> ObjectDataSource.Select method in the DDL selectedindexchanged event it
> didn't help. I am wasting lot of time figuring out which is hopefully a
> simple problem.
>
> "Mike MacMillan" wrote:
>
> > Houston,
> >   a) what event are you doing your databinding in(OnInit, OnLoad,
> > etc...)?
> >   b) can you post a little code?
> >
> >   thanks,
> >   Mike MacMillan
> >
> > Houston Lucifer wrote:
> > > I have a report viewer on my webpage and it is linked to an objectdatasource.
> > > The parameter is a control on the form (Dropdownlist). But, when i change the
> > > selection in the dropdownlist and click the go button (on the web page), the
> > > reportviewer doesn't refresh.
> > >
> > > What i have done so far is i have the go button coded to do a select on the
> > > objectdatasource like ObjectDataSource1.Select(). I assign the parameter
> > > values in the Objectdatasource selecting event. This one calls the Function i
> > > have in the business object but the retrieve of the report viewer shows the
> > > same data. I even issued the ReportViewer.DataBind() in the Object datasource
> > > selected event. What am i doing wrong?
> >
> >
Author
29 Dec 2005 2:32 AM
Houston Lucifer
Dropdown was being populated by a function using the markup
<%# GetApprovalCodes() %> DataTextField="descr" DataValueField="code">

Yes, you are correct about the dropdown. I change the report based on the
value on the dropdown.

I think i had some serious problems with the view state. What i did now was
set the enable autopost back of the Dropdown to false and added a go button
on the web page. In the go button click event, i call the
objectdatsource1.Select method and then i issued
ReportViewer1.LocalReport.Refresh() command and it fixed it.

Thanks very much for your help. I appreciate it.

Show quoteHide quote
"Mike MacMillan" wrote:

> Houston,
>   i don't see the code for the dropdown in the snippet you provided, is
> this control created dynamically, or does the rsweb:ReportViewer
> control create a dropdownlist?  you are basically changing the report
> based on the selected item in the dropdownlist correct?  is the
> dropdownlist populated upon postback (ie, are you sure viewstate is
> working correctly?).
>
>   Mike MacMillan
>
>
>
> Houston Lucifer wrote:
> > In the Page Load Event
> > If Not isPostBack() Then
> >    ddlApproval.DataBind()
> > End If
> >
> > In the page markup
> >                <rsweb:ReportViewer ID="ReportViewer1" runat="server"
> > Font-Names="Verdana" Font-Size="8pt"
> >                     Height="400px" Width="100%">
> >                     <LocalReport ReportPath="ItemStatusReport.rdlc"
> > DisplayName="Item Status">
> >                         <DataSources>
> >                             <rsweb:ReportDataSource
> > DataSourceId="ObjectDataSource1" Name="ItemStatusDS_ApprovalTable" />
> >                         </DataSources>
> >                     </LocalReport>
> >                 </rsweb:ReportViewer>
> >                 <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
> > SelectMethod="GetItemsDenied"
> >                     TypeName="ReportClass">
> >                     <SelectParameters>
> >                         <asp:ControlParameter ControlID="ddlApproval"
> > DefaultValue="D" Name="approvalFlag"
> >                             PropertyName="SelectedValue" Type="String" />
> >                     </SelectParameters>
> >                 </asp:ObjectDataSource>
> >
> > As soon as the page loads it picks up the first value in the dropdown and
> > retrieves the report, but when i change the value in the dropdown
> > (autopostback = yes) the report does not refresh. I called the
> > ObjectDataSource.Select method in the DDL selectedindexchanged event it
> > didn't help. I am wasting lot of time figuring out which is hopefully a
> > simple problem.
> >
> > "Mike MacMillan" wrote:
> >
> > > Houston,
> > >   a) what event are you doing your databinding in(OnInit, OnLoad,
> > > etc...)?
> > >   b) can you post a little code?
> > >
> > >   thanks,
> > >   Mike MacMillan
> > >
> > > Houston Lucifer wrote:
> > > > I have a report viewer on my webpage and it is linked to an objectdatasource.
> > > > The parameter is a control on the form (Dropdownlist). But, when i change the
> > > > selection in the dropdownlist and click the go button (on the web page), the
> > > > reportviewer doesn't refresh.
> > > >
> > > > What i have done so far is i have the go button coded to do a select on the
> > > > objectdatasource like ObjectDataSource1.Select(). I assign the parameter
> > > > values in the Objectdatasource selecting event. This one calls the Function i
> > > > have in the business object but the retrieve of the report viewer shows the
> > > > same data. I even issued the ReportViewer.DataBind() in the Object datasource
> > > > selected event. What am i doing wrong?
> > >
> > >
>
>
Author
20 Jan 2006 3:05 PM
thejez
you shouldnt need the objectdatasource.select ... the
ReportViewer1.LocalReport.Refresh() is all you need to do.  I am doing the
same thing you are but all i did was call refresh and it works fine.

I would like to stop the "auto-load" behaviour of the report though.  I dont
like the report running when the page first loads... still havent figured
that out.

Show quoteHide quote
"Houston Lucifer" wrote:

> Dropdown was being populated by a function using the markup
> <%# GetApprovalCodes() %> DataTextField="descr" DataValueField="code">

> Yes, you are correct about the dropdown. I change the report based on the
> value on the dropdown.
>
> I think i had some serious problems with the view state. What i did now was
> set the enable autopost back of the Dropdown to false and added a go button
> on the web page. In the go button click event, i call the
> objectdatsource1.Select method and then i issued
> ReportViewer1.LocalReport.Refresh() command and it fixed it.
>
> Thanks very much for your help. I appreciate it.
>
> "Mike MacMillan" wrote:
>
> > Houston,
> >   i don't see the code for the dropdown in the snippet you provided, is
> > this control created dynamically, or does the rsweb:ReportViewer
> > control create a dropdownlist?  you are basically changing the report
> > based on the selected item in the dropdownlist correct?  is the
> > dropdownlist populated upon postback (ie, are you sure viewstate is
> > working correctly?).
> >
> >   Mike MacMillan
> >
> >
> >
> > Houston Lucifer wrote:
> > > In the Page Load Event
> > > If Not isPostBack() Then
> > >    ddlApproval.DataBind()
> > > End If
> > >
> > > In the page markup
> > >                <rsweb:ReportViewer ID="ReportViewer1" runat="server"
> > > Font-Names="Verdana" Font-Size="8pt"
> > >                     Height="400px" Width="100%">
> > >                     <LocalReport ReportPath="ItemStatusReport.rdlc"
> > > DisplayName="Item Status">
> > >                         <DataSources>
> > >                             <rsweb:ReportDataSource
> > > DataSourceId="ObjectDataSource1" Name="ItemStatusDS_ApprovalTable" />
> > >                         </DataSources>
> > >                     </LocalReport>
> > >                 </rsweb:ReportViewer>
> > >                 <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
> > > SelectMethod="GetItemsDenied"
> > >                     TypeName="ReportClass">
> > >                     <SelectParameters>
> > >                         <asp:ControlParameter ControlID="ddlApproval"
> > > DefaultValue="D" Name="approvalFlag"
> > >                             PropertyName="SelectedValue" Type="String" />
> > >                     </SelectParameters>
> > >                 </asp:ObjectDataSource>
> > >
> > > As soon as the page loads it picks up the first value in the dropdown and
> > > retrieves the report, but when i change the value in the dropdown
> > > (autopostback = yes) the report does not refresh. I called the
> > > ObjectDataSource.Select method in the DDL selectedindexchanged event it
> > > didn't help. I am wasting lot of time figuring out which is hopefully a
> > > simple problem.
> > >
> > > "Mike MacMillan" wrote:
> > >
> > > > Houston,
> > > >   a) what event are you doing your databinding in(OnInit, OnLoad,
> > > > etc...)?
> > > >   b) can you post a little code?
> > > >
> > > >   thanks,
> > > >   Mike MacMillan
> > > >
> > > > Houston Lucifer wrote:
> > > > > I have a report viewer on my webpage and it is linked to an objectdatasource.
> > > > > The parameter is a control on the form (Dropdownlist). But, when i change the
> > > > > selection in the dropdownlist and click the go button (on the web page), the
> > > > > reportviewer doesn't refresh.
> > > > >
> > > > > What i have done so far is i have the go button coded to do a select on the
> > > > > objectdatasource like ObjectDataSource1.Select(). I assign the parameter
> > > > > values in the Objectdatasource selecting event. This one calls the Function i
> > > > > have in the business object but the retrieve of the report viewer shows the
> > > > > same data. I even issued the ReportViewer.DataBind() in the Object datasource
> > > > > selected event. What am i doing wrong?
> > > >
> > > >
> >
> >