freelanceprogrammers.org Forum Index » ASP
Re: sending null value to function...but not always
Joined: 06 Dec 2005
Posts: 7
Re: sending null value to function...but not always
Mike,
Just a thought..... and I am not quite and ASP.NET expert but
Doesn`t db null usually require some db action.
What if you were to create the function with (by val company as string)
And query the data base in that function....
Maybe not the most efficient way but it would work
In the function you could put
PSEUDO CODE....
If NameOfDatabase or Recordset is not dbnull then
Blah!!!
Else
Blah!!!
________________________________
From: AspNetAnyQuestionIsOk@yahoogroups.com
[mailto:AspNetAnyQuestionIsOk@yahoogroups.com] On Behalf Of Mike
Appenzellar
Sent: Monday, December 05, 2005 2:59 PM
To: aspnetanyquestionisok@yahoogroups.com
Subject: [AspNetAnyQuestionIsOk] sending null value to function...but
not always
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+l
anguages&w4=Java+programming+language&c=4&s=126&.sig=bnac3LCZpttb3c9FvbV
U-A>
Computer programming languages
<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=B
asic+programming+language&w2=Computer+programming+languages&w3=Programmi
ng+languages&w4=Java+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KV
ZQperFQ>
Programming languages
<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+prog
ramming+language&w2=Computer+programming+languages&w3=Programming+langua
ges&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+la
nguages&w4=Java+programming+language&c=4&s=126&.sig=PZAexF9LyXpKb3HDJSlB
1g>
________________________________
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:
AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com
<mailto:AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com?subject=Unsubs
cribe>
* 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]
Joined: 06 Dec 2005
Posts: 4
Re: sending null value to function...but not always
Try concatenating:
tmpString = "" & Container.DataItem("comments")
----- Original Message -----
From: "Mike Appenzellar" <mappenzellar@...>
To: <AspNetAnyQuestionIsOk@yahoogroups.com>
Cc: "Charles Carroll" <charlesmarkcarroll@...>
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 <teranetlists@...> 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 <teranetlists@...> 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 <mappenzellar@...> 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+programm
ing+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+prog
ramming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=J
ava+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ>
>> Programming
>> > > languages<
>>
http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+l
anguage&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+progr
amming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ>
>> Java
>> > > programming language<
>>
http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programmi
ng+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+p
rogramming+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:
>> > > AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com<
>> AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>> > >
>> > > - 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+lang
uages&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+pro
gramming+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:
>>
>>
AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com<AspNetAnyQuestionIsOk-unsubscr
ibe@yahoogroups.com?subject=Unsubscribe>
>>
>> - 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
>
>
>
>
>
>
Joined: 06 Dec 2005
Posts: 6
Re: sending null value to function...but not always
My function, which I have not tested and is more of a theoretical thing,
uses System.Convert.IsDBNull(). System.Convert.IsDBNull() returns a boolean
value by checking the value of a row in the database while retrieving it
for a null value. So the function below checks if it`s null, and depending
on the result, uses an IIf statemnt to return the correct result.
Public Function isThereComments(ByVal isNull As Boolean, ByVal strValue as
String) As String
Return IIf(isNull, "<br>", strValue & "<br>")
End Function
/Ryan
On 12/6/05, Bob Filipiak <bobfilipiak@...> wrote:
>
> Try concatenating:
>
> tmpString = "" & Container.DataItem("comments")
> ----- Original Message -----
> From: "Mike Appenzellar" <mappenzellar@...>
> To: <AspNetAnyQuestionIsOk@yahoogroups.com>
> Cc: "Charles Carroll" <charlesmarkcarroll@...>
> 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 <teranetlists@...> 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 <teranetlists@...> 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 <mappenzellar@...> 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+programm
ing+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+prog
ramming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=J
ava+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ
> >
> >> Programming
> >> > > languages<
> >>
>
http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+l
anguage&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+progr
amming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ
> >
> >> Java
> >> > > programming language<
> >>
>
http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programmi
ng+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+p
rogramming+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:
> >> > > AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com<
> >> AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com?subject=Unsubscribe>
> >> > >
> >> > > - 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/><
> >> http://www.strongtypes.com/>
> >> > Rolog - http://blogs.dirteam.com/blogs/ryan/
> >>
> >>
> >>
> >>
> >> --
> >> Thank you,
> >> Ryan Olshan
> >> Website - http://www.StrongTypes.com/<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+programm
ing+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+prog
ramming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=J
ava+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ>
>
> >> Programming
> >> languages<
>
http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+l
anguage&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+progr
amming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ>
>
> >> Java
> >> programming
> >> language<
>
http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programmi
ng+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+p
rogramming+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:
> >>
> >> AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com<
> AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com?subject=Unsubscribe>
> >>
> >> - 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
> >
> >
> >
> >
> >
> >
>
>
>
> 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+lang
uages&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+pro
gramming+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:
>
AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com<AspNetAnyQuestionIsOk-unsubscr
ibe@yahoogroups.com?subject=Unsubscribe>
>
> - 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/
Rolog - http://blogs.dirteam.com/blogs/ryan/
[Non-text portions of this message have been removed]
Joined: 06 Dec 2005
Posts: 9
Re: sending null value to function...but not always
You will not believe how easy my fix was!!!!!!! It was just a matter of
changing the functions back to ByVal strVal as String and then I just added
.toString to <%# isThereComments(Container.DataItem("comments").toString) %>
which I guess changed it from Null to an empty string which did exactly what
I wanted it to.
On 12/6/05, Ryan Olshan <teranetlists@...> wrote:
>
> My function, which I have not tested and is more of a theoretical thing,
> uses System.Convert.IsDBNull(). System.Convert.IsDBNull() returns a
> boolean
> value by checking the value of a row in the database while retrieving it
> for a null value. So the function below checks if it`s null, and depending
> on the result, uses an IIf statemnt to return the correct result.
>
> Public Function isThereComments(ByVal isNull As Boolean, ByVal strValue as
> String) As String
> Return IIf(isNull, "<br>", strValue & "<br>")
> End Function
>
> /Ryan
>
> On 12/6/05, Bob Filipiak <bobfilipiak@...> wrote:
> >
> > Try concatenating:
> >
> > tmpString = "" & Container.DataItem("comments")
> > ----- Original Message -----
> > From: "Mike Appenzellar" <mappenzellar@...>
> > To: <AspNetAnyQuestionIsOk@yahoogroups.com>
> > Cc: "Charles Carroll" <charlesmarkcarroll@...>
> > 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 <teranetlists@...> 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 <teranetlists@...> 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 <mappenzellar@...> 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+programm
ing+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+prog
ramming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=J
ava+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ
> > >
> > >> Programming
> > >> > > languages<
> > >>
> >
>
http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+l
anguage&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+progr
amming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ
> > >
> > >> Java
> > >> > > programming language<
> > >>
> >
>
http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programmi
ng+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+p
rogramming+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:
> > >> > > AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com<
> > >> AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com
> ?subject=Unsubscribe>
> > >> > >
> > >> > > - 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/>
> > >> > <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/>
> <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+programm
ing+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+prog
ramming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=J
ava+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ
> >
> >
> > >> Programming
> > >> languages<
> >
>
http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+l
anguage&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+progr
amming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ
> >
> >
> > >> Java
> > >> programming
> > >> language<
> >
>
http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programmi
ng+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+p
rogramming+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:
> > >>
> > >> AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com<
> > AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com?subject=Unsubscribe>
> > >>
> > >> - 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
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> > SPONSORED LINKS
> > Basic programming language<
>
http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+programm
ing+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+prog
ramming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=J
ava+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ>
> Programming
> > languages<
>
http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+l
anguage&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+progr
amming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ>
> Java
> > programming language<
>
http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programmi
ng+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+p
rogramming+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:
> > AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com<
> AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com?subject=Unsubscribe>
> >
> > - 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/>
> Rolog - http://blogs.dirteam.com/blogs/ryan/
>
>
> [Non-text portions of this message have been removed]
>
>
> ------------------------------
> 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:
>
AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com<AspNetAnyQuestionIsOk-unsubscr
ibe@yahoogroups.com?subject=Unsubscribe>
>
> - 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]
Joined: 09 Jan 2006
Posts: 17
Re: sending null value to function...but not always
Hi
Can anyone give me group id for VC++
Thnaks
AC
Arindam Chakraborty
Software Developer,
Mumbai,
India
Send instant messages to your online friends http://in.messenger.yahoo.com
[Non-text portions of this message have been removed]
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







