0

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?

1 Answer 1

1

Does it not hit the statement, or does the statement not execute/work?
Have you tried string.IsNullOrEmpty or string.IsNullOrWhiteSpace ?

Sign up to request clarification or add additional context in comments.

1 Comment

i tried string.IsNullOrEmpty for many times and doesn't work.. finally it worked when use string.IsNullOrWhiteSpace. i am glad :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.