protected void lnkDetails_Click(object sender, EventArgs e) { PanelNotes.Visible = true; GridViewRow SelectedRow = (GridViewRow)((LinkButton)sender).NamingContainer; // get textual notes Supplier_Payment_Record record = new Supplier_Payment_Record(); // for valid format in convertion to double int Startindex = SelectedRow.Cells[3].Text.IndexOf("مدفوعه"); string value = SelectedRow.Cells[3].Text.Remove(Startindex, 16); record.Paid_amount = SelectedRow.BackColor == System.Drawing.Color.LightGray ? -Convert.ToDouble(value) : Convert.ToDouble(value); record.Pay_Date = Convert.ToDateTime(SelectedRow.Cells[0].Text); string s_name = ViewState["S_Name"].ToString(); TxtNotes.Text = record.Get_Supplier_Notes(s_name); // get attachments GridViewImages.DataSource = Supplier_Payments_Documents.Get_Images(s_name, record.Pay_Date); GridViewImages.DataBind(); // to successfully compute the debts in the footer row Get_Records(s_name);//Bind supplier records grid ; SetFocus(GridViewImages); }