BV Commerce Forum
»
BV Commerce Support
»
General Support
»
Trying to add cost to ViewOrder.aspx --- So we can see at the time of order processing.
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?
<%</FONT><FONT color=#008000][2]--Added--[/2][/color][2]<[/2][2]asp[/2][2]:[/2][2]TemplateField[/2][2]HeaderText[/2][2]="Cost"> [/2][2]<[/2][2]ItemTemplate[/2][2]></P>[/2][2]<[/2][2]asp[/2][2]:[/2][2]Label[/2][2]ID[/2][2]="SiteCostField"[/2][2]runat[/2][2]="server"></[/2][2]asp[/2][2]:[/2][2]Label[/2][2]></P>[/2][2]</[/2][2]ItemTemplate[/2][2]></P>[/2][2]</[/2][2]asp[/2][2]:[/2][2]TemplateField[/2][2]></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]
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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
|
|
|
|
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.