I found a really cool Silverlight/Flash website that basically shows you how to do the same thing using both sets of technologies. The site is called Shine Draw. Its interesting to note that in all the projects the Silverlight projects’ file sizes were almost double in size.
Archive for the 'ASP.NET' Category
Re-usable code for a Gridview and DropdownList
Both the GridView and DropdownList server controls provided in ASP.NET have DataSource and DataBind methods. This means that you could write the same code to populate both controls with data from a database. So first you would create a method for a class like this:
public DataTable GetData()
{
string strSQL = "select * from tblTest";
using(SqlConnection myConn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyDB"].ToString()))
{
using(SqlCommand myCmd = new SqlCommand(strSQL, myConn))
{
myConn.Open();
using(SqlDataReader myReader = myCmd.ExecuteReader())
{
DataTable myTable = new DataTable();
myTable.Load(myTable);
myConn.Close();
return myTable;
}
}
}
}
And then in the codebehind for the page that contains the GridView or DropDownList controls you create a new instance of the class you created above and set the DataSource property for the control. So if you created a class called myClass your code for the Gridview would look like this:
myTestClass myClass = new myTestClass();
gvMyGrid.DataSource = myClass.GetData();
gvMyGrid.DataBind();
The only difference for the DropDownList would be setting the DataTextField and the DataValueField.
ASP.NET Navigation and Content Management
At the moment it feels like I am re-designing a navigation system that has probably already been built before. The reason for saying this is because the navigation controls provided to you by Visual Studio 2008 produce table-based layouts, which is not what I want for my website. I want my website to generate valid XHTML and use CSS for layout. So what do I need? I need a navigation system that generates valid CSS and XHTML and that is easy to administer and update without having to meddle in C#, XHTML or CSS code. How do I achieve this goal? Would I have to write my own custom navigation system? It seems so for now. The basic structure of the navigation system would allow for a maximum of three levels of navigation:
- A top level
- A second level
- A third level
The navigation system will at all times make the user aware of where they are in the website, which can be achieved with a breadcrumb navigation system. Each navigation item will display its own associated content. Second level navigation items will have top level navigation item parents and third level navigation items will have second level navigation item parents. The navigation system will also act as a source for creating the site map structure. If a visitor clicks on any item in the top navigation area then content associated with that item will be displayed and the active top level navigation item will show its active. The second level navigation items that are displayed will be associated with the top level item. If a visitor clicks any of the second level navigation items the one that is clicked will become active and content associated with the second level navigation item will be displayed and the second level navigation item that is clicked will show that is active. If the second level navigation item has third level navigation items associated with it then those items will be displayed. If a visitor clicks on the third level navigation item then that item becomes active and content for it will be displayed and that third level item shows that it is active.
The next step is to create an object-oriented design from this structure. Using an object-oriented approach would allow for easy re-use throughout. So lets say we create a class called “section” and give it the following fields:
- ParentSectionField – This will indicate if there is a parent item
- SectionField – This will indicate what the current section is
- SectionHierarchy – This will indicate where in the navigation hierarchy the section item belongs.
The other issue that is a concern for me is content management, and understanding why it is important. Content management is important because it alleviates the need to mess with the code in your website. If your website has a decent content management system you will have a consistent look and feel throughout the website and you will be able to change that look and feel with a few clicks. WordPress is a perfect example of just that. WordPress allows you to easily change themes by uploading it to a directory and by changing it in your admin panel. WordPress is a clear example of design being a layer on top of the underlying function. Content management systems are ideally defined as a layer of functionality or business logic with another layer of presentation logic on top of that. Content management systems are also characterised by its development frameworks. Development frameworks can be seen as large collections of functionality assembled into one component. ASP.NET is an example of a framework technology, because it provides a whole host of features and functionality that you do not have to re-develop to make use of. The ASP.NET Roles and Membership functionality comes to mind, and is not too difficult to implement and administer without having to write much code. The advantage of this is that these features take advantage of the framework features across the whole website. The Roles and Membership feature in ASP.NET is an example of this, because you could easily manage more than one website’s user base from a central administrator control panel. You would not have to re-code the model for each website.
The Need for Content Management
So there I was today trying to understand why the Script Manager code and the Silverlight Javascript didnt want to work together. I soon realised and figured out that in your Script Manager tag you have to specify all the references to the Silverlight Javascript files. After I did this everything worked perfectly, and I was relieved, because I wanted to use Silverlight as a feature on a project I am developing.
The Silverlight issue, though, was not the issue that occupied my mind the most. What occupied my thinking and strategising the most was to understand why content management for a website is so important, and particularly why it is important. The most important reason or benefit for that matter of content management on a website is that you can separate business logic and presentation logic and in so-doing alter the presentation logic more easily. That is the single most important benefit of content management. If you look at a content management system such as WordPress or Drupal it is easy to see that the presentation and business logic has been separated, hence the reason people are able to create themes for these content management systems and interchange them without losing the content. Content management systems present one caveat – the content is consistent but makes it difficult to implement uniquely designed pages without breaking the content management system.
Musings on ASP.NET and Silverlight
Getting ASP.NET 2.0 to run on IIS 6 is not just a case of installing the .NET redistributable package. You have to add the ASP.NET 2.0 web service extension under IIS 6.0 and then allow it to execute ASP.NET 2.0.
Another thing that some people seem to have confused is that ASP.NET 3.5 is not enabled under IIS. ASP.NET 3.5 is built on top of ASP.NET 2.0 and extends 2.0. There is no ASP.NET 3.5 under IIS. Its also interesting to note that the .NET 3.5 redistributable includes EVERYTHING. The 3.5 redistributable package is a hefty 197MB download and contains everything needed to build ASP.NET applications up to version 3.5.
Silverlight is a mime type that you have to add to IIS 6 for Silverlight websites to work, and configuring IIS 6 for Silverlight is as simple as adding three mime types.
Technology Maturity
Silverlight is not a very mature implementation but the technologies it uses for that implementation aren’t new or unknown. Sure, you have to download a plugin to view Silverlight content, but other than that the technologies that are used in Silverlight are not new. Flash uses ActionScript which closely resembles JavaScript and wonder above wonder Silverlight 1.0 and 1.1 uses JavaScript. Silverlight does use a technology set called XAML, but then again XAML looks and feels like XML. XML is not a new technology either. With Silverlight 2.0 you can use .NET Programming Languages such as C#. Again C# is not a new technology, and even though it has been around for less than 10 years its syntax is strikingly similar to Java and C++, which have been around for longer. Where is all of this coming from? Well in the week, Friday, to be exact I tested a Silverlight 1.x application on a local Intranet. I wanted to see what difficulties users might end up with if required to download the plugin. I sent the URL to a few developers and asked them to test it for me and one question that came back was “How long has this Silverlight technology been around?”, which got me thinking. Silverlight as an implementation is new, yes, but its underlying technology is not. There will be issues with the implementation, as with many technology sets, but the key for me as a developer is that I will be able to take my JavaScript, C#, XML and database skills and be able to build on them with this new technology. From a designer’s perspective Silverlight will not introduce any new technology sets either, because all the graphics elements used within WPF and Silverlight are Vector-based. The graphics elements are represented as XAML and interestingly enough you can export Adobe Illustrator files as XAML and import that directly into Expression Blend and Visual Studio 2008. Personally I think that shows great interoperability.
The point though is that in today’s development environment technology maturity may only point to an implementation specific issue, not a technology subset. The technology subsets that an implementation is focussed on will in all likelihood be a mature technology already.
Using SQL Server Authentication
So during the week I had a situation where I had to take an existing web application, that used SQL Server Express, and had to make it work with SQL Server 2005 Standard Edition. Both versions of SQL Server form part of the SQL Server SKU line of products, but their implementation in certain scenarios differ. The providers that are used to connect through your applications are the same though.
I used Visual Studio 2005 to develop the initial application, and in many ways Visual Studio is awesome but in other ways its not, and specifically with regards to SQL Server databases its not that great. Visual Studio allows you to simply drag and drop databases into your web application project, which is great for productivity, but it may cause you some headaches later on. If you have SQL Server Express running on a local machine you will note that a database created in Visual Studio will not show up in SQL Server Management Studio Express. Visual Studio creates the database for you, but it does not attach it to the SQL Server instance that you are running in SQL Server Management Studio Express. SQL Server Express uses a special mode of operation called user instancing, which means it uses accounts such as NETWORK SERVICE and ASPNET to give it rights to connect to the SQL Server Express Instance. SQL Server Express Instancing also adds a 45-75MB memory overhead.
ASP.NET Authentication
During the week I have been working with SQL Server 2005 Standard Edition and 2005 Express Edition for a website. I have specifically been looking at using SQL Server 2005 for Authentication as opposed to using the standard authentication that comes with ASP.NET when you configure an ASP.NET application in Visual Studio 2005. When you enable authentication for your website an SQL Server Express database (MDF file) is automatically created and the connection string in your web.config file is also changed to point to that SQL Server Express database.
Why is the standard authentication model not appropriate for all uses?
A couple of reasons I can think of:
- If you wanted your development environment and your application environment to work together seamlessly then you might want to consider using SQL Server Authentication, or at least get both environments to use connection strings that are similiar or the same.
- If you wanted to change or add to the fields provided by the regular membership model provided in ASP.NET and in particular have those fields stored in a proper database table.
- If you wanted to use a Database Management System other than SQL Server. Perhaps you want to use MySQL or MS Access. You can also use Active Directory and XML as an authentication model.
Reasons to like Silverlight
I have been thinking a bit and there are a few reasons I like Microsoft’s new Silverlight technology.
- One reason is that the Silverlight could potentially make the need for Windows Media Player on a host machine obsolete. During the week I removed Windows Media Player from a machine and tested a Silverlight application on it that uses video.
- Silverlight is easy to host. You simply add a mime type to IIS. You can find a guide to doing that here.
- Silverlight has a Linux implementation called Moonlight.
- Integration with Visual Studio 2008. This is an important feature for an web/application developer because your C#/VB.NET skills can be used to develop and enhance Silverlight applications. XAML plays an important role here and bridges the gap between design and development significantly.
Sites that use Silverlight
How many sites actually use Silverlight? Silverlight is a Microsoft technology that allows you to create rich and dynamic content for the web. The same Silverlight applications can also be used as desktop applications with WPF (Windows Presentation Foundation). With that in mind I Googled for sites that actually use Silverlight in a live production environment. I already knew of the Hardrock Memorabilia site that uses the Deep Zoom feature. I showed this to some people at work and they were amazed, as was I. So check it out, but be warned you will be required to install a plugin.
So are there other sites that use Silverlight? And if so, what is the quality thereof. I found a site called Nibbles Tutorials which is done entirely with Silverlight. They also have tutorials and samples that you can look at. I found a few more examples on this blog. This site uses Silverlight in a way that allows you to page through books, which is not that new. This site shows a jeep of some kind that you can rotate. Another site allows you to create a valentine’s day card. A museum also used Silverlight and the Deep Zoom effect. Vertigo are the guys who developed the Hardrock Cafe Memorabilia website. They have some Silverlight content as well including a slideshow presentation. Pyramid fashion also use Silverlight.
Pages
Archives
- November 2011 (5)
- August 2011 (1)
- July 2011 (1)
- June 2011 (3)
- May 2011 (1)
- April 2011 (11)
- March 2011 (3)
- February 2011 (5)
- January 2011 (6)
- December 2010 (2)
- November 2010 (3)
- October 2010 (2)
- September 2010 (5)
- August 2010 (4)
- July 2010 (3)
- June 2010 (7)
- May 2010 (1)
- April 2010 (6)
- March 2010 (2)
- February 2010 (1)
- January 2010 (1)
- December 2009 (2)
- November 2009 (5)
- October 2009 (26)
- September 2009 (15)
- August 2009 (2)
- July 2009 (3)
- June 2009 (1)
- May 2009 (1)
- April 2009 (3)
- March 2009 (2)
- February 2009 (3)
- January 2009 (11)
- December 2008 (13)
- November 2008 (8)
- October 2008 (10)
- September 2008 (9)
- August 2008 (13)
- July 2008 (12)
- June 2008 (9)
- May 2008 (8)
- April 2008 (6)
Categories
- 2011 (1)
- AJAX (14)
- Application Development (23)
- ASP.NET (28)
- ASP.NET MVC (8)
- Bing (1)
- Blog Action Day (1)
- Browsers (5)
- C# (62)
- Chrome (1)
- Content Management Systems (1)
- Design Patterns (1)
- DevDays (1)
- eMarketing (6)
- Facebook (4)
- Firefox (3)
- Fremus.co.za (8)
- General (48)
- Google Chrome (1)
- Information Technology (1)
- Internet Explorer (2)
- jQuery (4)
- Leadership (2)
- LINQ to XML (4)
- Microsoft (1)
- Microsoft Events (1)
- Music (1)
- News (2)
- PC Hardware (1)
- Personal (16)
- Photography (1)
- SEO (3)
- Silverlight (11)
- Software (1)
- Springboks (1)
- SQL Server 2005 (7)
- SQL Server 2008 (3)
- tech (2)
- TranceFamily (1)
- TV Series (1)
- Twitter (1)
- WCF (1)
- Web 2.0 (13)
- Web Design (9)
- Web Development (36)
- Web Search (1)
- Web Technologies (39)
- Windows Phone 7 (2)
- Windows Powershell 2.0 (1)
- Wordpress (6)
- WPF (2)
Tags
.NET Adobe Flash AJAX Armin van Buuren ASP.NET ASP.NET MVC C# concept context CSS e-Marketing Facebook Firefox 3 Fremus General Thoughts GMail Google Google Analytics Javascript jquery LINQ to XML LiveValidation Microsoft Microsoft Access Microsoft Powerpoint object-oriented Personal PHP Programming ScrewTurn wiki Silverlight Social Media Social Networking South African E-Marketing SQL Server 2005 Twitter Visual Studio 2008 WCF web-based solutions Web 2.0 Web Design web development wiki's Wordpress WPF