Try concatenating:
tmpString = "" & Container.DataItem("comments")
----- Original Message -----
From: "Mike Appenzellar" <[EMAIL PROTECTED]>
To: <[email protected]>
Cc: "Charles Carroll" <[EMAIL PROTECTED]>
Sent: Tuesday, December 06, 2005 9:31 AM
Subject: Re: [AspNetAnyQuestionIsOk] sending null value to function...but
not always
> Well, see my main problem is that sometimes that value could be null and
> sometimes it might not be. Is there just a way I could so something
> like <%# if
> NOT Container.DataItem("comments") is Nothing Then %> ? Every time I try
> something like that, it never works.
>
>
> On 12/5/05, Ryan Olshan <[EMAIL PROTECTED]> wrote:
>>
>> My bad. That was kind of poorly written. I meant:
>>
>>
>> <%# isThereComments(Convert.IsDBNull(Container.DataItem
>> ("comments")),
>> Container.DataItem("comments")) %>
>> </strong>
>> </td>
>> </tr>
>> </ItemTemplate>
>> </asp:Repeater>
>> </table>
>>
>>
>> Public Function isThereComments(ByVal isNull As Boolean, ByVal strValue
>> as
>> String) As String
>> Return IIf(isNull, "<br>", strValue & "<br>")
>> End Function
>>
>>
>> On 12/5/05, Ryan Olshan <[EMAIL PROTECTED]> wrote:
>> >
>> > Off the top of my head. How about:
>> >
>> > <%# isThereComments(Convert.IsDBNull(Container.DataItem
>> ("comments")),
>> > Container.DataItem("comments")) %>
>> > </strong>
>> > </td>
>> > </tr>
>> > </ItemTemplate>
>> > </asp:Repeater>
>> > </table>
>> >
>> >
>> > Public Function isThereCompany(ByVal hasValue As Boolean, ByVal
>> > strValue
>> > as String) As String
>> > Return IIf(hasValue, strValue & "<br>", "<br>")
>> > End Function
>> >
>> > Ryan
>> >
>> > On 12/5/05, Mike Appenzellar <[EMAIL PROTECTED]> wrote:
>> > >
>> > > I have a repeater. In that repeater a certain value may or not be
>> null.
>> > > My
>> > > problem is I need to send the repeater value into a function, if
>> > > there
>> > > is a
>> > > value display it otherwise display nothing. Problem is, works if I
>> cast
>> > > to
>> > > DBNULL but only if the item really is null. The code is below which
>> > > might
>> > > help.
>> > >
>> > > ------------------------------------------------
>> > >
>> > > <table width="100%">
>> > > <asp:Repeater id="customer" runat="server">
>> > > <ItemTemplate>
>> > > <tr>
>> > > <td class="body">
>> > > <strong>
>> > > <%# Container.DataItem("name")%><br>
>> > >
>> > > <%# isThereCompany(Container.DataItem("company")) %> ------AN EXAMPLE
>> > > WHERE
>> > > THE PROBLEM LIES. I COULD JUST DISPLAY THIS IN NORMAL CONTAINER BUT I
>> > > DON'T
>> > > WANT THE "<BR>"
>> > >
>> > > <%# Container.DataItem("billing_address")%><br>
>> > > <%# Container.DataItem("billing_city")%>, <%#
>> > > Container.DataItem("billing_state")%>
>> > > <%# Container.DataItem("billing_zip")%><br><hr><br>
>> > > E-Mail: <%# Container.DataItem("email")%><br>
>> > > Phone: <%# Container.DataItem("phone")%><br><hr><br>
>> > > <%# isThereShip(Container.DataItem("shipping_address"),
>> > > Container.DataItem("shipping_city"), Container.DataItem
>> > > ("shipping_state"),
>> > > Container.DataItem("shipping_zip")) %>
>> > > Card Issuer: <%# Container.DataItem("cc_type")%><br>
>> > > Name on card: <%# Container.DataItem("cc_name")%><br>
>> > > Credit Card #: <%# Container.DataItem ("cc_number")%><br>
>> > > Exp Date: <%# Container.DataItem("cc_exp")%><br>
>> > > V-Code: <%# Container.DataItem("cc_vcode")%><br><hr><br>
>> > > <%# isThereHowHear(Container.DataItem("how_hear")) %>
>> > > <%# isThereComments(Container.DataItem("comments")) %>
>> > > </strong>
>> > > </td>
>> > > </tr>
>> > > </ItemTemplate>
>> > > </asp:Repeater>
>> > > </table>
>> > >
>> > > ------------------------------------------------
>> > >
>> > > CODE BEHIND:
>> > >
>> > >
>> > > ' IF I CAST THIS AS STRING, IT ERRORS IF THERE IS NO VALUE, BUT IT
>> WORKS
>> > > IF
>> > > THERE IS NO VALUE
>> > >
>> > > Public Function isThereCompany(ByVal strValue As DBNull)
>> > > Dim strTest As String
>> > > If Not strValue Is DBNull.Value Then
>> > > strTest = strValue & "<br>"
>> > > Return strValue
>> > > Else
>> > > strTest = "<br>"
>> > > Return strTest
>> > > End If
>> > > End Function
>> > >
>> > >
>> > > [Non-text portions of this message have been removed]
>> > >
>> > >
>> > >
>> > > SPONSORED LINKS
>> > > Basic programming language<
>> http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=bnac3LCZpttb3c9FvbVU-A>
>> Computer
>> > > programming languages<
>> http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ>
>> Programming
>> > > languages<
>> http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ>
>> Java
>> > > programming language<
>> http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=PZAexF9LyXpKb3HDJSlB1g
>> >
>> > > ------------------------------
>> > > YAHOO! GROUPS LINKS
>> > >
>> > >
>> > > - Visit your group "AspNetAnyQuestionIsOk<
>> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk>"
>> > > on the web.
>> > >
>> > > - To unsubscribe from this group, send an email to:
>> > > [EMAIL PROTECTED]<
>> [EMAIL PROTECTED]>
>> > >
>> > > - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>> > > Service <http://docs.yahoo.com/info/terms/>.
>> > >
>> > >
>> > > ------------------------------
>> > >
>> >
>> >
>> >
>> > --
>> > Thank you,
>> > Ryan Olshan
>> > Website - http://www.StrongTypes.com/
>> > <http://www.strongtypes.com/><
>> http://www.strongtypes.com/>
>> > Rolog - http://blogs.dirteam.com/blogs/ryan/
>>
>>
>>
>>
>> --
>> Thank you,
>> Ryan Olshan
>> Website - http://www.StrongTypes.com/ <http://www.strongtypes.com/>
>> Rolog - http://blogs.dirteam.com/blogs/ryan/
>>
>>
>> [Non-text portions of this message have been removed]
>>
>>
>>
>> SPONSORED LINKS
>> Basic programming
>> language<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=bnac3LCZpttb3c9FvbVU-A>
>>
>> Computer
>> programming
>> languages<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ>
>>
>> Programming
>> languages<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ>
>>
>> Java
>> programming
>> language<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=PZAexF9LyXpKb3HDJSlB1g>
>> ------------------------------
>> YAHOO! GROUPS LINKS
>>
>>
>> - Visit your group
>> "AspNetAnyQuestionIsOk<http://groups.yahoo.com/group/AspNetAnyQuestionIsOk>"
>> on the web.
>>
>> - To unsubscribe from this group, send an email to:
>>
>> [EMAIL PROTECTED]<[EMAIL PROTECTED]>
>>
>> - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>> Service <http://docs.yahoo.com/info/terms/>.
>>
>>
>> ------------------------------
>>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/2jUsvC/tzNLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/