473,320 Members | 2,027 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,320 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 2637
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.