473,387 Members | 1,597 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,387 software developers and data experts.

Repeater - hyperlink

Hi everybody !
I need some advice about a repeater...
I have a repeater on a website displaying a list of hyperlinks. The
url's of these hyperlinks are all stored in a database. everything's
working just fine except if the url field in the database table is
'null'. Is there an easy way to make this check, to see if the value is
null and if so, display some information text instead of just
displaying a page with "The page cannot be displayed" message on it ?
How can I make conditions like 'if-else' within a repeater ?
i'm pretty new to .net so i would appreciate all help i can get...
Thanks

Fredrik

Nov 19 '05 #1
2 1496
Fredrik,

The most flexible way is to handle ItemDataBound event for the repeater. In
the event handler you get access to every item. You can check/set item
properties as you wish.

Eliyahu

<fr*******@hotmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Hi everybody !
I need some advice about a repeater...
I have a repeater on a website displaying a list of hyperlinks. The
url's of these hyperlinks are all stored in a database. everything's
working just fine except if the url field in the database table is
'null'. Is there an easy way to make this check, to see if the value is
null and if so, display some information text instead of just
displaying a page with "The page cannot be displayed" message on it ?
How can I make conditions like 'if-else' within a repeater ?
i'm pretty new to .net so i would appreciate all help i can get...
Thanks

Fredrik

Nov 19 '05 #2
Thanks Eliyahu !
I thought I'd had to do it through event handling somehow.
I'm just not sure how to do it. Could anyone show me some code
examples. The datasource of the repeater is a dataset with a name and a
URL field. so, how do i access each item and do the check?

i guess it has to be something like this:
but what would be the more exact code?
Private Sub rptSubjects_ItemDataBound(ByVal.......
If IsDBNull(e.Item.DataItem) Then
show info message
else
'if there is a url in the DB field for this item
use correct URLfield value
End If
End Sub

Nov 19 '05 #3

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

Similar topics

5
by: Martin Dew | last post by:
Having some problems getting a hyperlink object to work in my repeater control, It displays the text I have asked it to for the hyperlink, but it does not act as a link. My repeater code is below...
1
by: Viktor Popov | last post by:
Hi, I'm trying to do the following: I use a repeater control in ASP.NET/C# because I would like to show the content of one DataSet which is filled from SELECT QUERY. In DataSource I have the...
1
by: fredda054 | last post by:
Hi everybody ! With help from some nice people here I'm getting close to solve my problem with dbnull values in a repeater. I got it pretty much done, I just ned to fix some syntax. I get a...
0
by: Gordon Smith | last post by:
Hi, Am writing a server control which contains a repeater control. I followed the code outlined by Rachel@discussions.microsoft.com (many thanks) on the following thread: ...
5
by: Patrick.O.Ige | last post by:
I want to have a rollover image on an hyperlink inside a Repeater control but when i run the page i get "Image1 is undefined" Any ideas? I have a Hyperlink and an Image control in a repeater...
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...
2
by: Andy | last post by:
Hi, This is one of those things I thought should e easy... I'm programatically trying to set the navigateURL property in a hyperlink in the headertemplate of a repeater, but always get the...
0
by: Eugene Anthony | last post by:
The problem with my coding is that despite removing the records stored in the array list, the rptPages repeater control is still visible. The rptPages repeater control displayes the navigation...
4
by: John Kotuby | last post by:
Hi all, I am using a Repeater in conjunction with a SQLDatasource and SQL Server. One of the controls in the repeater is a HyperlLink as follows: <asp:HyperLink...
4
by: Ahmd | last post by:
I have a Repeater to which a sitemap is bound, i want to remove or hide any node while form load <asp:Repeater runat="server" ID="menu" DataSourceID="SiteMapDataSource1" EnableViewState="False">...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.