Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Need to manipulate (Container.DataItem("mydbfield")) inside <itemtemplate>

Reply
Thread Tools

Need to manipulate (Container.DataItem("mydbfield")) inside <itemtemplate>

 
 
Chumley the Walrus
Guest
Posts: n/a
 
      06-07-2004
Inside a datalist, or repeater control <itemtemplate>, i'm trying to
do an If statement with objects from my recordset :


<% if (Container.DataItem("mydbfield")) <> "" then
response.write(Container.DataItem("mydbfield2"))
end if %>

...but i get a Container not declared error. It seems i can't
manipulate these "containers" inside <itemtemplates>

???
Chum
 
Reply With Quote
 
 
 
 
Scott Mitchell [MVP]
Guest
Posts: n/a
 
      06-08-2004
Chumley the Walrus wrote:
> Inside a datalist, or repeater control <itemtemplate>, i'm trying to
> do an If statement with objects from my recordset :
>
>
> <% if (Container.DataItem("mydbfield")) <> "" then
> response.write(Container.DataItem("mydbfield2"))
> end if %>
>
> ..but i get a Container not declared error. It seems i can't
> manipulate these "containers" inside <itemtemplates>


Call a "helper function" using the databinding syntax:

<ItemTemplate>
<%# SomeFunctionDefinedInCodeBehindClass(Container.Dat aItem("field")) %>
</ItemTemplate>

Then, in your code-behind class:

Public Function SomeFunctionDefinedInCodeBehindClass(value as String) as
String
If value <> "" then
Return value
End If
End Function


For an example of using a helper function in a template see:
http://datawebcontrols.com/faqs/Cust...umnValue.shtml

Happy Programming!

--

Scott Mitchell

http://www.4GuysFromRolla.com
http://www.ASPMessageboard.com
http://www.ASPFAQs.com

* When you think ASP, think 4GuysFromRolla.com!
 
Reply With Quote
 
 
 
Reply

Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Manipulate Text Properties within Specified Rectangular Inside PDF sherazam Java 0 12-30-2010 09:16 AM
Macro to manipulate chars inside string Andre C Programming 19 02-05-2010 01:01 PM
Need to manipulate a column before displaying Paul D. Fox ASP .Net Datagrid Control 2 09-23-2005 01:25 PM
To manipulate or not to manipulate Dave C++ 1 01-22-2005 10:52 PM
Manipulate Client Computer's directories Guogang ASP .Net 2 07-11-2003 06:41 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57