Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Web Forms Designer

Status
Not open for further replies.

majkinetor

Programmer
Feb 21, 2006
88
RS
I am overriding DbDataAdapter class with custom class that looks like this:

Code:
public class DbDataAdapterEx : DbDataAdapter
	{

		// Fill DataTable using DataReader as a source
		public int FillFromReader(DataTable dataTable, IDataReader dataReader)
		{
			return this.Fill(dataTable, dataReader);
		}

 		protected override RowUpdatedEventArgs CreateRowUpdatedEvent(
			DataRow          	dataRow,
			IDbCommand       	command,
			StatementType    	statementType,
			DataTableMapping	tableMapping
		) {return null;}

		protected override RowUpdatingEventArgs CreateRowUpdatingEvent(
			DataRow           dataRow,
			IDbCommand        command,
			StatementType     statementType,
			DataTableMapping  tableMapping

		) {return null;}

		protected override void OnRowUpdated (RowUpdatedEventArgs value ){}
		protected override void OnRowUpdating(RowUpdatingEventArgs value){}
	}

I am using this to class since there is protected method "Fill" that I want to use. Other methods are here because they must be overriden.

Anyway, when I put this code into Namespace for my ASPX project along with main page everything works fine and application can be compiled and executed.

But when I use "View Designer" or double click to .aspx file, the following message appear (I used copy/paste of isued dialog)


  • ---------------------------
    Microsoft Development Environment
    ---------------------------
    The file could not be loaded into the Web Forms designer. Please correct the following error and then try loading it again:

    The designer must create an instance of type 'System.Data.Common.DbDataAdapter' but it cannot because the type is declared as abstract.

    Make sure all of the classes used in the page are built or referenced in the project. Click Help for more information.
    ---------------------------
    OK Help
    ---------------------------

When I remove above class from the source I can switch to designer view.

Can anybody help me with this, give me some tip or something, since I must comment this class every time when I want to design. I tell again here, that application executes normally.

Thx.
 

DbDataAdapter is an abstract class. When you create an instance of this class in your form, make it an instance of DbDataAdapterEx rather than DbDataAdapter.

DbDataAdapterEx dbadapter1 = new DbDataAdapterEx();

NOT

DbDataAdapter dbadapter1 = new DbDataAdapterEx();



Hopefully that will get you underway.
 
I was already doing that.

It doesn't have to do with declarations. I don't have to use this class but it still troubles me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top