Add this to your code behind
protected List<Control> listOfControls;
protected string GetTextValue()
{
TextBox textbox = (TextBox)Page.FindControl("textbox");
return textbox.Text;
}
protected void Button1_Click(object sender, EventArgs e)
{
// you can improve this but you can get the idea, this would change the cell on row three
// for row one do 1 etc, this should be re-factored
TextBox txt = (TextBox)FindControlRecursive(GridView1, "mygrdviewtext",3);
txt.DataBind();
}
public Control FindControlRecursive(Control Root, string Id, int row)
{
listOfControls = new List<Control>();
FindControlRecursive(Root, Id);
return listOfControls[row -1];
}
public Control FindControlRecursive(Control Root, string Id)
{
if (Root.ID == Id)
{
listOfControls.Add(Root);
}
foreach (Control Ctl in Root.Controls)
{
Control FoundCtl = FindControlRecursive(Ctl, Id);
if (FoundCtl != null)
{
listOfControls.Add(FoundCtl);
}
}
return null;
}
// in your aspx page add something like this to your gridview , where the cell is, again change as it applies to you.
<asp:TemplateField HeaderText="fromtextbox">
<ItemTemplate>
<asp:TextBox ID="mygrdviewtext" runat="server" Text='<%# GetTextValue() %>' />
</ItemTemplate>
</asp:TemplateField>