Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 28th, 2004, 05:05 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default 'helper' function?

First, I am using an asp:DataList, which does not allow AutoGenerateColumns=”False”

dr = cmd.ExecuteReader()
lstActivePatients.DataSource = dr
lstActivePatients.DataBind()

I am returning four values from my sproc to my web page: (0) RegistrationID, (1) Registrant, (2) RegistrationDate, and (3) ConfirmationDate

In my sproc, if the ConfirmationDate IS NULL I set it equal to ‘incomplete’, so the value returned to my aspx page is either a date or ‘incomplete’

This is the code in my DataList: if Container.DataItem(3) is not null and is a date then I want the date to show as a link; if Container.DataItem(3) is null then I simply want to show the word incomplete as text.

<td><asp:Hyperlink id="lnkConfirmation" Text='<%# Container.DataItem(3) %>' NavigateUrl='<%# "PatReg_Confirmation2.aspx?id=" & Container.DataItem(0) %>' runat="server" /></td> </tr> </ItemTemplate>

Function ShowLink(val)
  If val = ‘incomplete’ Then
    ShowLink = "Incomplete"
  Else
    ShowLink = "<a href=’RegConfirmation.aspx?id=” & QUERYSTRING & “’>DATE</a>"
  End If
End Function

I don’t know how to set the QUERYSTRING = Container.DataItem(0) and DATE = Container.DataItem(3) in the Helper Function above.

Thanks in advance for any help,

John
  #2 (permalink)  
Old June 29th, 2004, 08:12 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

This should do it:

...
<%# ShowLink(Container.DataItem(0), Container.DataItem(3)) %>
</ItemTemplate>


Function ShowLink(queryString, date)
  If date = ‘incomplete’ Then
    Return "Incomplete"
  Else
    Return String.Format("<a href=’RegConfirmation.aspx?id={0}’>{1}</a>", queryString, date)
  End If
End Function

Peter
-------------------------
Work smarter, not harder
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
unistalling Browser Helper Object maricar C# 0 October 7th, 2008 08:53 PM
1 quest on view helper hiteshp Struts 0 January 28th, 2008 03:06 AM
Helper Methods & Wrapper Classes? crazy ASP.NET 2.0 Basics 0 February 9th, 2007 12:31 PM



All times are GMT -4. The time now is 09:32 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.