Tips & Tricks for Visual Studio 2008

3. May 2010

MAP Design & Development

28. April 2010

Re-enrolled as Microsoft Registered Partner today.

Interesting new Microsoft Action Pack that I am going to order: MAP Design & Development.  Includes SQL Server, VS 2010, and MSDN.  With 15% off coupon they offer price is $365.

Available week of May 24, 2010.

Good deal!

 

 

ASP.NET , ,

Validating an asp:DropDownList selection has been made

20. March 2010

A tip for validating an item on a drop down list has been selected. 

The following shows a drop down list for selecting gender.  The initial setting is to '----'.  In order to validate that the gender has been selected, use the asp:RequiredFieldValidator and set the InitialValue = '----'. 

I tried using an asp:RegularExpressionValidator first, but had problems when there was a space in the value... 

 <asp:DropDownList ID="drpGender" width="100px" runat="server">

 <asp:ListItem Selected="True" Text="----" Value="----" />

<asp:ListItem Text="Female" Value="F" />

<asp:ListItem Text="Male" Value="M" />

</asp:DropDownList>

<asp:RequiredFieldValidator ID="rfvGender" runat="server" ErrorMessage="This field is required" ControlToValidate="drpGender" InitialValue="----"></asp:RequiredFieldValidator >

 

ASP.NET

Stylesheets for Content pages

2. March 2010

Did research on this, quickest way to implement a separate stylesheet for content page is to add an extra content placeholder in the head section of the master page. Then for each content page can set a link to the stylesheet. Note that the head section of the master page must be set to runat server. So master page has the following head section:

<head runat="server">
    <title>Master Page</title>
    <asp:ContentPlaceHolder runat="server" ID="cphHeadSection">
</asp:ContentPlaceHolder>   
</head>

Add the following to your content page:

<asp:Content ID="ContentHead" ContentPlaceHolderID="cphHeadSection" runat="server">
    <link href="ContentStyles.css" rel="Stylesheet" type="text/css" />    
</asp:Content>

ASP.NET , ,