ASP.Net Server Control Tag For QueryString
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.