DEAR ALL, i have a little problem regarding the following code
protected void DropDownList1_SelectedIndexChanged(object sender,
EventArgs e)
{
string chknullnotnull = "";
SqlDataReader chkreader = null;
chkreader = db.GetReader("Select * from tbl_SubCat where
SId='" + DropDownList1.SelectedItem.Value + "'");
if (chkreader.Read())
{
if (chkreader[4].ToString() != null)
{
chknullnotnull = chkreader[4].ToString();
Response.Write(chknullnotnull);
}
else if (chkreader[4].ToString() == null)
{
Response.Write("null value");
}
}
when dropdownlist1's index is changed and
condition ---chkreader[4].ToString() != null--- gets right
then it do process the following line
Response.Write(chknullnotnull);
and prints the string value of chknullnotnull.
================================================== ===========
but when
condition ---(chkreader[4].ToString() == null)--- gets right
the following line is not processed and is not displayed on the page
Response.Write("null value");
================================================== ========
why (else if) is not getting called
Thanks in advance