Click here to Skip to main content
15,915,764 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
im having datas in gridview in that i have one button if i click that button the datas of that particular id should be shown in textbox there we can edit and update in database plz help me.
Posted

1 solution

hi ,
try this
C#
protected void gh1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
  {
      txt1.Text = gh1.Rows[e.NewSelectedIndex].Cells[2].Text;
  }

Best Regards
M.Mitwalli
 
Share this answer
 
Comments
dineshdena 8-Apr-12 21:47pm    
great sir its working perfectly thanku thanku thanku
dineshdena 8-Apr-12 22:09pm    
if i need to update the value in the textbox to database means how to do sir
Mohamed Mitwalli 9-Apr-12 1:13am    
Hi ,
SqlConnection con = new SqlConnection(@"Data Source=.;Initial Catalog=test;Integrated Security=True");
string statment = string.Format("update Items set item_name ='{0}' ", txt_itemName.Text);
SqlCommand cmd = new SqlCommand(statment, con);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
Hope it help you
dineshdena 9-Apr-12 1:15am    
thanku sir its realy helped me thanku...
Mohamed Mitwalli 9-Apr-12 1:26am    
your welcome dineshdiku :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900