J
Jeff
Hey
asp.net 2.0
The line "int selectedID =
Convert.ToInt32(gvQuestions.SelectedDataKey.Value.ToString());" in the code
below gives an NullReferenceException (Object reference not set to an
instance of an object.)
protected void gvQuestions_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
int selectedID =
Convert.ToInt32(gvQuestions.SelectedDataKey.Value.ToString());
if (Request.QueryString["question"] == null)
{
Response.Redirect(Request.Url.ToString() + "?id=" +
selectedID.ToString());
}
else
{
}
}
catch (Exception exception)
{
System.Diagnostics.Debug.WriteLine(exception.Message.ToString());
}
}
Any ideas what I'm doing wrong here?
asp.net 2.0
The line "int selectedID =
Convert.ToInt32(gvQuestions.SelectedDataKey.Value.ToString());" in the code
below gives an NullReferenceException (Object reference not set to an
instance of an object.)
protected void gvQuestions_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
int selectedID =
Convert.ToInt32(gvQuestions.SelectedDataKey.Value.ToString());
if (Request.QueryString["question"] == null)
{
Response.Redirect(Request.Url.ToString() + "?id=" +
selectedID.ToString());
}
else
{
}
}
catch (Exception exception)
{
System.Diagnostics.Debug.WriteLine(exception.Message.ToString());
}
}
Any ideas what I'm doing wrong here?