I have a gridview on my asp.net website. In this case, I wanna get value from the gridview row when selected. Here is my code behind when gvMyTask_RowCommand. I tried using if else condition to set specific value to my label.
string baselineStart = HttpUtility.HtmlDecode(gvrow.Cells[7].Text).ToString();
if (baselineStart == "")
lblGLobalPlanStart.Text = "NoData"; //this condition never execute
else
lblGLobalPlanStart.Text = baselineStart;
when my gridview column has data it worked for
lblGLobalPlanStart.Text = baselineStart; //store value
but when gridview column no data,this condition never execute
lblGLobalPlanStart.Text = "NoData";
is there any suggestion for this case?
Does it not hit the statement, or does the statement not execute/work?
Have you tried string.IsNullOrEmpty
or string.IsNullOrWhiteSpace
?