public void binddata() { try { cn.Open(); da = new SqlDataAdapter("select to1,subject,date,mailid from sentitems where from1='" + Session["username"].ToString() + "'", cn); da.Fill(ds, "sentitems"); GridViewmail.DataSource = ds.Tables[0]; GridViewmail.DataBind(); } catch (Exception ex) { Label1.Text = ex.Message; } finally { cn.Close(); } }
protected void Button1_Click(object sender, EventArgs e) { try { cn.Open(); da = new SqlDataAdapter("select from1,subject,date,mailid from inbox where from1='" + TextBox1.Text + "'", cn); da.Fill(ds, "inbox"); GridViewmail.DataSource = ds.Tables[0]; GridViewmail.DataBind(); } catch (Exception ex) { Label1.Text = ex.Message; Label1.Visible = true; } finally { cn.Close(); } }
protected void LinkButton1_Click(object sender, EventArgs e) { LinkButton sub = (LinkButton)GridViewmail.FindControl("LinkButton1"); }