i have a grid view in a web form and grid view have a label i need to find if label.text is null or not
Grid view Label value is null
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
i have a grid view in a web form and grid view have a label i need to find if label.text is null or not
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
Amit MohantyRank #112 · 20K reputationPosted Nov 15, 2022, 11:07 PM EST
You can check in OnRowDataBound event of the gridview control.
protected void OnRowDataBound(object sender, GridViewRowEventArgs e) { if (string.IsNullOrEmpty((e.Row.FindControl("yourLabel") as Label).Text)) Console.WriteLine("Empty"); else Console.WriteLine("Not empty"); }Vishal JoshiRank #377 · 6.7K reputationPosted Nov 16, 2022, 12:53 AM EST
Hello
You can try IsDBNull. please check below sample code
Thanks
tharanga sahabandu91 reputationPosted Nov 16, 2022, 3:43 AM EST
Thanks bros...
vishal & amith