Calculate Checked (selected) ASP.Net DataList Items using jQuery
I wrote the following syntax to save lblGrandTotal.Text value
string SubTot = Convert.ToDecimal(lblGrandTotal.Text).ToString();
it is showing me error that
System.FormatException: Input string was not in a correct format.
<asp:DataList ID="DataList1" runat="server" RepeatColumns="5" CellSpacing="0" RepeatLayout="Table">
<ItemTemplate>
<table class="table" style="width: 85%; border-radius: 10px; font-size: 12px; font-family: 'Segoe'; border: 0px;">
<tr>
<td></td>
<td>
<img alt="Books" height="165" width="140" style="border-radius: 15px;" src='<%# "data:image/jpg;base64," + Convert.ToBase64String((byte[])Eval("IPic")) %>' /></td>
</tr>
<tr>
<td></td>
<td colspan="2" style="background-color: aliceblue; border-radius: 5px; color: red;">
<asp:CheckBox ID="chkRow" runat="server" Text='<%# Eval("ItemName")%>' Font-Bold="true" ForeColor="navy" /></td>
</tr>
<tr>
<td></td>
<td colspan="1" style="background-color: aliceblue; border-radius: 10px; color: navy; font-weight: bold;">
<asp:Label Text='<%#Eval("StoresID")%>' runat="server" ID="lblCode" Font-Bold="true" ForeColor="orange" Font-Size="14px" /><br />
Price:<span id="lblPrice"><%# Eval("SRate")%></span></td>
</tr>
<tr>
<td></td>
<td colspan="1"></td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
When i tried to print the price value it is showing me error
System.NullReferenceException: Object reference not set to an instance of an object.
CheckBox chk = (CheckBox)item.FindControl("chkRow");
if (chk.Checked == true)
{
Label id = (Label)item.FindControl("lblCode");
Label price = (Label)item.FindControl("lblPrice");
/*con = new SqlDbConnect();
string oqty = "1";
Response.Write("Code-" + id.Text + "Price-" + price.Text);
}