How to pass null value in label
i am trying to pass null value from
int lbpk = Int32.Parse(lbitpqty.Text);
but it is giving error input string was not in a correct format
akhter says: int lbpk = Int32.Parse(lbitpqty.Text);
lbitpqty.Text value is empty. So you are getting the error.
You need to check when lbitpqty.Text is empty then set the lbpk to zero.
Use below code.
int lbpk = !string.IsNullOrEmpty(lbitpqty.Text) ? Int32.Parse(lbitpqty.Text) : 0;
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.