473,387 Members | 1,529 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.

VB asp.net hide a container.DataItem in a Repeater control

5
Hi I have a repeater control which has a series of dataBinder items. There are two that show a start date and an end date of an event. Can someone tell me if it is possible to hide the end date if it is empty or contains the same date as the startdate.

Hope this makes senses.

Thank you
Feb 19 '08 #1
2 3066
DrBunchman
979 Expert 512MB
Hi Boney,

You can call a function inside the repeater item template, passing the start date & end date and returning the HTML to display based on their values. Like this:

aspx:

Expand|Select|Wrap|Line Numbers
  1. <ItemTemplate> 
  2.     <%#CheckDate(Container.DataItem("StartDate"), Container.DataItem("EndDate"))%>
  3. </ItemTemplate>
  4.  
aspx.vb:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Function CheckDate(ByVal sStartDate As String, ByVal sEndDate As String) As String
  3. If sEndDate  = sStartDate Or sEndDate = "" Then 
  4.      Return "<td>&nbsp;</td>"
  5. Else
  6.      Return "<td>" & sEndDate & "</td>"
  7. End Function
  8.  
Does this answer your question? Let me know if it helps,

Dr B
Feb 19 '08 #2
Boney
5
Hi Boney,

You can call a function inside the repeater item template, passing the start date & end date and returning the HTML to display based on their values. Like this:

aspx:

Expand|Select|Wrap|Line Numbers
  1. <ItemTemplate> 
  2.     <%#CheckDate(Container.DataItem("StartDate"), Container.DataItem("EndDate"))%>
  3. </ItemTemplate>
  4.  
aspx.vb:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Function CheckDate(ByVal sStartDate As String, ByVal sEndDate As String) As String
  3. If sEndDate  = sStartDate Or sEndDate = "" Then 
  4.      Return "<td>&nbsp;</td>"
  5. Else
  6.      Return "<td>" & sEndDate & "</td>"
  7. End Function
  8.  
Does this answer your question? Let me know if it helps,

Dr B
Thank you so much Dr B. it works great.
Feb 19 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Chumley the Walrus | last post by:
I need to assign a variable to a record drawn from a db by way of a repeater control: <ASP:Repeater id="thedata" runat="server"> <itemtemplate> <%dim display display =...
2
by: az bij | last post by:
Hi, I have a dataset bound to a repeater and want to place some logic in my ascx file. I want to display an image link if and only if an image is available. I have tried without success...
1
by: Charlie | last post by:
Hi: Is it possible to apply formatting to above statements which insert field values into HTML when binding to a datasource using Repeater control? For example, I would like to trim trailing...
3
by: sorCrer | last post by:
Hi All, Posted after extensive searching! I have a nested repeater control as follows: (Simplified ;-)) <table> <asp:repeater id=parent onItemDataBound=createChild> <tr><td>Level...
3
by: Eric Newton | last post by:
Given databinding an array of System.Version types: Given that "SomeObject" type has a Version property: public class SomeObject { public Version Version { get; } public string Description {...
2
by: Shapper | last post by:
Hello, I have this in a Repeater on na Asp.Net page: <a href='<%# DataBinder.Eval(Container.DataItem, "link") %>'>Go</a> How to hide everything is the link field is empty? Thanks, Miguel
1
by: Shapper | last post by:
Hello, I have this code line inside an ASP.Net Repeater: <a href='<%# DataBinder.Eval(Container.DataItem, "link") %>'><%= readMore %></a> What I need to do is: 1. Show readMore value if <%#...
1
by: desmoduck | last post by:
Hey Group, I may just be suffering brain fade but I have searched around and not been able to find a solution. My difficulty: I have a datagrid that shows name, address, tel, fax and toll free...
1
by: Sully | last post by:
Hi Everyone, I am pretty new to coding in .net and need some help in showing and hiding information from a repeater control. I am calling a list of FAQ's from a Database and display both the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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.