G
Guest
in web form design (C#), I draged a datagrid onto web form, called grdFiles,
and set aotuGenerateColumns property to FALSE. Use the following to populate
data into the datagrid:
// sqlSelectCommand1
this.sqlSelectCommand1.CommandText = "SELECT ID, FileData, FileName,
ContentType, FileSize, UploadDate FROM TestFile";
this.sqlSelectCommand1.Connection = this.dbConn;
//
SqlDataReader myDataReader;
dbConn.Open();
myDataReader = this.sqlSelectCommand1.ExecuteReader();
grdFiles.DataSource = myDataReader;
grdFiles.DataBind();
myDataReader.Close();
dbConn.Close();
//On button event and handller
this.grdFiles.SelectedIndexChanged += new
System.EventHandler(this.grdFiles_SelectedIndexChanged);
private void grdFiles_SelectedIndexChanged(object sender, System.EventArgs e)
{
lblInfo.Text=System.Convert.ToString(grdFiles.SelectedIndex);
txtXML.Text=System.Convert.ToString(grdFiles.SelectedIndex);
lblInfo.Text += "test event";
}
-----------
I open a web broswer, the data is loaded onto the datagrid and pushbuton in
each row. But when I click the button, there is no message displayed.
Is there anything wrong/missing?
David
and set aotuGenerateColumns property to FALSE. Use the following to populate
data into the datagrid:
// sqlSelectCommand1
this.sqlSelectCommand1.CommandText = "SELECT ID, FileData, FileName,
ContentType, FileSize, UploadDate FROM TestFile";
this.sqlSelectCommand1.Connection = this.dbConn;
//
SqlDataReader myDataReader;
dbConn.Open();
myDataReader = this.sqlSelectCommand1.ExecuteReader();
grdFiles.DataSource = myDataReader;
grdFiles.DataBind();
myDataReader.Close();
dbConn.Close();
//On button event and handller
this.grdFiles.SelectedIndexChanged += new
System.EventHandler(this.grdFiles_SelectedIndexChanged);
private void grdFiles_SelectedIndexChanged(object sender, System.EventArgs e)
{
lblInfo.Text=System.Convert.ToString(grdFiles.SelectedIndex);
txtXML.Text=System.Convert.ToString(grdFiles.SelectedIndex);
lblInfo.Text += "test event";
}
-----------
I open a web broswer, the data is loaded onto the datagrid and pushbuton in
each row. But when I click the button, there is no message displayed.
Is there anything wrong/missing?
David