Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. Problem with ObjectDataSource + GridView

Problem with ObjectDataSource + GridView

Scheduled Pinned Locked Moved Windows API
helpdatabasewpfwcfsysadmin
2 Posts 2 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cnu kamath
    wrote on last edited by
    #1

    Hi, I am using a GridView that bound to an ObjectDataSource. This ObjectDataSource works against the business class containing the methods for updating and retrieving records. My problem is: After updating a record in the database the Gridview is not getting re-binding to reflect the changes. Instead it is throwing an error: "ObjectDataSource 'ObjProfile' could not find a non-generic method 'UpdateUserProfile' that has parameters: RoleID, FirstName, LastName, NickName, BirthDate, StreetAddress, State, Zip, Phone1, Email1, UserID." Any work arounds or help is appriciated. Below is the code that i used: Code written in .aspx page <asp:DropDownList ID="drdUserCategory" runat="server" CssClass="Label" Width="150px" AutoPostBack="true"> asp:DropDownList/ <asp:ObjectDataSource ID="ObjProfile" runat="server" TypeName="AEIBusiness.UsersProfile" UpdateMethod="UpdateUserProfile" SelectMethod="GetUserProfilesByRole" OldValuesParameterFormatString="{0}"> <SelectParameters> <asp:ControlParameter ControlID="drdUserCategory" Name="RoleID" PropertyName="selectedvalue" /> </SelectParameters> <UpdateParameters> <asp:Parameter Name="RoleID" Type="Int32" /> <asp:Parameter Name="UserID" Type="Int32" /> <asp:Parameter Name="FirstName" Type="string" /> <asp:Parameter Name="LastName" Type="string" /> <asp:Parameter Name="NickName" Type="string" /> <asp:Parameter Name="BirthDate" Type="string" /> <asp:Parameter Name="StreetAddress" Type="string" /> <asp:Parameter Name="State" Type="string" /> <asp:Parameter Name="Zip" Type="Int32" /> <asp:Parameter Name="Phone1" Type="string" /> <asp:Parameter Name="Email1" Type="string" /> </UpdateParameters> </asp:ObjectDataSource> <asp:GridView ID="grdUserProfile" runat="server" AutoGenerateColumns="False" BackColor="White" CssClass="Label" DataSourceID="ObjProfile" HorizontalAlign="Center" PageSize="10" AllowPaging="true" EmptyDataText="Record not found." EmptyDataRowStyle-HorizontalAlign="Center" CellPadding="2" GridLines="Vertical" BorderColor="InactiveBorder" BorderStyle="None" Bord

    R 1 Reply Last reply
    0
    • C cnu kamath

      Hi, I am using a GridView that bound to an ObjectDataSource. This ObjectDataSource works against the business class containing the methods for updating and retrieving records. My problem is: After updating a record in the database the Gridview is not getting re-binding to reflect the changes. Instead it is throwing an error: "ObjectDataSource 'ObjProfile' could not find a non-generic method 'UpdateUserProfile' that has parameters: RoleID, FirstName, LastName, NickName, BirthDate, StreetAddress, State, Zip, Phone1, Email1, UserID." Any work arounds or help is appriciated. Below is the code that i used: Code written in .aspx page <asp:DropDownList ID="drdUserCategory" runat="server" CssClass="Label" Width="150px" AutoPostBack="true"> asp:DropDownList/ <asp:ObjectDataSource ID="ObjProfile" runat="server" TypeName="AEIBusiness.UsersProfile" UpdateMethod="UpdateUserProfile" SelectMethod="GetUserProfilesByRole" OldValuesParameterFormatString="{0}"> <SelectParameters> <asp:ControlParameter ControlID="drdUserCategory" Name="RoleID" PropertyName="selectedvalue" /> </SelectParameters> <UpdateParameters> <asp:Parameter Name="RoleID" Type="Int32" /> <asp:Parameter Name="UserID" Type="Int32" /> <asp:Parameter Name="FirstName" Type="string" /> <asp:Parameter Name="LastName" Type="string" /> <asp:Parameter Name="NickName" Type="string" /> <asp:Parameter Name="BirthDate" Type="string" /> <asp:Parameter Name="StreetAddress" Type="string" /> <asp:Parameter Name="State" Type="string" /> <asp:Parameter Name="Zip" Type="Int32" /> <asp:Parameter Name="Phone1" Type="string" /> <asp:Parameter Name="Email1" Type="string" /> </UpdateParameters> </asp:ObjectDataSource> <asp:GridView ID="grdUserProfile" runat="server" AutoGenerateColumns="False" BackColor="White" CssClass="Label" DataSourceID="ObjProfile" HorizontalAlign="Center" PageSize="10" AllowPaging="true" EmptyDataText="Record not found." EmptyDataRowStyle-HorizontalAlign="Center" CellPadding="2" GridLines="Vertical" BorderColor="InactiveBorder" BorderStyle="None" Bord

      R Offline
      R Offline
      Rob Graham
      wrote on last edited by
      #2

      It is not helpful to post so much irrelevant code. Just the portions with the error would have sufficed. The error is telling you that your business object does not have a method with the signature you are calling (the parameters for UpdateUserProfile don't match - the function declaration has 11 parameters, your call has only 10). This post does not belong in the VISTA forum. Perhaps you meant to post in the SQL / ADO /ADO.net forum - you didn't post this in multiple forums, did you? That would be considered rude...

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups