Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
Please check my code
Shovan Saha
7y
165
1
Reply
If any of row.Cells[2] or [3] is null then how can I edit this? :
if (_product.Where(x => x.Type.ToLower() == row.Cells[0].Value.ToString().ToLower()).Any())
{
string TotalQty = (Convert.ToInt32(_product.Where(x => x.Type.ToLower() == row.Cells[0].Value.ToString().ToLower()).Select(x => x.TotalQty).FirstOrDefault()) + Convert.ToInt32(row.Cells[3].Value.ToString())).ToString();
string TotalPrice = (Convert.ToInt32(_product.Where(x => x.Type.ToLower() == row.Cells[0].Value.ToString().ToLower()).Select(x => x.TotalPrice).FirstOrDefault()) + Convert.ToInt32(row.Cells[2].Value.ToString())).ToString();
_product.Where(x => x.Type.ToLower() == row.Cells[0].Value.ToString().ToLower()).ToList().ForEach(x => { x.TotalQty = TotalQty; x.TotalPrice = TotalPrice; });
}
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
how can read command argument value read with jquery & print
null/empty value problem