ReportViewer/ObjectDataSource Problem

Discussion in 'ASP .Net Web Controls' started by Houston Lucifer, Dec 22, 2005.

  1. 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?
    Houston Lucifer, Dec 22, 2005
    #1
    1. Advertising

  2. 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?
    Mike MacMillan, Dec 29, 2005
    #2
    1. Advertising

  3. 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?

    >
    >
    Houston Lucifer, Dec 29, 2005
    #3
  4. 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?

    > >
    > >
    Mike MacMillan, Dec 29, 2005
    #4
  5. 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?
    > > >
    > > >

    >
    >
    Houston Lucifer, Dec 29, 2005
    #5
  6. Houston Lucifer

    thejez Guest

    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.

    "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?
    > > > >
    > > > >

    > >
    > >
    thejez, Jan 20, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Botha

    ReportViewer problem after deploy

    Chris Botha, Nov 16, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    6,058
    Chris Botha
    Nov 16, 2005
  2. =?Utf-8?B?QnJhZA==?=

    Reportviewer problem

    =?Utf-8?B?QnJhZA==?=, Dec 2, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    4,751
    =?Utf-8?B?QnJhZA==?=
    Feb 14, 2006
  3. =?Utf-8?B?SG91c3RvbiBMdWNpZmVy?=

    ReportViewer/ObjectDatasource Problem

    =?Utf-8?B?SG91c3RvbiBMdWNpZmVy?=, Dec 24, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    798
    =?Utf-8?B?SG91c3RvbiBMdWNpZmVy?=
    Dec 24, 2005
  4. ajso via JavaKB.com

    Problem With ReportViewer Object

    ajso via JavaKB.com, Sep 29, 2005, in forum: Java
    Replies:
    3
    Views:
    1,711
    Oliver Wong
    Sep 29, 2005
  5. David Thielen

    ObjectDataSource method as another ObjectDataSource

    David Thielen, Mar 21, 2006, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    228
    Steven Cheng[MSFT]
    Mar 23, 2006
Loading...

Share This Page