Retreiving data from grid view cell to a text box

Posted by Bader on Stack Overflow See other posts from Stack Overflow or by Bader
Published on 2010-12-22T15:51:45Z Indexed on 2010/12/22 15:54 UTC
Read the original article Hit count: 210

Filed under:
|
|

Hello , i am trying to retrieve a cell data to a textbox , that will happen when i select any row in the grid view , the textbox will take the new value

i already enabled auto post back to the textbox

here is my code

protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
{

    TextBox3.Text = GridView2.Rows[GridView2.SelectedIndex].Cells[2].Text;
}

however , there is not error in the syntax , it doesn't retrieve any thing in the textbox , any suggestions ?

i am using

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data.Sql;

i work in C# , Visual studio 2010 express web developer

© Stack Overflow or respective owner

Related posts about c#

Related posts about gridview