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. Web Development
  3. ASP.NET
  4. Create aon objectdatasource programatically

Create aon objectdatasource programatically

Scheduled Pinned Locked Moved ASP.NET
helpannouncement
7 Posts 3 Posters 0 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.
  • M Offline
    M Offline
    Member 4382232
    wrote on last edited by
    #1

    Hi, I'm trying to create an objectdatasource in code and then bind a gridview. ObjectDataSource objDS = new ObjectDataSource(); objDS.DataObjectTypeName = "VeriWeb_Administration.BusinessObjects.Provider"; objDS.TypeName = "VeriWeb_Administration.BusinessObjects.Providers"; objDS.SelectMethod = "PopulateProviders()"; objDS.UpdateMethod = "Update(Provider item)"; objDS.ID = "ObjectDataSource1"; I get the following error on gridview.databind() : The Select operation is not supported by ObjectDataSource 'ObjectDataSource1' unless the SelectMethod is specified. Please help

    C 1 Reply Last reply
    0
    • M Member 4382232

      Hi, I'm trying to create an objectdatasource in code and then bind a gridview. ObjectDataSource objDS = new ObjectDataSource(); objDS.DataObjectTypeName = "VeriWeb_Administration.BusinessObjects.Provider"; objDS.TypeName = "VeriWeb_Administration.BusinessObjects.Providers"; objDS.SelectMethod = "PopulateProviders()"; objDS.UpdateMethod = "Update(Provider item)"; objDS.ID = "ObjectDataSource1"; I get the following error on gridview.databind() : The Select operation is not supported by ObjectDataSource 'ObjectDataSource1' unless the SelectMethod is specified. Please help

      C Offline
      C Offline
      Chetan Patel
      wrote on last edited by
      #2

      try this out objDS.SelectMethod = PopulateProviders;

      Best Regards, Chetan Patel

      M 2 Replies Last reply
      0
      • C Chetan Patel

        try this out objDS.SelectMethod = PopulateProviders;

        Best Regards, Chetan Patel

        M Offline
        M Offline
        Member 4382232
        wrote on last edited by
        #3

        Hi, thanx for the reply but it has to be a string type.

        1 Reply Last reply
        0
        • C Chetan Patel

          try this out objDS.SelectMethod = PopulateProviders;

          Best Regards, Chetan Patel

          M Offline
          M Offline
          Member 4382232
          wrote on last edited by
          #4

          Hi, thanx for the reply but it has to be a string and PopulateProviders return a list<>

          B 1 Reply Last reply
          0
          • M Member 4382232

            Hi, thanx for the reply but it has to be a string and PopulateProviders return a list<>

            B Offline
            B Offline
            Brad Bruce
            wrote on last edited by
            #5

            Did you try it? What it's looking for is the name of the function that should be executed. Brad

            M 1 Reply Last reply
            0
            • B Brad Bruce

              Did you try it? What it's looking for is the name of the function that should be executed. Brad

              M Offline
              M Offline
              Member 4382232
              wrote on last edited by
              #6

              I have tried: objDS.SelectMethod = "PopulateProviders"; //The sytax is correct here. as well as: objDS.SelectMethod = PopulateProviders(); in this instance I get the following error Cannot implicitly convert type 'System.Collections.Generic.List ' to 'string' ObjectDataSource objDS = new ObjectDataSource(); objDS.DataObjectTypeName = "VeriWeb_Administration.BusinessObjects.Provider"; objDS.TypeName = "VeriWeb_Administration.BusinessObjects.Providers"; objDS.SelectMethod = "PopulateProviders()"; objDS.UpdateMethod = "Update"; objDS.ID = "ObjectDataSource1"; Is the rest of the above code correct? I have never created an objectdatasource is code before. Thanx again

              M 1 Reply Last reply
              0
              • M Member 4382232

                I have tried: objDS.SelectMethod = "PopulateProviders"; //The sytax is correct here. as well as: objDS.SelectMethod = PopulateProviders(); in this instance I get the following error Cannot implicitly convert type 'System.Collections.Generic.List ' to 'string' ObjectDataSource objDS = new ObjectDataSource(); objDS.DataObjectTypeName = "VeriWeb_Administration.BusinessObjects.Provider"; objDS.TypeName = "VeriWeb_Administration.BusinessObjects.Providers"; objDS.SelectMethod = "PopulateProviders()"; objDS.UpdateMethod = "Update"; objDS.ID = "ObjectDataSource1"; Is the rest of the above code correct? I have never created an objectdatasource is code before. Thanx again

                M Offline
                M Offline
                Member 4382232
                wrote on last edited by
                #7

                The solution was that I needed to set the gridview.DataSource = objDS. I previously set the gridview.DataSourceID = "ObjectDataSource1" which I thought is the same. ObjectDataSource objDS = new ObjectDataSource(); objDS.DataObjectTypeName = "Provider"; objDS.TypeName = "Providers"; objDS.SelectMethod = "PopulateProviders"; objDS.UpdateMethod = "Update"; objDS.ID = "ObjectDataSource1"; The solution was that I needed to set the gridview.DataSource = objDS. I previously set the gridview.DataSourceID = "ObjectDataSource1" which I thought is the same. Everything is working nice. Thanx

                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