473,796 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

repeater/hyperlink & dbNULL ??

Hi everybody !

I have a little repeater/hyperlink issue I'm not sure how to solve.
I use a repeater to list subjects available at a specific school.
The datasource of this repeater is a dataset filled with info from a
SQL Server database.
All the subjects are displayed as hyperlinks, and when a user clicks a
subject it opens up a new beowser with the website specific to that
subject (ie the specific department website).

Everything is working just fine except if the URL field in the database
table is 'NULL'. then the new browser will just display the "page
cannot be displayed" message, which is pretty obvious.

What I want to do is to make a check if the specific item in the
dataset is 'null' and if so I want the user to be redirected to my
global "message page" just passing a querystring saying, "sorry, no
available url for the moment", or something like that.

I think I should use the ItemDataBound event but I'm not sure how to do
it. I've tried a few options but I can't get it to work.
Any help would be highly appreciated !

Thanks a lot !

I include the repeater code below just in case...
In the code behind I just set the datasource of the repeater and bind
it. Nothing else is going on there...

----------------------------------------------------------
<asp:repeater id="rptSubjects " runat="server">
<ItemTemplate >
<table>
<tr>
<td>
<asp:HyperLin k NavigateUrl='<% # "http://" &
Container.DataI tem("Dep_Websit eURL") %>' text='<%#
Container.DataI tem("SubjectNam e") %>' Runat="server" Target="_blank"
ID="Hyperlink1 " />
</td>
</tr>
</table>
</ItemTemplate>
</asp:repeater>
-----------------------------------------------------------

Nov 19 '05 #1
0 965

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

Similar topics

5
6690
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 but here is the snippet of my asp:hyperlink object; <asp:HyperLink NavigateUrl="authonly/clientdetails.aspx?searchID="+<%#DataBinder.Eval(Conta iner.DataItem,"CLIENTREF")%> ID="Hyperlink1"><%#DataBinder.Eval(Container.DataItem,...
8
3168
by: fredda054 | last post by:
Hi everybody ! I have a little repeater/hyperlink issue I'm not sure how to solve. I use a repeater to list subjects available at a specific school. The datasource of this repeater is a dataset filled with info from a SQL Server database. All the subjects are displayed as hyperlinks, and when a user clicks a subject, it opens up a new browser with the website specific to that subject (ie the specific department website).
1
2064
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 parse error on this code because it's not well formed. Can someone please take a look at it and try to find what I'm doing wrong...I've been staring at it for so long now I can't tell up from down. I know it has to be a "'" or a '"' somewhere...
2
1266
by: fredda054 | last post by:
I now get the following error with my repeater... short desc. of problem. I want to display hyperlinks with a repeater, but add "link not available" and disable the hyperlink if the field in DB is null. as it is now i get: "Compilation Error" "Compiler Error Message: BC30201: Expression expected"
0
1181
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: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=A69AC6CD-0A87-4A8B-A2AA-9719B731F2BE%40microsoft.com&rnum=1&prev=/groups%3Fq%3DInstantiateIn%2Brepeater%2Bevent%26ie%3DUTF-8%26hl%3Den%26btnG%3DGoogle%2BSearch I wish to extend the InstantiateIn code to...
2
2438
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 following error "Object reference not set to an instance of an object." when referencing the hypermink in the following line.. hypAuthors.NavigateUrl = "http://www.microsoft.com"
0
2575
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 link (1,2,3 so on). The code can be found in SubscriptionCart.aspx.cs. Default.aspx ------------
4
9058
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 NavigateUrl='Search.aspx?page=base&amp;searchid=<% Eval("sequence")%>' ..... As you can see I am trying to pass a QueryString evaluated at runtime. All the other Evals of DataFields in the Repeater are working just fine. However this NavigateUrl is resolving as...
4
307
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"> <ItemTemplate> <li> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Url") %>'><%# Eval("Title") %></ asp:HyperLink>
0
9683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10457
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10013
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6792
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5443
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5576
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2927
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.