Thursday, November 12, 2009

Menu control problem.

So there is a bug with the menu control in .net with IE8, Chrome and Safari. There has been a patch for .net that will fix the problem.

http://code.msdn.microsoft.com/KB962351/Release/ProjectReleases.aspx?ReleaseId=2648

Menu control problem.

So there is a bug with the menu control in .net with IE8, Chrome and Safari. There has been a patch for .net that will fix the problem.

http://code.msdn.microsoft.com/KB962351/Release/ProjectReleases.aspx?ReleaseId=2648

Saturday, October 3, 2009

CSS Drop Down Menu

So I ran into a problem using Javascript to make a drop down menu that supports IE 7. Then my friend told me I could do it with pure CSS and I decided to give it a shot. Initially I ran into a problem with IE7 handling absolute positioning differently than all the other browsers. I found out that in IE7 it takes the margins of the element into account when it positions it. So it is important to set it to zero.

To see the example you can go to my site:
HTML
CSS

Friday, August 28, 2009

Getting user role ID's

Ok, so I ran into this issue when I was working on a website using ASP.net's Membership class. I wanted to get the user role ID's instead of just their string names. That way if a string name changed I wouldn't have to go and update other tables.

Anyway, I couldn't find anything on a method that does that for you but I did find an article on this site http://www.andreas-kraus.net/blog/aspnet-membership-get-the-userid-of-the-user/ , which tells you how to get the user ID. From there you can just query the aspnet_UsersInRole table in your membership db and it will return all the role id's for that user.

Tuesday, August 18, 2009

Subsonic 3 Setup

I as a new programmer had a rather difficult time setting up Subsonic in VS Pro 2008 and there-after learning the syntax. So in this post I am going to post some instructions that might be of help to me and others in the future.

First, make sure you have already created a connection string in your web.config or app.config file.

1. First you download their Zip file here.
2. Extract the files and look for the directory T4 Templates >> Active Record.
3. Inside of the Active Record directory find the file "Settings.ttinclude".
4. Open it with a text editor and change line 21 to:
const string Namespace = "your desired namespace";
5 Set the ConnectionStringName equal to your connection string's id.
6. Set the DatabaseName constant to your database's name.
7. Save Settings.ttinclude.
8. Right click on your project and add a reference to SubSonic.Core.dll. It is found under the subsonic Bianaries folder.
9. Now this is the tricky part...I saw in their instructions that I needed to copy their files into my project and then in visual studio you are supposed to right click on their template files and then click on "Run custom tool". Unfortunately I couldn't see that option when I right clicked on the files. That is because you need to place them in a class library first. So you need to right click on your solution and add another project. Make it a class library project. Then go back and add a reference to it in your main website project.
10. Now copy all of the files from subsonic's T4 Templates folder into your new class library project. You also need to create an app.config file and add the connection string again to that file. You also need to add a reference to SubSonic.Core.dll.
11. Now right click on each one of the files and click "Run custom tool".
12. Now build your class project and build the solution, you may have to clean it before it will work properly.
13. Now if you add your namespace reference you should see a bunch of new variables. It looks like Subsonic 3 generates two classes for each table. One will be named the same as your table and the other one will be your table name with "Table" on the end.

Each time you make a change to your database you will need to run the custom tool for each file and then rebuild.

A simple select statement:

MyDatabase db = new MyDatabase();
SqlQuery simpleQuery = db.select.From <actualtablename>().Where(tablenameTable.idColumn).IsEqualTo(1);
List<actualtablename> blah = simpleQuery.ExecuteTypedList <actualtablename>()

You can also use linq chained methods like this: person.find(s=>s.person_id = 10);
To create a new person row you just enter:
person p = new person();
p.person_name = "bleh";
p.save();

Thursday, August 6, 2009

VS2008 Connection issue with SQL Server 2005

So I was getting a strange error: "Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture = neutral, PublickKeyToken=89845dcd8080cc91 or one of its dependencies. The system cannot find the file specified.

Luckily I found a fix on this site:

http://www.aghausman.net/dotnet/could-not-load-file-or-assembly-microsoftsqlservermanagementsdksfc.html


He says to install the following files which can be downloaded at: http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&displaylang=en#filelist

Microsoft SQL Server System CLR Types
Microsoft SQL Server 2008 Management Objects
Microsoft SQL Server 2008 Native Client

Wednesday, July 22, 2009

Blog created.

I have created this blog with the purpose of simply documenting all of the strange bugs/fixes that I run into while developing websites.

Some of the current bugs I am working with are:

1. IE 6 and 7 z-index issues with layering elements.
There are many different solutions or hacks to work around this issue. For IE6 and 7 I simply cloned the elements from the DOM, appended them to the body and absolutely positioned them to their correct location. Since they were lower on the DOM, IE6 and 7 gave them a higher Z-index.
Another approach is to use iFrames behind the content you want to display on top. This option isn't something that is W3 XHTML 1.0 Strict complient but it works.

2. ASP.net menu control failure in IE8 and Google Chrome.
The answer to this was posted on google, you simply add the following code to the Page_Load method of your master page:


if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
{
Request.Browser.Adapters.Clear();
}

Source: Here