Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
Updating WebGrid gives, The data source 'ObjectDataSource1' only supports a single view named 'DefaultView' error
posted

Hi,

 I'm trying to use the WebGrid to Update and Insert rows in a database using an ObjectDataSource.  I created a very basic page using the information found in Infragistics Help located here. Binding WebGrid to an Object Data Source And I made sure all the checkboxes to create the Update, Insert, and Delete statements were checked.

 I have set the DataKeyField property in both the UltraWebGrid and UltraGirdBand tags to the ID field for the table I'm trying to update.  And I have set all the Allow Updating, Inserting and Adding properties to 'Yes'.

 After doing this I'm able to compile and run the page and it displays the data in the table.  I am able to press the add new row button and the grid displays a new blank row at the bottom of the grid.  Here's where the problems begin.  After entering data into the new row I've tried these methods.

  1. I added a button to the page to cause a PostBack.   The data does not get inserted into the database and I get the following error: ERROR: The data source 'ObjectDataSource1' only supports a single view named 'DefaultView'. You may also leave the view name (also called a data member) empty for the default view to be chosen.
    Parameter name: viewName
  2. I added the OnAddRow="UltraWebGrid1_AddRow" to the <igtbl:UltraWebGrid> tag. And set up the 'UltraWebGrid1_AddRow" method to handle the event (I haven't put any code in the method yet).  Now as soon as I click the button to create my new blank row I get the following error.  I don't even get a chance to enter anything into the cells. ERROR: The data source 'ObjectDataSource1' only supports a single view named 'DefaultView'. You may also leave the view name (also called a data member) empty for the default view to be chosen.
    Parameter name: viewName
  3. I removed OnAddRow="UltraWebGrid1_AddRow" from the <igtbl:UltraWebGrid> tag and instead tired adding the event in Page_Load like this: UltraWebGrid1.AddRow += new Infragistics.WebUI.UltraWebGrid.AddRowEventHandler(UltraWebGrid1_AddRow); This yielded the same error.

If anyone here knows what I need to do to fix this error so I can update and insert with the WebGrid using an ObjectDataSource, I'd be most thankful for a response.  I spent a lot of time looking for a simple example of updating and inserting using WebGrid with an ObjectDataSource but have but have been unable to find any sample code. 

 I'm using

SQL Server 2005, VS 2005 (C#), NetAdvantage for .NET 2008 Vol. 2 and I have installed the NetAdvantage for .NET 2008 Vol. 2 Hot Fix.