473,405 Members | 2,310 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,405 software developers and data experts.

Conditional Processing

In a Datagrid I have a field (<td>) in which I want to display a link if a
database field is still Null but I want to display a blank (&nbsp;) if that
DB field has a value. If I try to put the "..If ...Then..) within the TD it
simply displays that as text. I am not sure how to code this conditon? What
I am trying to accomplish is something like the following. I want to test
the "status" field for the condition.

<td>
If <%# DataBinder.Eval(Container.DataItem,"status") %> Is Null Then
<asp:HyperLink id="XX" runat="server" NavigateUrl= '<%#
"httpxyz.com/evaljudge.asp?name=" +
DataBinder.Eval(Container.DataItem,"JudgeName") + "&caption=" +
DataBinder.Eval(Container.DataItem,"Caption") + "&evalid=" + evalID %>'
Text= "Evaluate" >
</asp:HyperLink>
Else
&nbsp;
End If
</td>
Nov 18 '05 #1
2 2643
Seems your condition code would be best in the OnItemCreated event or the
OnItemDataBound event.

If e.Item.Cells(1).Value = 1 Then ...

Here's more info:
http://msdn.microsoft.com/library/de...eatedtopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
In a Datagrid I have a field (<td>) in which I want to display a link if a
database field is still Null but I want to display a blank (&nbsp;) if that DB field has a value. If I try to put the "..If ...Then..) within the TD it simply displays that as text. I am not sure how to code this conditon? What I am trying to accomplish is something like the following. I want to test
the "status" field for the condition.

<td>
If <%# DataBinder.Eval(Container.DataItem,"status") %> Is Null Then
<asp:HyperLink id="XX" runat="server" NavigateUrl= '<%#
"httpxyz.com/evaljudge.asp?name=" +
DataBinder.Eval(Container.DataItem,"JudgeName") + "&caption=" +
DataBinder.Eval(Container.DataItem,"Caption") + "&evalid=" + evalID %>'
Text= "Evaluate" >
</asp:HyperLink>
Else
&nbsp;
End If
</td>

Nov 18 '05 #2
Thanks Steve. I'll get that article and see if I can apply it.

Wayne

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:um**************@tk2msftngp13.phx.gbl...
Seems your condition code would be best in the OnItemCreated event or the
OnItemDataBound event.

If e.Item.Cells(1).Value = 1 Then ...

Here's more info:
http://msdn.microsoft.com/library/de...eatedtopic.asp
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Wayne Wengert" <wa***************@wengert.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
In a Datagrid I have a field (<td>) in which I want to display a link if a database field is still Null but I want to display a blank (&nbsp;) if

that
DB field has a value. If I try to put the "..If ...Then..) within the TD

it
simply displays that as text. I am not sure how to code this conditon?

What
I am trying to accomplish is something like the following. I want to test the "status" field for the condition.

<td>
If <%# DataBinder.Eval(Container.DataItem,"status") %> Is Null Then <asp:HyperLink id="XX" runat="server" NavigateUrl= '<%#
"httpxyz.com/evaljudge.asp?name=" +
DataBinder.Eval(Container.DataItem,"JudgeName") + "&caption=" +
DataBinder.Eval(Container.DataItem,"Caption") + "&evalid=" + evalID %>'
Text= "Evaluate" >
</asp:HyperLink>
Else
&nbsp;
End If
</td>


Nov 18 '05 #3

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

Similar topics

3
by: Porthos | last post by:
Here's yet another question. Thanks for your patience/advice. I am trying to match attributes from different paths in different files and display an attribute of the subordinate tag in the second...
8
by: Drew | last post by:
I am building an application for keeping track of user permissions here at work. I have built the interfaces, and am now working on the processing page for inserting to the database. I am having...
3
by: David Link | last post by:
Hi All, Here's a Conditional drop_table func for those interested. There was a thread on this a long time back. We do this all the time : DELETE TABLE sales; CREATE TABLE sales (...);
92
by: Raghavendra R A V, CSS India | last post by:
hie.. Do any one knows how to write a C program without using the conditional statements if, for, while, do, switch, goto and even condotional statements ? It would be a great help for me if...
1
by: Ed Chiu | last post by:
Hi, I have the following item template in a datalist: <asp:LinkButton id="lnkAction" runat="server" CommandName="Action" cssClass="TabMenu"> <%# Container.DataItem("Title") %>...
5
by: DC Gringo | last post by:
I have a simple datagrid and need to output the value of "0" (zero) if the value is null. <asp:BoundColumn DataField="clnPopulationCensus" SortExpression="clnPopulationCensus"...
2
by: Piper707 | last post by:
Hi, I need to know if there is any way of achieving conditional processing for XSD elements. --------------------------------------------------------------- <criteria></criteria> = a complex...
6
by: patrick j | last post by:
Hi I've been testing out the "Conditional Comment" for IE. This is because for my web-site I want to have two style sheets, one for IE 6 and one for other browsers. Thus I hope to have my...
37
by: at | last post by:
I would like to spark the discussion about the following syntax problem I encounter. THE PROBLEM I have a lot times the following code: for x in : if x 0: ... more code...
6
by: maxwell | last post by:
I'm trying to use the gpp utility (Gnu points to http://en.nothingisreal.com/wiki/GPP) to do conditional compilation in Python, and I'm running into a problem: the same '#' character introduces...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.