Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Repeater - checking for null values

Reply
Thread Tools

Repeater - checking for null values

 
 
Jason
Guest
Posts: n/a
 
      09-27-2004
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.
 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      09-27-2004
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" <> wrote in message
news:3aa801c4a4b4$1168dcd0$...
> 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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB.Net - checking for Null values in DataSets =?Utf-8?B?TWFydHluIEZld3RyZWxs?= ASP .Net 4 08-07-2009 09:56 AM
requiredFieldValidater and checking for null values Andy B ASP .Net 2 04-26-2008 09:45 AM
Python checking for None/Null values Fuzzydave Python 9 08-11-2006 01:18 PM
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM
checking the null values in the database column............ Jimmy Crider ASP .Net 3 02-18-2004 01:51 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57