onclick event in data grid
-
-
-
Put a button column in your
DataGrid
and write code inItemcommand
of DataGrid. Use the parametere
in that event to find the cell value and assign it to textbox.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
hello.... this code 4 dispalying.. SqlConnection sqlConnection = new SqlConnection("server=....;User Id=sa; Password=...;Initial Catalog=....."); SqlDataAdapter sqlDataAdapter = new SqlDataAdapter("select * from emp", sqlConnection); DataSet dataSet = new DataSet(); sqlDataAdapter.Fill(dataSet); GridView1.DataSource = dataSet; GridView1.DataBind(); and u can dispaly in the text box 4 perticular nuber...details... u can wrote with in clivk event......... int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value); GridViewRow r = GridView1.Rows[e.RowIndex]; TextBox t1, t2; t1 = (TextBox)r.FindControl("TextBox1"); t2 = (TextBox)r.FindControl("TextBox2"); SqlConnection sqlConnection = new SqlConnection("server=....;User Id=sa; Password=...;Initial Catalog=....."); sqlConnection.Open(); cmd.ExecuteNonQuery(); sqlConnection.Close(); GridView1.EditIndex = -1; Bind();
Naik M