Last post Jun 27, 2017 09:07 AM by Kvetch
Jun 26, 2017 03:27 PM|Kvetch|LINK
I've been trying to view a locally hosted web form, and every time I "fix" one error, its because its been replaced by another.
I've gone through about twenty of them and right now its currently at
Line 10: <pages>
Line 11: <namespaces>
Line 12: <add namespace="System.Web.Optimization" />
Line 13: </namespaces>
Line 14: <controls>
I've reinstalled the required nuget packages as advised and still no difference.
For some reason web projects do not have this issue.
The only difference between web projects and webforms is that when publishing webforms, I don't have the option of a release configuration.
Normally I'd just use webprojects but I'm trying to do this tutorial
and gridview1 gives me namespace errors in web projects, but works fine in standalone websites.
Alternately, how would you edit the allproducts.cs code in the tutorial to work with web projects.
I've tried changing the namespaces, but that leads to the databind and datasource having errors
I'm very new at this, so any help would be greatly appreciated
UPDATE: got the webform working. Only took two days.
The last few steps were to install nuget packages, locate their dll files and place them in the binfolder in the website directory.
I'm still interested in how to edit the code in the tutorial for use in web projects though
Jun 26, 2017 06:01 PM|mgebhard|LINK
In web projects all the code behind files are compiled into a single dll. If you make a change to a web page you have to deploy the dll and aspx pages if the markup changed or you added code blocks to the markup.
Jun 27, 2017 08:36 AM|Deepak Panchal|LINK
you had mentioned that,"I'm still interested in how to edit the code in the tutorial for use in web projects though".
from the description of the thread , it looks like you are using the latest version of Visual Studio.
if you see the tutorial then you will find that the tutorial is too old and was published in 2006.
so you can try to inform us that what actually you want to add in your web forms and we will try to provide you latest code examples that can work with your latest visual studio.
are you having any trouble with gridview?
if yes then let us know about that we will try to provide suggestion to solve the issue.
Jun 27, 2017 09:07 AM|Kvetch|LINK
Yeah its gridview I'm having trouble with. I can an insert an object data source and have it function, but I feel like it would be useful to know how to do it via data access layers on the webform1.aspx.cs file.
If I had a functioning code I could probably reverse engineer it.
So far I have a Northwind.xsd file under an appcode folder, with a product tableadaptor. The error I get is
Severity Code Description Project File Line Suppression State
Error CS1061 'WebForm1.NorthwindTableAdapters.ProductsTableAdapter' does not contain a definition for 'GetProducts' and no extension method 'GetProducts' accepting a first argument of type 'WebForm1.NorthwindTableAdapters.ProductsTableAdapter' could be found
(are you missing a using directive or an assembly reference?) WebApplication6 c:\users\kylie\documents\visual studio 2017\Projects\WebApplication6\WebApplication6\WebForm1.aspx.cs 17 Active
public partial class WebForm1 : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
WebForm1.NorthwindTableAdapters.ProductsTableAdapter productsAdapter = new ProductsTableAdapter();
GridView1.DataSource = productsAdapter.GetProducts();
private class NorthwindTableAdapters
internal class ProductsTableAdapter
private class ProductsTableAdapter : NorthwindTableAdapters.ProductsTableAdapter
Thanks in advance