473,513 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding the anchor tag in asp.net 1.1 based on condition - help me


Hi,

I have a link that is coming from the database.Now if the link is
empty i dont want to display in datalist .How can i do that?

<td><asp:DataList id="DataList1" Runat="server"
RepeatDirection="Horizontal" RepeatColumns="3" CellPadding="5"
CellSpacing="2" Width="100%" EnableViewState="False">
<itemtemplate>
<b>
<%# DataBinder.Eval(Container.DataItem, "FIRST_NAME") %>
<%# DataBinder.Eval(Container.DataItem, "MIDDLE_NAME") %>
<%# DataBinder.Eval(Container.DataItem, "LAST_NAME") %>
</b>
<br>
<%# DataBinder.Eval(Container.DataItem, "ADDRESS1") %>
<%# DataBinder.Eval(Container.DataItem, "ADDRESS2") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "CITY") %>
<%# DataBinder.Eval(Container.DataItem, "STATE") %>
<%# DataBinder.Eval(Container.DataItem, "ZIP_CODE") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "TELEPHONE") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "EMAIL") %>
<br>
<a id="Resume" href="<%#
DataBinder.Eval(Container.DataItem, "BIO_RESUME") %>" name="Resume"
Target="_blank">click here for bio/resume</a></b>
</itemtemplate>
</asp:DataList></td>
Thanks,
Vishnu

Dec 1 '06 #1
3 2851
A quick solution is in your query return a # when the url field is
null
On 1 Dec 2006 11:21:11 -0800, "vishnu" <se****@gmail.comwrote:
>
Hi,

I have a link that is coming from the database.Now if the link is
empty i dont want to display in datalist .How can i do that?

<td><asp:DataList id="DataList1" Runat="server"
RepeatDirection="Horizontal" RepeatColumns="3" CellPadding="5"
CellSpacing="2" Width="100%" EnableViewState="False">
<itemtemplate>
<b>
<%# DataBinder.Eval(Container.DataItem, "FIRST_NAME") %>
<%# DataBinder.Eval(Container.DataItem, "MIDDLE_NAME") %>
<%# DataBinder.Eval(Container.DataItem, "LAST_NAME") %>
</b>
<br>
<%# DataBinder.Eval(Container.DataItem, "ADDRESS1") %>
<%# DataBinder.Eval(Container.DataItem, "ADDRESS2") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "CITY") %>
<%# DataBinder.Eval(Container.DataItem, "STATE") %>
<%# DataBinder.Eval(Container.DataItem, "ZIP_CODE") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "TELEPHONE") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "EMAIL") %>
<br>
<a id="Resume" href="<%#
DataBinder.Eval(Container.DataItem, "BIO_RESUME") %>" name="Resume"
Target="_blank">click here for bio/resume</a></b>
</itemtemplate>
</asp:DataList></td>
Thanks,
Vishnu
--

Bits.Bytes.
http://bytes.thinkersroom.com
Dec 1 '06 #2
Hi,
Thanks for your suggestion. I have written a function to handle this.

public string ShowLink(object row)
{
string resume=DataBinder.Eval(row,"BIO_RESUME") as string;
if(resume==null || resume.Trim().Length==0)
{
return "<p>No Data</p>";

}
else
return "<a href='<%#Container.DataItem %>' Target="_blank"'>" +
+ "View Bio Resume</a>";
}
Please let me know if this works.

Thanks,
Vishnu

Rad [Visual C# MVP] wrote:
A quick solution is in your query return a # when the url field is
null
On 1 Dec 2006 11:21:11 -0800, "vishnu" <se****@gmail.comwrote:

Hi,

I have a link that is coming from the database.Now if the link is
empty i dont want to display in datalist .How can i do that?

<td><asp:DataList id="DataList1" Runat="server"
RepeatDirection="Horizontal" RepeatColumns="3" CellPadding="5"
CellSpacing="2" Width="100%" EnableViewState="False">
<itemtemplate>
<b>
<%# DataBinder.Eval(Container.DataItem, "FIRST_NAME") %>
<%# DataBinder.Eval(Container.DataItem, "MIDDLE_NAME") %>
<%# DataBinder.Eval(Container.DataItem, "LAST_NAME") %>
</b>
<br>
<%# DataBinder.Eval(Container.DataItem, "ADDRESS1") %>
<%# DataBinder.Eval(Container.DataItem, "ADDRESS2") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "CITY") %>
<%# DataBinder.Eval(Container.DataItem, "STATE") %>
<%# DataBinder.Eval(Container.DataItem, "ZIP_CODE") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "TELEPHONE") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "EMAIL") %>
<br>
<a id="Resume" href="<%#
DataBinder.Eval(Container.DataItem, "BIO_RESUME") %>" name="Resume"
Target="_blank">click here for bio/resume</a></b>
</itemtemplate>
</asp:DataList></td>
Thanks,
Vishnu
--

Bits.Bytes.
http://bytes.thinkersroom.com
Dec 1 '06 #3
Hi,
Thanks for your suggestion. I have written a function to handle this.

public string ShowLink(object row)
{
string resume=DataBinder.Eval(row,"BIO_RESUME") as string;
if(resume==null || resume.Trim().Length==0)
{
return "<p>No Data</p>";

}
else
return "<a href='<%#Container.DataItem %>' Target="_blank"'>" +
+ "View Bio Resume</a>";
}
Please let me know if this works.

Thanks,
Vishnu

Rad [Visual C# MVP] wrote:
A quick solution is in your query return a # when the url field is
null
On 1 Dec 2006 11:21:11 -0800, "vishnu" <se****@gmail.comwrote:

Hi,

I have a link that is coming from the database.Now if the link is
empty i dont want to display in datalist .How can i do that?

<td><asp:DataList id="DataList1" Runat="server"
RepeatDirection="Horizontal" RepeatColumns="3" CellPadding="5"
CellSpacing="2" Width="100%" EnableViewState="False">
<itemtemplate>
<b>
<%# DataBinder.Eval(Container.DataItem, "FIRST_NAME") %>
<%# DataBinder.Eval(Container.DataItem, "MIDDLE_NAME") %>
<%# DataBinder.Eval(Container.DataItem, "LAST_NAME") %>
</b>
<br>
<%# DataBinder.Eval(Container.DataItem, "ADDRESS1") %>
<%# DataBinder.Eval(Container.DataItem, "ADDRESS2") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "CITY") %>
<%# DataBinder.Eval(Container.DataItem, "STATE") %>
<%# DataBinder.Eval(Container.DataItem, "ZIP_CODE") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "TELEPHONE") %>
<br>
<%# DataBinder.Eval(Container.DataItem, "EMAIL") %>
<br>
<a id="Resume" href="<%#
DataBinder.Eval(Container.DataItem, "BIO_RESUME") %>" name="Resume"
Target="_blank">click here for bio/resume</a></b>
</itemtemplate>
</asp:DataList></td>
Thanks,
Vishnu
--

Bits.Bytes.
http://bytes.thinkersroom.com
Dec 1 '06 #4

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

Similar topics

6
2531
by: R. Rajesh Jeba Anbiah | last post by:
Sometimes ago I started a thread <http://groups.google.com/groups?threadm=abc4d8b8.0404012208.76ebdba7%40posting.google.com> <Previous post> I'm supposed to hide the php extension in a file (like Yahoo! or Google). For example, http://foo.com/foo instead of http://foo.com/foo.php. I have read various articles including...
2
16542
by: splish | last post by:
Hello, I have the following problem: An Iframe exists inside a page (that has content exceeding the height, therefore scrollbars kick in) - normal stuff. When I want to use anchor references inside the Iframe the parent page is affected also, in that it jumps to the top of the iframe, as though there were an anchor at that point.
6
6639
by: Richard Brown | last post by:
Ok, I celebrate and rejoice in the Anchor property. So wonderful compared to the horrible 'resize' code I had to write in VB6, there is just no end to the wonders of VB.NET..... uh, ok..... BUT... I have a form with a lot of controls side by side, etc. The Anchor is really only useful to resize 1 control on each line (and move all the...
3
3822
by: gary | last post by:
Hi, I am trying to reference an anchor in a user control with a url. This worked in 1.1 but no longer works in 2.0. The ascx control is located in a "/include" folder If you have a hyperlink control and you assign the navigateurl property = "../#anchor" whereby you want to add this # reference to the current url the url ends up with...
5
15000
by: das | last post by:
hello all, this might be simple: I populate a temp table based on a condition from another table: select @condition = condition from table1 where id=1 in my stored procedure I want to do this: if @condition = 0
2
9912
by: rudranee | last post by:
Hi, Can i hide an anchor tag in the mailto form?so that only the receiver is able to see it. The refernce code is given here: <FORM METHOD=POST ACTION="mailto:abc@xyz.com" ENCTYPE="text/plain"> <TEXTAREA NAME="COMMENTS" ROWS="10" COLS="40" WRAP="hard"> Dear Sir/Madam, ------
3
4507
by: Joseph Gruber | last post by:
Hi all -- I have two questions. First, I'm adding a control to my form at runtime and the control/form seems to ignore the anchor property of the runtime control. Any idea how I can get a runtime control to anchor properly? Second -- the program I'm writting is supposed to look like a dos application (long story). When the application...
2
6093
by: gvrajkumar | last post by:
Hi We are developing an Ajax based application. In this application the URL is fixed and as user navigates on the application we will change Anchor on the URL so that user can bookmark the url and can load the page on demand. When user refreshes the page we have no issue in the populating the page based on the anchor in URL as on load we...
2
2469
by: sindhu | last post by:
Hello, I'm loading a frame from another frame using anchor tag. the code is as folllows. function change_page { if(document.form.txtbx1.value=="all") { document.getElementById('a_link').target="right_bottom";
27
2742
by: matt | last post by:
Hello group, I'm trying to become familiar with the information hiding design rules, and I have a lot (3) of questions for all you experts. AFAIK, a generic module has 2 files: ================ module.h ================ #ifndef __MODULE_HDR_INCLUDED__
0
7178
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7397
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. ...
0
7565
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7543
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...
0
5704
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5103
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3242
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
817
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
473
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...

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.