Click here to Skip to main content
14,211,690 members
Rate this:
Please Sign up or sign in to vote.
See more:
i have a grid view
in my grid view is 3 columns
1 :product id
2:textbox
3:button
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?
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

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
}
   
Comments
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)



Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190619.2 | Last Updated 11 Jul 2012
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100