hi Friends,
I am substracting two dynamic parameters like this
but getting view page error,input string not in corect format.
how to do this?
hi Friends,
I am substracting two dynamic parameters like this
but getting view page error,input string not in corect format.
how to do this?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sachin SinghRank #66 · 26.2K reputationPosted Jun 28, 2022, 6:58 AM EDT
prasanna pRank #3,234 · 443 reputationPosted Jun 28, 2022, 7:04 AM EDT
Getting
@{
Convert.ToDecimal(item.TotalPrice)-Convert.ToDecimal(item.Return)
}
; expected error in the line 2 end
Sachin SinghRank #66 · 26.2K reputationPosted Jun 28, 2022, 7:07 AM EDT
prasanna pRank #3,234 · 443 reputationPosted Jun 28, 2022, 7:18 AM EDT
not getting please once check this
@foreach (var item in (ViewBag.data))
{
else if (@item.StoreName == "abc")
{
var totnet = Convert.ToDecimal(@item.TotalPriceWithTax) - Convert.ToDecimal(@item.Return);
}
@totnet
}
Sachin SinghRank #66 · 26.2K reputationPosted Jun 28, 2022, 8:16 AM EDT
Your code should be like below
@{
var totnet = 0;
}
@foreach (var item in (ViewBag.data))
{
if (item.Name=="")
{
// do something
}
else if (item.StoreName == "abc")
{
totnet = Convert.ToDecimal(@item.TotalPriceWithTax) - Convert.ToDecimal(@item.Return);
}
@totnet
}
Jignesh KumarRank #91 · 22.9K reputationPosted Jun 28, 2022, 9:01 AM EDT