protected void Page_Load(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Server=ILLUMINATI;" + "Database=DB;Integrated Security= true");
SqlCommand comm = new SqlCommand("Select * from FileUpload where UploadedBy='"+NAME+"'",conn);
try
{
conn.Open();
SqlDataReader rdr = comm.ExecuteReader();
if (s.Equals("admin"))
{
GridView1.DataSource = rdr;
GridView1.DataBind();
}
rdr.Close();
}
catch
{
conn.Close();
}
}
У меня есть кнопка, подобная этой.
Но я не могу получить значения ячеек (метка не добавляется).
protected void Button1_Click(object sender, EventArgs e)
{
string[] FID={};
int j=0;
foreach (GridViewRow di in GridView1.Rows)
{
HtmlInputCheckBox chkBx = (HtmlInputCheckBox)di.FindControl("CheckBox1");
if ( chkBx != null && chkBx.Checked)
{
FID[j] += di.Cells[2].Text;
j++;
Label1.Text += di.Cells[2].Text;
//Label lbl = (Label)di.FindControl("Id");
//Response.Write(lbl.Text + "<br>");
}
}
}