0
votes

I have a gridview and within it there is also another gridview as a templete filed, inside the nest gridview there is a textbox as a templete filed, now there is another button on nested grid too, when ever i press the button and i try to get the textbox value it's always empty, am i doing anything wrong ?

2
Please post your code, or else we won't know if you are doing anything wrong. - Curtis
I made a stupid mistake, each time i click the button on the grid a postback is triggered and since i fill my gridview at pageload, the gridview is blinded again and thus all values inside the grid is gon. - yahya kh
@Neha's answer seems to be the way out. - everton

2 Answers

4
votes

onload use

 if(!ispostback)
//bind grid
1
votes

You can try as below code format in Page_Load event:

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    { 
        gridView.DataSource = yourDataSource;
        gridView.DataBind();
    }
}