S
Stijn Verrept
I have this code so far:
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
Panel2.Visible = false;
Panel1.Visible = true;
Label1.Text = "Logged in as: " + Session["VisitorsName"];
sqlConnection1.Open();
sqlFilesIDAdapter.SelectCommand.Parameters["@ID"].Value =
Session["VisitorsID"];
sqlFilesIDAdapter.Fill(filesIDData1,"Files");
DataGrid1.DataBind();
}
}
private void DataGrid1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = true;
Label2.Text =
filesIDData1.Tables["Files"].Rows[DataGrid1.SelectedItem.ItemIndex]["TP_
Name"].ToString();
}
Now when I click on a row I get: 'There is no row at ' and then the
number. If I remove the !IsPostBack condition it works. Why is this?
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
Panel2.Visible = false;
Panel1.Visible = true;
Label1.Text = "Logged in as: " + Session["VisitorsName"];
sqlConnection1.Open();
sqlFilesIDAdapter.SelectCommand.Parameters["@ID"].Value =
Session["VisitorsID"];
sqlFilesIDAdapter.Fill(filesIDData1,"Files");
DataGrid1.DataBind();
}
}
private void DataGrid1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = true;
Label2.Text =
filesIDData1.Tables["Files"].Rows[DataGrid1.SelectedItem.ItemIndex]["TP_
Name"].ToString();
}
Now when I click on a row I get: 'There is no row at ' and then the
number. If I remove the !IsPostBack condition it works. Why is this?