Skip to main content

Posts

Showing posts from May, 2011

Visual studio keeps saying "Make sure that the class defined in this code file matches the 'inherits' attribute"

Ever time I built my ASPX c# project the build would give an error saying: "Make sure that the class defined in this code file matches the 'inherits' attribute" I check and it did, I deleted the file and recreated it and still the same problem.The compiler was talking rubbish, and it was delaying me when I was debugging. I copied and pasted the  <%@ Page  tag, and check it. Eventually I though to myself lets think out the box here. It is telling us it does not match, what are the options: The page used to have and _default the definition and somewhere in the project it is finding it (so I did a porject wide search for these, and I did find a few funnies, re built and still same friggin error. The I though lets look for a file that is also referring to the background file, I had copied and pasted a few things, perhaps that was the problem, so I did a search the the full name of the  CodeFile , and that is when I found that another page I had renamed had

Help for those looking for Custom Error Handling with ASP.NET

I have been learning about Custom Error pages and ASP.NET websites. The following seem to be a requirement: You need a Global.asax file to catch the error properly and generically, see notes below (#) You need to modify your web.config file It is a good idea to display a user friendly error screen, that at the same time notifies the webmaster somehow Here are a few links that I would recommend reading, and even using their code as a starter: Rich Custom Error Handling with ASP.NET Displaying custom error pages (offical MS site) Advanced Dotnet Tutorial: ASP.NET Custom Error Pages Sure you could have googled them yourself, but I have found a trick when searching for goodies on ASP. Enter in your search query proceeded by MSDN, and you get better results. # Some notes on Gloval.asax To add a Global.asax file to your project. Go to root of the Website, right click -> Add New Item (or menu Website->Add Item) and find the icon that says Global Application Class. Add this it

Some quick notes on ASP.net and data

Data Binding There are 3 different ways to do data binding within the data view. These can be set as part of the template: <%# Eval(…) %> - Merely writes it out, as is. The is the default when you convert to template <%# Bind(…) %> - Can be used to write it out and can do post it back in the edit scenario, allowing us to update the database <%# XPath(…) %> - used with XML datasource. To supply a XPath string so that we can query the XML to get the data suing an Xpath expression. Example : <%# Eval(“FieldName”) %> The <%# represent a databinding expression, the example above allows you to write out the value of a field that the database has. Sql Data Source A SQL data source has a datasource mode, that you can change. For readonly databases or databases that do not change that often in the asp definition change the DataSourceMode="DataReader" , this will speed up the dataaccess. The reason is that, the data is streamed rather than read in

VB.NET and C# translation

Found this site when I was looking for a something that I could quickly reference when doing dev tuts that are written in VB and I want to do them in C#. It lists line for line the VB verses the C# code. Not the classes but the declarative stuff, check it out: VB.NET and C# Comparison

A Falafal recipe that the kids loved

I finally found a good Falafel recipe, that I found the base of from VideoJug. Ingredients You need 250 g chickpeas (soaked over night is water, cover dried chickpeas with water plus two thirds) 2 cloves of garlic handful of parsley handful of coriander 1 chilli , chopped (optional, can also use powder) 2 tbsp flour ¾ tsp baking soda 1 tsp cumin 1 tsp coriander 1 ltr vegetable oil (for frying) salt / pepper (optional) blender or food processor bowls spoon tray slotted spoon saucepan or wok paper towel (for drying the balls on) Instructions Drain and purée drained chickpea until they are like breadcrumb like mixture. Add the rest of ingredients Introduce the parsley, coriander, chilli, garlic and blend until well combined. Then add the flour, the cumin, coriander (ground or seeds), the baking soda and about one and salt to taste and. Finally, add some pepper. Combine it all together thoroughly with a spoon. If it looks too dry, a few drops of water (say

AJAX let's start again

So after doing stuff using AJAX and having now clue, I decided to start again. I understood that AJAX did partial updates and it made for faster websites, since you only updated the part of the website the you wanted, rather than having to do a reload. So after looking all over for an online tutorial, I remembered that MSDN is always a good resource, for Microsoft supported tech. W3 schools may be the answer for CSS and HTML but on MSDN is good otherwise. So I found this: www.asp.net/ajax/videos . And what a great resource, the videos you could say are old, but they work (with a little tweaking so do the the code. After I have finished them I am gonna look for some cool AJAX form tools :) Some notes: The update panel has to important features:  the trigger control, for update of the panel outside the panel The update mode setting - Always or conditional, always means when all the other panels update and conditional means only when this one does If you move an item pro