Testimonials

What our customers are saying

"You're the best I have."


- D. Barton, Global Oracle Consulting Firm

about us

Service Delivery

Multiple ways to access M&S

M&S offers technology and process solutions through multiple offerings and vehicles. End-to-end solutions, training and mentoring, staffing, ongoing support.

read more

Effective and Efficient

Exceptional Results

M&S today reflects a rare combination of out-of-the-box thinkers, deep business acumen, enterprise architectural design/engineering, and software prowess.

contact us

From the M&S Blog...

ASP.NET HyperLink in GridView using HyperLinkField, SqlDataSource, BoundField, TemplateField, and HyperLink

I am amazed how difficult it was to find simple examples of exposing a hyperlink in an asp.net gridview control. I tried some obvious things that didn’t work at first, but I got four different approaches working that I thought I would share for others that run into this [I would assume] common need.

In my case, I wanted to hyperlink to an external site based, passing in the external url along with an ID passed in as a URL parameter.

For example: http://www.externalsite.com?myID=1234

Construct URL Inside SQL

This is old code that had the SQL query inside a SqlDataSource control, so I first thought of just adding the column there:

SELECT '<a href=&quot;http://www.externalsite.com?myID=' + CONVERT(VARCHAR,MY_FIELD) + '&quot;>Link</a>' Link, ...

By default, this rendered the actual HTML encoded hyperlink inside the grid: Link

This was easily remedied by either of the following approaches:

<Columns>
  <asp:BoundField HtmlEncode="false" DataField="Link" HeaderText="Link" SortExpression="Link" />
</Columns>

Note: The key here is HtmlEncode="false"

<Columns>
  <asp:TemplateField HeaderText="Link">
    <ItemTemplate>
      <%# Eval ("Link") %>
    </ItemTemplate>
  </asp:TemplateField>
</Columns>

Construct URL Outside of SQL

The other two approaches do not rely on the URL being generated inside the SQL, but instead leveraging the ObjectId when constructing the URL in the GridView:

<Columns>
  <asp:HyperLinkField Text="Link" Target="_blank" DataNavigateUrlFields="ObjectId" DataNavigateUrlFormatString="http://www.externalsite.com?myID={0}" />
</Columns>
<Columns>
  <asp:TemplateField>
    <ItemTemplate>
      <asp:HyperLink runat="server" Text="Link" Target="_blank" NavigateUrl='<%# "http://www.externalsite.com?myID=" + Eval("ObjectId")%>'></asp:HyperLink>
    </ItemTemplate>
  </asp:TemplateField>
</Columns>

SQL Server Management Studio Shortcut Keys

Here are quick shortcut keys I use when using SQL Sever Management Studio’s query editor (I happen to be on version 2008 R2).

  • Comment selection: CTRL-K, C (while holding CTRL)
  • Uncomment selection: CTRL-K, U (while holding CTRL)
  • New Query Editor Window: CTRL-N
  • Find: CTRL-F (F3 for next occurrence, SHIFT-F3 for previous occurrence)
  • Replace: CTRL-H
  • Word completion: ALT+RIGHT ARROW
  • List members: CTRL-SPACE
  • Next Editor Window: CTRL-TAB (previous CTRL-SHIFT-TAB) —- this works like Textpad

These are some of my favorites out of the full list of SQL Server Management Studio shortcuts published by Microsoft.

More to come in an update, but wanted to get these listed here in draft form to help my team members and perhaps others on the internet that like to have efficient text editor capabilities in the RDBMS IDEs.

Show line numbers with Tools > Options > Text Editor > All Languages > Display > Line Numbers (as below):

SharePoint Editions – Version Naming: WSS, Services, Foundation, Server, MOSS, 2003, 2007, 2010

I talk to many customers who have trouble understanding the Microsoft SharePoint versions that have existed since around 2003, so I have provided a very simple chart with the various naming conventions used in the industry.

read more