Is there a way to get out of this error. I know it is null but i already put try catch in it why its still showing error and the condition if it is null but the error still showing that my session is null. here's my code:
try {
if ('<%=Session["Selected"].ToString()%>' == null) {
loadTimesheetgrid();
}
else {
if ('<%=Session["Selected"].ToString()%>' == 'More Than 60 Hrs') {
//call the script you will make for morethan 60 hrs
}
else {
loadTimesheetgrid();
}
}
}
catch (error) {
loadTimesheetgrid();
}
Error showing:
System.NullReferenceException: Object reference not set to an instance of an object.