I have a DataList and inside of each item there is an ImageButton that needs to save the contents of an associated textarea. I normally would pass parameters using the CommandArgument tag, but the text inside the description is very long and I do not want to write it out into the commandargument for all the items being displayed. Instead, how can I find the ID of the associated textarea so I can save the text the user changes/enters?
I tried passing ‘this’ into the commandargument but I do not think it is working as it just passes the object for the button and not the whole item.
I realize this seems like a basic question but I’ve searched for over an hour. Your help is very appreciated.
<asp:ImageButton ID="saveDesc" runat="server" AlternateText="Save Image Description" BorderStyle="None" ImageUrl="..\..\images\save.png" CommandArgument='this' CommandName="SaveDescription" />
<asp:TextBox ID="description" runat="server" Text='<%#Eval("description")%>' style="font-weight:bold; width:100%" TextMode="MultiLine" Height="50px"/>
There are actually multiple DataLists inside of multiple Accordion views, but I’m not sure if this is relevant to the answer.
Thanks
You can do like…