Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an viewstate variable containing a datatable, how can i check whether it contain any data or not, as using

Viewstate("datatable")=nothing , is giving an error
Posted
Comments
walterhevedeich 9-Feb-12 0:17am    
And what error is it giving?

Try
if (viewstate("datatable") is nothing)
 
Share this answer
 
Comments
Espen Harlinn 11-Feb-12 5:18am    
5'ed!
Abhinav S 11-Feb-12 8:39am    
Thank you Espen.
Dear Friend,

If VIewState("Test") is nothing, then this will error because there is no instantiated value to call an instance method.

If ViewState("Test") is string.empty, then this is a valid string value, but empty (not null though).

Then try to check this by
if (ViewState("Test").Equals("")) then


I hope this will help you out.

Thanks
 
Share this answer
 
Comments
Member 13831176 28-Jun-18 8:18am    
is not working have any other solution?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900