473,320 Members | 1,845 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.

Repeater - checking for null values

I am using a repeater to display my search results (see
snippet below). If the DataItem is null, I don't want to
display the hyperlink text (Open Survey). Can I do an
If..Then right in the aspx page to check for a null or
blank value? I would much rather do this in the code-
behind if possible.
....
<td><asp:HyperLink NavigateUrl='<%# Databinder.Eval
(Container.DataItem, "Survey") %>' Runat="server"
ID="hypSurvey">Open Survey</asp:HyperLink></td>
....

Thanks.
Nov 18 '05 #1
1 2788
Jason,
You should/can do this in codebehind, hook into the ItemDataBound event of
the repeater, it'll fire for each <itemTemplate> you'll have access to
e.Item.DataItem which you can cast to a DataRowView (my guess is that's what
you need). At that point you can access your fields, like

HyperLink h = (HyperLink) e.item.FindControl("hypSurvey");
h.visible = false;

or something similar..

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Jason" <an*******@discussions.microsoft.com> wrote in message
news:3a****************************@phx.gbl...
I am using a repeater to display my search results (see
snippet below). If the DataItem is null, I don't want to
display the hyperlink text (Open Survey). Can I do an
If..Then right in the aspx page to check for a null or
blank value? I would much rather do this in the code-
behind if possible.
...
<td><asp:HyperLink NavigateUrl='<%# Databinder.Eval
(Container.DataItem, "Survey") %>' Runat="server"
ID="hypSurvey">Open Survey</asp:HyperLink></td>
...

Thanks.

Nov 18 '05 #2

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

Similar topics

0
by: Jim French | last post by:
I have a page that takes a comma delimited string and needs to bind to a Repeater control. The string is split into an Array, and each value is put into a DataBase query via a For Each loop. The...
1
by: Neil | last post by:
Hi, I have a repeater object which is bound to a dataset, the repeater has one item template which contains dropdowns, checklist, text boxes etc. After the repeater has rendered the user can...
4
by: huzz | last post by:
I am trying to access a DropDownList control inside a repeater using ItemCommand as shown below but for some reason i can't access the DropDownList. When i step through the debug i get <undefine...
3
by: Andrew | last post by:
Hi, I am working on a questionnaire. I have displayed a questionnaire using a repeater control. The itemtemplate is as below (quite cut down): <ItemTemplate> <tr><td> <%#...
8
by: Alan Silver | last post by:
Hello, I have a repeater that has code like this... <ItemTemplate> <asp:CheckBox ID="chkDelete" Text="" RunAt="server"/> .... other stuff goes here </ItemTemplate> There is a button below...
9
by: Jaybuffet | last post by:
my aspx has something like this <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>' showItem="true"/> </ItemTemplate>...
4
by: Brad Baker | last post by:
I'm going a little crazy :) I'm trying to bind a repeater control to a dataset on page load using the following code: if (Request.QueryString != null) { string customerid = Request.QueryString;...
2
by: Mike Cain | last post by:
Hi, The Repeater control seems like exactly what I want to output rows of data from my database. However I need to do some manipulation to the data prior to it being output and I'm not...
7
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...
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...

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.