Hi
I've been trying for so long to try and find out why I can't access Textboxes mainly but also labels or any other controls that are placed inside a GridView (or FormView).
I have a need to put a Textbox inside a Custom GridView template that will allow users to enter a date and then click on Submit to post this date to the database.
I like to try and handle all Insert commands in the codebehind file, but Intellisense won't recognise the names of the Textboxes.
Please could somebody simply explain how I reference these textboxes in the GridView.
Thanks in advance.
Pete
--------------------------------------------------------
Thanks guys for the answers so far, most helpful but I'm still being thick and can't get it working:
Right here's a little more. I've included the code behind below and what I want to happen is this:
When the user clicks on the Select link in the GridView "ActionsGridView" (the standard Allow Selection Link for GridViews) it will take the value of TextBox "ActionDateCompText" and then update this in the database.
I am using a SqlDataConnection called "ActionsAddActionConn" and the Code Behind update parameters are as follows:
protected void ActionsGridView_SelectedIndexChanged(object sender, EventArgs e)
{
ActionsAddActionConn.UpdateParameters["ACTION_STATUS_ID"].DefaultValue = "12";
ActionsAddActionConn.UpdateParameters["ACTION_COMPLETED_DATE"].DefaultValue = DateTime.Now.ToShortDateString();
ActionsAddActionConn.Update();
}
I want the entry of "ACTION_COMPLETED_DATE" to be the Value of the TextBox "ActionDateCompText" in the GridView.
Hope this helps you all to get me on the right track (or am I doing it all wrong)?