Hey there,
Since you haven't mentioned at which line you are getting this exception (you can try debugging and find out), so after looking at your code, I think it could be one of these problems:
If the Exception is coming when the page is loaded it could be either this line:
myname = Request.QueryString["uname"].ToString();
if the your page is not getting
uname
QuertString, then
ToString()
will cause that Exception.
Or
It could be any of the lines containing this type of statement:
GridView1.Rows[0].Cells[0].Text
You should check whether the
GridView
contains atleast one row before executing any line like this because if it doesn't
Rows[0]
can cause that exception, use:
if(GridView1.Rows.Count > 0){}
to wrap these statements in.
Hope it helps.
Azee...