objectdataSource case sensitive with parameters??

Discussion in 'ASP .Net Web Controls' started by Trapulo, Aug 24, 2006.

  1. Trapulo

    Trapulo Guest

    I'have this error on a runtime page:
    ObjectDataSource 'dataSourceActivityLogs' could not find a non-generic
    method 'GetActivityLogsCount' that has parameters: veichleID, originalName,
    status.

    My class has this method declared:
    Public Function GetActivityLogsCount(ByVal veichleID As Nullable(Of Int32),
    ByVal originalName As String, ByVal Status As Nullable(Of
    BusinessEntities.ActivityLog.ActivityLogStatus)) As Int32

    I noticed that if "Status" is writted capitalized, I have the error. If it
    is written as "status", the objectdatasource works. My big problem is that I
    have an other datasource, in the same asp.net project, that raises the error
    only if parameter is written as "status" and works only if I write
    "Status"!!! :((

    This is the objectdatasource declaration:

    <asp:ObjectDataSource ID="dataSourceActivityLogs" runat="server"
    EnablePaging="True"

    EnableViewState="False" OldValuesParameterFormatString="original_{0}"
    SelectCountMethod="GetActivityLogsCount"

    SelectMethod="GetActivityLogs" TypeName="DataSources.ActivityLogs">

    <SelectParameters>

    <asp:parameter Name="veichleID" Type="Int32" />

    <asp:parameter Name="originalName" Type="String" />

    <asp:parameter DefaultValue="2" Name="status" Type="Object" />

    </SelectParameters>

    </asp:ObjectDataSource>



    Whis this behavor?? How can I solve this?



    thanks
    Trapulo, Aug 24, 2006
    #1
    1. Advertising

  2. Hello Trapulo,

    It seems you're encountering some method paramter mismatching error when
    using ObjectDataSource control in ASP.NET page.

    I've ever met some issue with similar error which is caused by the paramter
    type or count mismatch. However, the problem in your case seems a bit
    strange as you said the "Status" paramter will work for one datasource but
    not for anotehr one.

    Have you tried comparing the two datasource's declaration in the aspx
    template to see whether there is any difference between them? Also, you can
    try copying them onto the same page to see what's the behavior.

    If convenient, you can create a simplified business class(with some hard
    coded dummy datas) which can reproduct the problem so that I can also
    perform some tests on my local side.

    Please feel free to let me know if there is any other finding.


    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================



    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Aug 25, 2006
    #2
    1. Advertising

  3. Trapulo

    Trapulo Guest

    Hello Steven,
    I made some other test, and it seems the problem is related to the name
    "status". Now I've this problem on others datasources. I've tried to rename
    the param, and this is how the error has changed:

    ObjectDataSource 'dsLogs' could not find a non-generic method
    'GetActivityLogs' that has parameters: veichleID, originalName, logStatus,
    Status, maximumRows, startRowIndex.
    As you can see, my parameter has been called "logStatus", but the datasource
    is still looking for a "Status" parameter... :(

    This is the datasource that is raising that error:

    <asp:ObjectDataSource ID="dsLogs" runat="server" EnablePaging="True"
    EnableViewState="False" OldValuesParameterFormatString="original_{0}"
    SelectCountMethod="GetActivityLogsCount"

    SelectMethod="GetActivityLogs" TypeName="DataSources.ActivityLogs">

    <SelectParameters>

    <asp:ControlParameter ControlID="ddlVeichles" DefaultValue="0"
    Name="veichleID" PropertyName="SelectedValue" Type="Int32" />

    <asp:parameter Name="originalName" Type="String" />

    <asp:parameter DefaultValue="2" Name="logStatus" Type="Object" />

    </SelectParameters>

    </asp:ObjectDataSource>



    And this is the target method:



    Public Function GetActivityLogs(ByVal veichleID As Nullable(Of Int32), ByVal
    originalName As String, _

    ByVal logStatus As Nullable(Of
    BusinessEntities.ActivityLog.ActivityLogStatus), _

    ByVal startRowIndex As Int32, ByVal maximumRows As Int32) As
    BusinessEntities.LogsCollection



    Dim filter As New BusinessEntities.Filters.FilterLog(originalName)

    filter.StartRowIndex = startRowIndex

    filter.MaximumRows = maximumRows

    If veichleID.HasValue Then filter.Veichle = New
    BusinessEntities.Veichle(veichleID.Value)

    If logStatus.HasValue Then filter.Status = logStatus.Value



    Dim out As BusinessEntities.LogsCollection =
    Utils.FcdDataManagement.GetLogs(filter)

    _totalRowsCache = filter.TotalRows

    Return out

    End Function


    "Steven Cheng[MSFT]" <> wrote in message
    news:...
    > Hello Trapulo,
    >
    > It seems you're encountering some method paramter mismatching error when
    > using ObjectDataSource control in ASP.NET page.
    >
    > I've ever met some issue with similar error which is caused by the
    > paramter
    > type or count mismatch. However, the problem in your case seems a bit
    > strange as you said the "Status" paramter will work for one datasource but
    > not for anotehr one.
    >
    > Have you tried comparing the two datasource's declaration in the aspx
    > template to see whether there is any difference between them? Also, you
    > can
    > try copying them onto the same page to see what's the behavior.
    >
    > If convenient, you can create a simplified business class(with some hard
    > coded dummy datas) which can reproduct the problem so that I can also
    > perform some tests on my local side.
    >
    > Please feel free to let me know if there is any other finding.
    >
    >
    > Sincerely,
    >
    > Steven Cheng
    >
    > Microsoft MSDN Online Support Lead
    >
    >
    >
    Trapulo, Aug 26, 2006
    #3
  4. Trapulo

    Trapulo Guest

    I add that I have, on an other page, this datasource that is working well:

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
    EnablePaging="True"

    EnableViewState="False" OldValuesParameterFormatString="original_{0}"
    SelectCountMethod="GetActivityLogsCount"

    SelectMethod="GetActivityLogs" TypeName="DataSources.ActivityLogs">

    <SelectParameters>

    <asp:ControlParameter ControlID="ddlVeichles" DefaultValue="0"
    Name="veichleID" PropertyName="SelectedValue"

    Type="Int32" />

    <asp:parameter Name="originalName" Type="String" />

    <asp:parameter Name="logStatus" Type="Object" />

    </SelectParameters>

    </asp:ObjectDataSource>



    "Trapulo" <> wrote in message
    news:...
    > This is the datasource that is raising that error:
    >
    > <asp:ObjectDataSource ID="dsLogs" runat="server" EnablePaging="True"
    > EnableViewState="False" OldValuesParameterFormatString="original_{0}"
    > SelectCountMethod="GetActivityLogsCount"
    >
    > SelectMethod="GetActivityLogs" TypeName="DataSources.ActivityLogs">
    >
    > <SelectParameters>
    >
    > <asp:ControlParameter ControlID="ddlVeichles" DefaultValue="0"
    > Name="veichleID" PropertyName="SelectedValue" Type="Int32" />
    >
    > <asp:parameter Name="originalName" Type="String" />
    >
    > <asp:parameter DefaultValue="2" Name="logStatus" Type="Object" />
    >
    > </SelectParameters>
    >
    > </asp:ObjectDataSource>
    Trapulo, Aug 26, 2006
    #4
  5. Trapulo

    Trapulo Guest

    Ok, this was my error. When I tried to rename the parameter from "status" to
    "logStatus", I forgot that I have this code-behind:

    Protected Sub dsLogs_Selecting(ByVal sender As Object, ByVal e As
    System.Web.UI.WebControls.ObjectDataSourceSelectingEventArgs) Handles
    dsLogs.Selecting
    e.InputParameters("logStatus") =
    BusinessEntities.ActivityLog.ActivityLogStatus.analyzed

    End Sub

    So, renaming the parameter from "status" to "logStatus" is a solution to my
    problem: now all objectdataSources are working well and they all are calling
    this methods:

    Public Function GetActivityLogs(ByVal veichleID As Nullable(Of Int32), ByVal
    originalName As String, _

    ByVal logStatus As Nullable(Of
    BusinessEntities.ActivityLog.ActivityLogStatus), _

    ByVal startRowIndex As Int32, ByVal maximumRows As Int32) As
    BusinessEntities.ActivityLogsCollection

    and

    Public Function GetActivityLogsCount(ByVal veichleID As Nullable(Of Int32),
    ByVal originalName As String, _

    ByVal logStatus As Nullable(Of
    BusinessEntities.ActivityLog.ActivityLogStatus)) As Int32



    I think there is some problem when a parameter is called "status" ..... very
    strange, but renamig it solve my problem...



    "Trapulo" <> wrote in message
    news:...
    >I add that I have, on an other page, this datasource that is working well:
    >
    > <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
    > EnablePaging="True"
    >
    > EnableViewState="False" OldValuesParameterFormatString="original_{0}"
    > SelectCountMethod="GetActivityLogsCount"
    >
    > SelectMethod="GetActivityLogs" TypeName="DataSources.ActivityLogs">
    >
    > <SelectParameters>
    >
    > <asp:ControlParameter ControlID="ddlVeichles" DefaultValue="0"
    > Name="veichleID" PropertyName="SelectedValue"
    >
    > Type="Int32" />
    >
    > <asp:parameter Name="originalName" Type="String" />
    >
    > <asp:parameter Name="logStatus" Type="Object" />
    >
    > </SelectParameters>
    >
    > </asp:ObjectDataSource>
    >
    >
    >
    > "Trapulo" <> wrote in message
    > news:...
    >> This is the datasource that is raising that error:
    >>
    >> <asp:ObjectDataSource ID="dsLogs" runat="server" EnablePaging="True"
    >> EnableViewState="False" OldValuesParameterFormatString="original_{0}"
    >> SelectCountMethod="GetActivityLogsCount"
    >>
    >> SelectMethod="GetActivityLogs" TypeName="DataSources.ActivityLogs">
    >>
    >> <SelectParameters>
    >>
    >> <asp:ControlParameter ControlID="ddlVeichles" DefaultValue="0"
    >> Name="veichleID" PropertyName="SelectedValue" Type="Int32" />
    >>
    >> <asp:parameter Name="originalName" Type="String" />
    >>
    >> <asp:parameter DefaultValue="2" Name="logStatus" Type="Object" />
    >>
    >> </SelectParameters>
    >>
    >> </asp:ObjectDataSource>

    >
    >
    Trapulo, Aug 26, 2006
    #5
  6. Thanks for your followup Trapulo,

    Glad that you've figured out the problem.

    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Steven Cheng[MSFT], Aug 28, 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. Boban Dragojlovic

    DropDownList values are case sensitive?

    Boban Dragojlovic, Nov 6, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    2,234
    Boban Dragojlovic
    Nov 6, 2003
  2. Martin Dechev
    Replies:
    0
    Views:
    541
    Martin Dechev
    Apr 2, 2004
  3. Replies:
    0
    Views:
    514
  4. Replies:
    1
    Views:
    2,480
    Mark P
    Apr 6, 2007
  5. Xah Lee
    Replies:
    4
    Views:
    963
Loading...

Share This Page