Click here to Skip to main content
15,902,926 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a grid view
in my grid view is 3 columns
1 :product id
i want add to product count field with click on the button
added value is textbox.text
how i can access textbox.text with click on the button of that row?

1 solution

Add an event to the button Button1_Click then in that click event (bubble event) you can find the control

protected void Button1_Click(object sender, EventArgs e)
GridViewRow row=((Button)sender).Parent.Parent as GridViewRow;
TextBox t=(TextBox)row.FindControl("textbox ");
//t.Text - here is your value
Share this answer
sadegh_rusta 11-Jul-12 12:05pm    
i do it
but return null value to t
Shemeer NS 11-Jul-12 13:33pm    
Is this button in the same row/ outside the grid?
Shemeer NS 11-Jul-12 14:56pm    
just remove the space, (TextBox)row.FindControl("textbox");
sadegh_rusta 11-Jul-12 13:39pm    
in the same row

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