Basically value1 and value2 are two numbers from a database, when I click button1 I want to get the number in the code behind (c#) so I can add another number to it and the same for value2. I simply require the line needed in c# that will extract the Eval value…. Your help will be much appreciated.
<asp:Button ID="button1" runat="server" Text='Plus' OnClick="button1_Click"/>
<asp:Label ID="value1" runat="server" Text=' <%# Eval("value1") %> ' />
<asp:Button ID="button2" runat="server" Text='Minus' OnClick="button2_Click" />
<asp:Label ID="value" runat="server" Text=' <%# Eval("value2") %> '/>
You need to ‘bind’
<asp:Label ID=”value1″ runat=”server” Text=’ <%# Bind(“value1”) %> ‘ />
Eval is one way and Bind is two way databinding. You may need to use Container.DataItem possibly but bind will probably do the job.
You will then be able to read the value of the Text attribute i.e.
Additionally because the control is in a listview you may need to navigate the ListView controls collection:
HTH