Geeks With Blogs
Bunch's Blog One day I'll have a catchy subtitle, one day July 2008 Entries
EVAL and replace
This is somewhat related to my previous post. I needed to strip out a leading character from an EVAL when I appended that value to a URL. Luckily the character was always the same, in this example an X. The solution was to simply use Replace on the EVAL and replace the X with “”. <asp:HyperLink ID="hlID" runat="server" Text='<%# EVAL("ID") %>' NavigateUrl='<%#"Default... + Replace(EVAL("ID"),"X", "") %>'/> Technorati Tags: ASP.Net ......

Posted On Wednesday, July 30, 2008 2:51 PM

NavigateUrl and EVAL
Here is how you can add a database value to the URL of a HyperLink that is in a GridView. In this example the text displayed is the same as the value added to the URL. Also the data is bound through a SqlDataSource and the “ID” value is from the output of the Select statement the SqlDataSource uses. This is a quick way to put the data in the URL without using any code in the code behind. <asp:TemplateField HeaderText="ID" > <ItemTemplate> <asp:HyperLink ID="hlID" runat="server" Text='<%# ......

Posted On Wednesday, July 30, 2008 2:45 PM

Copyright © Bunch | Powered by: