deva asir

deva asir

  • NA
  • 171
  • 555

i have select for gridview data showing textbox.

Jun 23 2017 1:55 AM
protected void Button5_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
int cmy_id = 0;
cmy_id = Convert.ToInt32(Request.QueryString["@cmy_id"].ToString());//Object reference not set to an instance of an object. error are display
if (!IsPostBack)
{
sel();
}
}
void sel()
{
string select = "select * from companydetail";
SqlCommand cmd = new SqlCommand(select, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
con.Close();
DataSet ds = new DataSet();
da.Fill(ds);
foreach (GridViewRow gvrow in GridView1.Rows)
{
CheckBox chck = gvrow.FindControl("CheckBox1") as CheckBox;
if (chck.Checked)
{
TextBox6.Text = ds.Tables[0].Rows[0][1].ToString();
}
}

Attachment: new_project.zip

Answers (3)