# Monday, 11 June 2007

Several Belgian user groups, BIWUG, VISUG, SQLUG, IT-Talks, and Pro-Exchange, will be having a community day on juni 28th. If you're living in Belgium, eager to learn, and just want to talk to peers or have the opportunity to meet new people with the same interests, be sure to check it out!

I also would've loved to come but due to obligations at work I'm unable to attend.

Grz, Kris.

Monday, 11 June 2007 21:25:02 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Saturday, 09 June 2007

Find the latest 3 issues here as a pdf document: http://www.aspnetpro.com/PDF/asp_PDF_3Mags.asp.

Grz, Kris.

Saturday, 09 June 2007 20:05:35 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 

I see that question appearing on the ASP.NET forums over and over again so I decided to dedicate a post on the subject. There are, depending on the .NET framework properties available that can help one out:

Grz, Kris.

Saturday, 09 June 2007 19:02:12 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, 28 May 2007

Normally you have the possibility to choose Enable Selection in the Smart tag of a GridView control. This results in an extra column in front of the GridView with the text Select. But what if you don't want it like that but want to be able to use an image for example to select that row?

Well, a neat solution's to add a TemplateField and in the ItemTemplate place an ImageButton control. Why this one? Because it has a CommandName property available you can use. All you have to do is to set it to the predefined word Select.

Here's a small example to show what I mean:

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" /> <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" /> <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /> <asp:TemplateField> <ItemTemplate> <asp:ImageButton ID="ImageButton1" CommandName="Select" runat="server"
ImageUrl="../App_Themes/Black/Images/bullet-1.gif" /> </ItemTemplate> </asp:TemplateField> </Columns> <SelectedRowStyle BackColor="Red" /> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT [LastName], [FirstName], [Title] FROM [Employees]"></asp:SqlDataSource> </div> </form> </body> </html>

Grz, Kris.

Monday, 28 May 2007 15:46:12 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Sunday, 27 May 2007

Since recently the ASP.NET forums got an upgrade to the new Community Server 2007 there's also the possibility to show your Fans and Friends. Not really much at the moment since the feature's a little unknown by most members at this moment and you have to enable some parts in your Profile.

If you're a member reading this you can enable it by clicking on the Edit Profile button in the right upper corner, navigate to the Favorites tab and check the Share Friends checkbox and hit save at the bottom of that page. After that it's easy to add friends by going to their public profile of a member you see on the forums or, if you know their nickname, navigate directly to http://forums.asp.net/members/nickname.aspx. So for me that becomes http://forums.asp.net/members/XIII.aspx.

Then click the Add as friend link and go back to your public profile and voila, the person appears in your friends list.

Grz, Kris.

Sunday, 27 May 2007 11:22:24 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [4]  | 

When you start creating a new ASP.NET 2.0 site with Visual Studio 2005 or Visual Web Developer Express (VWD) and want to start using it you'll notice that a new file in the App_Data folder gets created besides your own database, namely the aspnetdb.mdf file. This extra database holds all the tables and stored procedures to let Membership, Roles, Profile etc run smoothly.

However a problem arises when you don't want to use that dedicated new database when you want to deploy to your live webserver, certainly not when you use a host that only offers one database and charges you extra for another database. Luckely you can control things more when using the dedicated aspnet_regsql tool that ships with the .NET 2.0 framework.

What I'm about to describe in this article is how to use that tool to generate a SQL script that you can use to run on your other database with a tool like SQL Server Management Studio (SSMS). In this example I'll be using the installed Northwind database on my localhost developer machine.

Just start up a new DOS box by going to Start | Run and type in cmd followed by enter. In Windows Vista you push the blue windows logo button and in the field with the text Start Search you type in cmd followed by ctrl + shift + enter. The reason for that combination is that you must run it under Admin privileges or else the to be generated file doesn't get writed to disk.
A new DOS box will appear and you just navigate to the following directory/folder:

Windows\Microsoft.NET\Framework\v2.0.50727\

If you're not used to using DOS you can navigate to it by typing this in the DOS box: cd \windows\Microsoft.net\framework\v2.0.50727 followed by enter.

Then you type in this line: aspnet_regsql.exe -E -S localhost -d Northwind -A all -sqlexportonly c:\membership.sql again followed by enter. At the location c:\ a new file gets generated: membership.sql.

The Northwind name in the parameter list is later on used to set the db name in the generated sql file: SET @dbname = N'Northwind'

Once generated you can use/tweak this file to be used in SSMS to get executed and to install everything needed in the database.

Ok, up untill now we focussed on getting everything ready on the database side but we also have to let our ASP.NET 2.0 application know that we're pointing out to another database than the default one. The solution for this is to override the default settings for the LocalSqlServer connectionstring which can be found in the machine.config file.

<add name="LocalSqlServer"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"

providerName="System.Data.SqlClient" />

To override that you open the web.config file in your application which can be normally found in the root of the application. Go to the <connectionStrings> element.

<connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="The connection string to your
                         (new) database"
providerName="System.Data.SqlClient" />
</connectionStrings>

Notice the second line where you call the remove statement. This is needed in order to be able to override the LocalSqlServer connection string!

If you're in need of a little help to get your connection string right there's a dedicated site: http://www.connectionstrings.com/.

If you're interested in creating one dedicated database for multiple applications you can also check out Scott Guthrie's post: Configuring ASP.NET 2.0 Application Services to use SQL Server 2000 or SQL Server 2005.

Grz, Kris.

Sunday, 27 May 2007 09:46:38 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Saturday, 26 May 2007

I just received my PopFly invitation. I hope to find some free time the next weeks to play around with it. In case you don't know what PopFly is, check out my previous posts about the subject:

Grz, Kris.

Technorati tags:

Saturday, 26 May 2007 10:19:59 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

Yesterday evening I attended a presentation by the Flemish conflict reporter Rudi Vranckx who's the guy that has massive knowledge about the Middle East. He just got back from Israel was is probably right getting ready to fly to Lebanon. He talked about his insights he gained through 18 years of reporting about the conflicts and it was very interesting. One of the reasons why I attended this presentation was because I know an MVP and collegue ASP.NET forums moderator who lives there.

The presentation was honest and the video material was mostly about the normal average day people out there that suffer from this ongoing conflicts. Rudi himself developed a high sympathy for a certain doctor in Irak who's trying to do research on the increasing rate of cancer patients and uranium enriched weaponry that was used during the Gulf War.

Grz, Kris.

Saturday, 26 May 2007 10:03:58 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Friday, 25 May 2007

In case you didn't notice it, the MSDN site got revamped. Actually I like the new look & feel. If you're tired of seeing the treeview on the left you can just press the "T" key to make it hiding itself.

When you hover over the parts in the breadcrumb that also shows a nice dropdown to which you can easily link to other parts. I like it!

Grz, Kris.

Friday, 25 May 2007 18:40:02 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Sunday, 20 May 2007

And this time I don't mean the song by House of pain (upon which I also danced when I was way younger :-)).

I like the second video because it was filmed in Antwerp (that's the province where I live) and because it's totally funny to see the reactions of some of the people in the crowd. The first video contains LEGO. So it must be good :-).

Enjoy!

Grz, Kris.

Sunday, 20 May 2007 13:44:25 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  |