Category Archives: Visual Web Developer 2010 Express

Could not determine a MetaTable. A MetaTable could not be determined for the data source ‘SqlDataSource1’ and one could not be inferred from the request URL. Make sure that the table is mapped to the data source, or that the data source is configured with a valid context type and table name, or that the request is part of a registered DynamicDataRoute.

Cause : For me this arrises when i inserted a new column in my gridview .

Soloution : I changed my code from “<asp:DynamicField DataField="Id" HeaderText="Id" />" to "<asp:BoundField DataField="Id" HeaderText="Id" />"

And i was sorted.


Form View error while finding its controls: Object reference not set to an instance of an object

While populating item in dropdownlist in a formview on page load i got this error

Object reference not set to an instance of an object

This error pops up when master page is used in a page with formview . In .net 4.0 and in visual developer express 2010 there is now two content place holder so its essential that correct content place holder is addressed Here is the code which wil remove the object reference error

Suppose we are finding a dropdown list in a formview to pouplate with some thing so declare one local variable of drop down list

DropDownList ddlSomething = new DropDownList();

now finding content place holder and form view

ContentPlaceHolder ph = (ContentPlaceHolder)this.Master.FindControl(“MainContent”);
FormView fv = (FormView)ph.FindControl(“FormView1”);

finding dropdownlist and adding iten to it
ddlSomething = (DropDownList)fv.FindControl(“ddlSource”);
ddlSomething.Items.Add(“Please select”);

Key is to see the content placeholder’s Id in which the ormview is placed, By addressing it correctly the issue will resolve. this post is also applicable to any version provided the contentplace holder’s name is mentioned correct.

Hope this post would save atleast some time of ppl out there.

How to compile your website in Microsoft Visual Web Developer 2010 Express

In Express versions there is not any option to compile a website, and I always wondered why. I am still wondering but here is the solution which can be applied to any express edition (2008, 2010) depending that you select the appropriate directory of .Net Framework.

1. Open Visual Web Developer Express (2008 ,2010)
2. Select Tools -> External Tools to display the External Tools dialog. If some how you cant see External Tools in the menu you will need to first select Tools -> Settings choose Expert Settings to show the External Tools option.
3. In the Title box, enter Pre-&Compile (non-updatable).
4. Click the browse button next to the Command box and browse to aspnet_compiler.exe located in the appropriate directory of your installed .net frame work. Here is the table

Versions of .NET Framework and their location of Aspnet_compiler.exe file

.NET Framework version 2.0, version 3.0, and version 3.5 (32-bit systems)

.NET Framework version 2.0, version 3.0, and version 3.5 (64-bit systems)

.NET Framework version 4 (32-bit systems)

.NET Framework version 4 (64-bit systems)

5. Click Open to add the command line for aspnet_compiler.exe.
6. Type -p “$(ProjectDir)” -v / “$(ProjectDir)\..\CompiledApp” in the argument box.
7. You can check the “Close on Exit” checkbox and click OK to add the new command to your Tools menu.

You application will be compiled in a CompiledApp folder one level up to your web application directory.

For more information about other command line arguments have a good reading of these Microsoft help links.

When compling the application again after changes or compiling any other application in the directory, you would be needed to delete all the existing file in the CompiledApp directory first i.e the CompiledApp directory should be empty each time when doing any compilation other wise it will give an error. Thanks Richard for pointing this out 🙂