Create aon objectdatasource programatically
-
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
-
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
try this out objDS.SelectMethod = PopulateProviders;
Best Regards, Chetan Patel
-
try this out objDS.SelectMethod = PopulateProviders;
Best Regards, Chetan Patel
Hi, thanx for the reply but it has to be a string type.
-
try this out objDS.SelectMethod = PopulateProviders;
Best Regards, Chetan Patel
Hi, thanx for the reply but it has to be a string and PopulateProviders return a list<>
-
Hi, thanx for the reply but it has to be a string and PopulateProviders return a list<>
Did you try it? What it's looking for is the name of the function that should be executed. Brad
-
Did you try it? What it's looking for is the name of the function that should be executed. Brad
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
-
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
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