473,399 Members | 3,401 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,399 software developers and data experts.

string problem

I am using the following statement in my repeater control.

<%# "if(" + int.Parse(Eval("RegistrationID").ToString()) + "!=" +
int.Parse(Session["id"].ToString()) + "{<a
href=SubscriptionCart.aspx?GroupID=" + Eval("RegistrationID") +
">Subscribe</a>}" %>

The problem is it appears as:

if(1!=1{Subscribe}
How do I solve the problem?

Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***
Feb 10 '07 #1
1 969
The problem here is that your code is just creating a literal string
representing the code you want to execute, not "Code that gets executed".
Better to use a method in your codebehind:

protected string FigureItOut( object regId, object sessId)
{
// do your logic here and return the correct string representing the href
value

}

You can refer to this with:

<%# FigureItOut(Eval("RegistrationId"), Session["id"]) %>


Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Eugene Anthony" wrote:
I am using the following statement in my repeater control.

<%# "if(" + int.Parse(Eval("RegistrationID").ToString()) + "!=" +
int.Parse(Session["id"].ToString()) + "{<a
href=SubscriptionCart.aspx?GroupID=" + Eval("RegistrationID") +
">Subscribe</a>}" %>

The problem is it appears as:

if(1!=1{Subscribe}
How do I solve the problem?

Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***
Feb 10 '07 #2

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

Similar topics

18
by: Steve Litvack | last post by:
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
4
by: MooMaster | last post by:
After some google searching on the forum I couldn't find any topics that seemed to relate exactly to my problem, so hopefully someone can help me out... I'm running python 2.4.1 on a local Win2K...
6
by: tommaso.gastaldi | last post by:
Hi, does anybody know a speedy analog of IsNumeric() to check for strings/chars. I would like to check if an Object can be treated as a string before using a Cstr(), clearly avoiding the time...
1
Atli
by: Atli | last post by:
The following small HowTo is a compilation of an original problem in getting some cookie-values through different methods of string-handling. The original Problem was posted as follows: As...
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.