Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 3rd, 2004, 05:42 PM
Registered User
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Repeater Question

Is there a way to get the value of the <%# Container.DataItem("DocTitle") %> ?

Because I want to test if the value is blank or not.

<% Dim TitleValue as String
   TitleValue = Container.DataItem("DocTitle") %>

The script does not work. Please help. Thanks.

 
Old June 4th, 2004, 01:22 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The easiest way to do this is to pass the value of the DataItem to a custom function:
Code:
Public Function CheckTitleValue (ByVal theValue As Object) As String
  ' Do whatever you want to do with the item here
  Return "WhatEverYouWantToReturn"
End Function
Then in your server control, change the binding code to this:

<asp:WhatEverControl Text='<%# CheckTitleValue(Container.DataItem("DocTitle")) %>'

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old June 7th, 2004, 05:43 PM
Registered User
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried your suggestion above. It give me this error: BC30451: Name 'Container' is not declared.

 
Old June 7th, 2004, 06:30 PM
Registered User
 
Join Date: Jun 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just made some minor error. Your suggestion works!!! Thanks.






Similar Threads
Thread Thread Starter Forum Replies Last Post
why do Repeater is used... kk_katepally General .NET 1 December 22nd, 2004 06:36 PM
Datalist , Datagrid, or Repeater question olambe BOOK: ASP.NET Website Programming Problem-Design-Solution 7 June 1st, 2004 01:00 PM
Repeater chiraagb ADO.NET 1 May 31st, 2004 02:35 PM





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