Skip to content

ASP.Net Server Control Tag For QueryString

March 26, 2009

Maybe I’m just lucky but I’ve only had to use control tags in ASP.Net apps very infrequently and I always forget how they work until I need them again.  Sherlock Holmes would say thats a good thing but I’m going to post a little example here for my own benefit. 

I LOVE the ListView control that we got in 3.5 and I’m using it alot in the dinky apps I’m banging out of late.  For this one I needed to create a little link in the grid for each row using the current querystring and the row’s ID.

<

asp:ListView ID=”lvLicenses” runat=”server” DataSourceID=”dsEmployeeLicense”>

<ItemTemplate>

<tr style=”background-color: #E0FFFF;color: #333333;“>

<td>

<a href=’EmployeeLicense.aspx?EmpID=<%=Request.QueryString[“ID”]%>&ID=<%# Eval(“ID”) %> target=”_self”>Edit</a>

</td>

Easy as pie.  mmm pie.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: