shibasankar behera

shibasankar behera

  • NA
  • 117
  • 101k

get tex box value inside gridview

Oct 4 2013 6:22 AM
I have placed GridView1 inside a panel in .aspx file.

here is my code behind...

foreach (GridViewRow gvrC in GridView1.Rows)
        {
            if (gvrC.Visible)
            {
                for (int x = 2; x < GridView1.Columns.Count; x++)
                {
                    foreach (Control cc in gvrC.Cells[x].Controls)
                    {
                        string str = ((TextBox)cc).Text;
                        //my code here. I want to display textbox value
                    }
                }
            }
        }

but it is not entering the 2nd foreach() loop.
plz give me the solution.
Thank You.

Answers (8)