I have written my code under button as follows
string actkey = string.Empty;
foreach (GridViewRow row in GridView1.Rows)
{
//Label lbInvoice = (Label)row.FindControl("lblInvoice");
string strInvoice = GridView1.DataKeys[row.RowIndex].Values["lblInvoice"].ToString();
objinvoice.Invoice = strInvoice;
RadioButton rdn = (RadioButton)row.FindControl("rdnRenew");
if (rdn.Checked)
{
actkey = oCustomerDetails.CreateRandom(20);
objinvoice.activationcode = actkey;
objinvoice.editInvoice(actkey, strInvoice);
}
}
But i am getting an error at this
string strInvoice = GridView1.DataKeys[row.RowIndex].Values["lblInvoice"].ToString();
Is there anything wrong in what i have written
I declared my item template as follows
<ItemTemplate>
<asp:Label ID="lblInvoice" runat="server" Text='<%# Eval("invoceNo") %>'></asp:Label>
</ItemTemplate>