Hopefully this is an easy one!
I have a datalist bound to the table "items" which just lists the items.
In the footer template of the datalist I have "New Item" then a textbox and then an "add" button.
I simply want to take the text from the textbox and insert it into the table "items" thus adding a new item.
With the textbox outside on the page (not in the footer template of the datalist) this works fine but when I moved the textbox within the datalist footer it cannot find the control and I have no idea how to set the parameters for the insert because when you go to the datasource insert properties and try to get the value from a control it only lists the datalist's selected value and not any controls that are within the datalist (like my textbox in the footer)
I see in the source where the insert parameters are like this:
I also see in visual studio when I select the textbox it is no longer just TextBox1 it is DataList1.HeaderandFooterTemplates.FooterTemplate.TextBox1
But if i set the ControlID to this it gives an error like:
Exception Details: System.InvalidOperationException: Could not find control 'DataList1.HeaderandFooterTemplates.FooterTemplate.TextBox1' in ControlParameter 'ItemName'.
I know there has to be a way but I am stumped. Any help is appreciated!
I have a datalist bound to the table "items" which just lists the items.
In the footer template of the datalist I have "New Item" then a textbox and then an "add" button.
I simply want to take the text from the textbox and insert it into the table "items" thus adding a new item.
With the textbox outside on the page (not in the footer template of the datalist) this works fine but when I moved the textbox within the datalist footer it cannot find the control and I have no idea how to set the parameters for the insert because when you go to the datasource insert properties and try to get the value from a control it only lists the datalist's selected value and not any controls that are within the datalist (like my textbox in the footer)
I see in the source where the insert parameters are like this:
Code:
<InsertParameters>
<asp:ControlParameter Name="ItemName" ControlID="TextBox1" PropertyName="Text" />
</InsertParameters>
But if i set the ControlID to this it gives an error like:
Exception Details: System.InvalidOperationException: Could not find control 'DataList1.HeaderandFooterTemplates.FooterTemplate.TextBox1' in ControlParameter 'ItemName'.
I know there has to be a way but I am stumped. Any help is appreciated!