473,396 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

specifying a query string in an href dynamically

I have a control that looks something like this:

<asp:DataList ... >
<ItemTemplate ... >
<table>
<tr>
<td image src='... <%# DataBinder.Eval(Container.DataItem,
"IncidentID") %>' </td>
<a runat="server" href="somepage.aspx">some text</a>
</tr>
</table>
</ItemTemplate>
</asp:DataList>

The image is rendered via a custom HttpHandler. What I want is to put
in a query string following the page reference in the href, something like

href="somepage.aspx?IncidentID=<somevalue>"

where <somevalue> would be computed. I tried putting
<%#DataBinder.Eval(Container.DataItem, "IncidentID")%> inside the href,
following the "IncidentID=", but it did not get evaluated. I assume
that there must be a very simple way of doing this (or its equivalent).
Can someone clue me in?
Nov 25 '05 #1
1 2743
Hi Robert,

I believe you can do it in this way:

<asp:hyperlink
NavigateURL='<%# "/somepage.aspx?IncidentID="+
DataBinder.Eval( Container.DataItem, "IncidentID" )%>'
Text='<%# DataBinder.Eval( Container.DataItem,"Some
text" )%>'
runat="server"/>

Hope that helps

Henry

Robert Rotstein wrote:
I have a control that looks something like this:

<asp:DataList ... >
<ItemTemplate ... >
<table>
<tr>
<td image src='... <%# DataBinder.Eval(Container.DataItem,
"IncidentID") %>' </td>
<a runat="server" href="somepage.aspx">some text</a>
</tr>
</table>
</ItemTemplate>
</asp:DataList>

The image is rendered via a custom HttpHandler. What I want is to put
in a query string following the page reference in the href, something like

href="somepage.aspx?IncidentID=<somevalue>"

where <somevalue> would be computed. I tried putting
<%#DataBinder.Eval(Container.DataItem, "IncidentID")%> inside the href,
following the "IncidentID=", but it did not get evaluated. I assume
that there must be a very simple way of doing this (or its equivalent).
Can someone clue me in?

Nov 25 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Carl Gilbert | last post by:
Hi I am working on a site to provide displaying and navigation of images from several groups and have the following code that changes to displayed gif based on the query string passed in: ...
8
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) {...
2
by: Aaron C | last post by:
This is kindof a newbie question, so please bear with me... I need to pass the selected option of a <select> tag into a query string, so that the page is reloaded with the selected option already...
3
by: Dr. Oz | last post by:
Hi, I am trying to read in a query string from one page and build a link to another page based on the query string. Here's the code I am using to read in the query string: <script...
5
by: Dennis | last post by:
I'm sure there is an easy way to do what I want but I'm failing to find it... I have a single web page with links back to itself with set query strings... href="?data=x" href="?data=y"
1
by: TF | last post by:
This group came through for me last time so here we go again. My page shows paint colors, brand name, product code, etc in a gridview with the background matching the paint color. Several links on...
8
siridyal
by: siridyal | last post by:
I have a wholesale website that i'm working on that shows hundreds of items that are updated from time to time. These items are kept in a mysql database with several tables. I want to let the...
3
by: pbd22 | last post by:
Hi. I need some help with structuring my query strings. I have a form with a search bar and some links. Each link is a search type (such as "community"). The HREF for the link's anchor looks...
11
by: julie.siebel | last post by:
I'm working on a rather complex booking system for building European trips, in a combination of SQL/VBScript/Javascript. There are tons of query string variables that get passed back and forth...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.