Textbox inside of GridView ASP.Net 2.0

I have created a textbox inside of Gridview and I'd like to call it insde of the codebehine page...  so I can do something like Textbox1.Text = ...
How can I do this?


 
<asp:TemplateField>
                    <EditItemTemplate>
                        <strong>Enter Number: </strong><asp:TextBox ID="TextBox1" runat="server" BackColor="PaleGoldenrod" Width="127px"></asp:TextBox>
                    </EditItemTemplate>
 </asp:TemplateField>
jung1975Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Elvio Lujan.Net Senior DeveloperCommented:
Ctype(gridView1.FindControl("TextBox1"),textbox).Text = "Hola"
jung1975Author Commented:
I have three Edit itemtemplate columns: A, B, C in Gridview

A - label
B-Textbox
C- ImageButton

What i am trying to do is let user enter the number in the text box and then click the image button, and then the value ( entered by user * 0.18 ) will be displayed column A ( label) automatically...
Elvio Lujan.Net Senior DeveloperCommented:
in the itemCommand event...

ctype(e.Item.Cells(0).Controls(0),label).text= ctype(e.Item.Cells(1).Controls(0),textbox).text
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

Elvio Lujan.Net Senior DeveloperCommented:
e.Item.Cells(0) --> is the label cell
e.Item.Cells(1) --> is the textbox cell

you have to use the corrects id's
jung1975Author Commented:
there is no itemcommand event in Gridview....
Elvio Lujan.Net Senior DeveloperCommented:
sorry use "RowCommand"
jung1975Author Commented:
Do you have any C3 example?
jung1975Author Commented:
Do you have C# example?
Elvio Lujan.Net Senior DeveloperCommented:
void CustomersGridView_RowCommand(Object sender, GridViewCommandEventArgs e)
  {
    if(e.CommandName=="yourCommandName")
    {
      (Label)(e.Item.Cells[0].Controls[0].Text= (TextBox)e.Item.Cells[1].Controls[0].Text;
    }
  }
Elvio Lujan.Net Senior DeveloperCommented:
sorry i was confunded with dataGrid...

void CustomersGridView_RowCommand(Object sender, GridViewCommandEventArgs e)
  {
    if(e.CommandName=="yourCommandName")
    {
      (Label)(e.Row.Cells[0].Controls[0].Text= (TextBox)e.Row.Cells[1].Controls[0].Text;
    }
  }

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jung1975Author Commented:
thanks,but I am getting an error:
Error      4      'System.Web.UI.WebControls.GridViewCommandEventArgs' does not contain a definition for 'Row'      


Column A,B, and C is in EditTemplate in Gridview.

what I am trying to do is when user enter the number in textbox(text box in  EditItemtemplate )  in gridview and click calculate button ( Image button in Edititemtemplate), it will automatically calculate the value and display in column A ( labe in EditItemtemplatel )...


i.e.
   <asp:TemplateField>
                    <EditItemTemplate >
                        <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Image/Calculate.gif" OnCommand="ImageButton1_Command" />
                    </EditItemTemplate>
                    <ItemStyle Width="20px" />
                </asp:TemplateField>
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.