• Toll-free  888-665-8637
  • International  +1 717-220-0012
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

dmcbrier
#1 Posted : Tuesday, March 1, 2011 10:14:43 PM(UTC)
dmcbrier

Rank: Member

Joined: 8/25/2007(UTC)
Posts: 124

[color=#ffffcc>

[tr ][td ]<CODE>Line]Line 183: ' Determine the product's SiteCost depending on the site's current item
[color=red>Line 184: Dim itemCost As String = item.SiteCost.ToString("C", WebAppSettings.SiteCulture)
[/color]Line 185: ourcost.Text = itemCost
Line 186: End If</PRE>[/code][/td][/tr]</TABLE>
Any way to work nulls into this formula.... somehow?



&lt;%</FONT><FONT color=#008000][2]--Added--[/2][/color][2]&lt;[/2][2]asp[/2][2]:[/2][2]TemplateField[/2][2]HeaderText[/2][2]="Cost"&gt;
[/2]
[2]&lt;[/2][2]ItemTemplate[/2][2]&gt;</P>[/2][2]&lt;[/2][2]asp[/2][2]:[/2][2]Label[/2][2]ID[/2][2]="SiteCostField"[/2][2]runat[/2][2]="server"&gt;&lt;/[/2][2]asp[/2][2]:[/2][2]Label[/2][2]&gt;</P>[/2][2]&lt;/[/2][2]ItemTemplate[/2][2]&gt;</P>[/2][2]&lt;/[/2][2]asp[/2][2]:[/2][2]TemplateField[/2][2]&gt;</P>[/2][2]--[/2][2]'Added the following David 7-23-2010 Goal - Wanted to show cost.</P>[/2][2]Dim[/2][2]As[/2][2]"SiteCostField"[/2][2]If[/2][2]IsNot[/2][2]Nothing[/2][2]Then</P>[/2][2]' Retrieve the product corresponding to the specific line item</P>[/2][2]Dim[/2][2]As[/2][2]' Determine the product's SiteCost depending on the site's current item</P>[/2][2]Dim[/2][2]As[/2][2]String[/2][2]"C"[/2][2]End[/2][2]If</P>[/2][2]' End Added Material</P>[/2]
dmcbrier
#2 Posted : Tuesday, March 1, 2011 10:21:08 PM(UTC)
dmcbrier

Rank: Member

Joined: 8/25/2007(UTC)
Posts: 124

It work fine 90% of the time... I get the error when there is a null value.
dmcbrier
#3 Posted : Tuesday, March 1, 2011 11:09:11 PM(UTC)
dmcbrier

Rank: Member

Joined: 8/25/2007(UTC)
Posts: 124

The issue is when this is null..... How do I write an if null then statement?

Dim itemCost As String = item.SiteCost.ToString("C", WebAppSettings.SiteCulture)
ourcost.Text = itemCost


Thank you.
Marcus
#4 Posted : Wednesday, March 2, 2011 7:28:54 AM(UTC)
Marcus

Rank: Member

Joined: 11/5/2003(UTC)
Posts: 1,786

Code:

If item IsNot Nothing Then
Dim itemCost as String = item.SiteCost.ToString("C")
End If
dmcbrier
#5 Posted : Wednesday, March 2, 2011 11:19:25 AM(UTC)
dmcbrier

Rank: Member

Joined: 8/25/2007(UTC)
Posts: 124

Thank you very much. This worked great Marcus.

'Added the following - Wanted to show cost.
Dim ourcost As Label = e.Row.FindControl("SiteCostField")

If ourcost IsNot Nothing Then
'Retrieve the product corresponding to the specific line item
Dim item As Catalog.Product = Catalog.InternalProduct.FindByBvin(lineItem.ProductId)

'Determine the product's SiteCost depending on the site's current item

'Dim itemCost As String = item.SiteCost.ToString("C", WebAppSettings.SiteCulture)
'ourcost.Text = itemCost

If item IsNot Nothing Then
Dim itemCost As String = item.SiteCost.ToString("C")
ourcost.Text = itemCost
End If

End If
' End Added Material
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

©2024 Develisys. All rights reserved.
  • Toll-free  888-665-8637
  • International  +1 717-220-0012