jeudi 15 décembre 2016

Session conditions are not working properly

I have a scenario where I am inserting values in Gridview row. So when I insert the row for the first time. Acutally the session value is ""

But while checking like this

if (Convert.ToString(Session["RecdInfo"]) != null || Convert.ToString(Session["RecdInfo"]) != "")
    {
        if (strMode == "M")
        {
            FunFillGrid();
            DtRecdInfo = (DataTable)Session["RecdInfo"];
        }
        DtRecdInfo = (DataTable)Session["RecdInfo"];
    }
    else
    {
        BindDataTable();
    }

The condition is getting true as Instead it should get false and go inside the else part.

I tried with Session["RecdInfo"]) but still it is going inside the IF condition. any reasons why it is happening like this ?

Aucun commentaire:

Enregistrer un commentaire