It seems like this should be straightforward but I’m boggling. I’ve got my listview all setup and bound to my LINQ datasource. The source is dependent on a dropdown list which decides which branch information to show in the listview. My edit template works fine but my insert template won’t work because it wants the branch ID which I want to get from the dropdownlist outside the listview but I don’t know how to both bind that value and set it in my template. It looks like this:
<InsertItemTemplate> <tr style=''> <td> <asp:Button ID='InsertButton' runat='server' CommandName='Insert' Text='Insert' /> </td> <td> <asp:TextBox ID='RechargeRateTextBox' runat='server' Text='<%# Bind('RechargeRate') %>' /> </td> <td> <asp:Calendar SelectedDate='<%# Bind('StartDate') %>' ID='Calendar1' runat='server'></asp:Calendar> </td> </tr> </InsertItemTemplate>
I need to get a label in there that binds to the value of a databound asp dropdownlist outside of the listview so that the insert will work.
I ended up going with this, thanks twanfosson.