Hello Experts.
How I Can Print a Single Row If I Click Print Button Icon.
<asp:GridView runat="server" CssClass="table table-striped table-bordered"
ID="gvDetails" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="amount" ItemStyle-Font-Bold="true" ItemStyle-Font-Size="Large" HeaderText="Amount" />
<asp:BoundField DataField="branch_num" HeaderText="Branch No" />
<asp:BoundField DataField="machineID" HeaderText="Machine ID" />
<asp:BoundField DataField="shift" HeaderText="Shifts" />
<asp:BoundField DataField="userID" HeaderText="User" />
<asp:BoundField DataField="voucher_date" HeaderText="Voucher Date" />
<asp:BoundField DataField="voucher_number" HeaderText="Voucher No" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="IBPrint" CssClass="btn btn-outline-dark rounded-circle" runat="server">
<i class="bi bi-printer"></i>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle HorizontalAlign="Center" CssClass="GridPager" />
</asp:GridView>
public void GetJsonData(string branch, string searchbydate)
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
string json = (new WebClient()).DownloadString("https://receipt-voucher-default-rtdb.firebaseio.com/receipts-prod.json");
Dictionary<string, object> values = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
int noofrecords = values.Count;
List<Receipt> receipts = new List<Receipt>();
foreach (var entry in values)
{
receipts.Add(JsonConvert.DeserializeObject<Receipt>(entry.Value.ToString()));
}
if (!string.IsNullOrEmpty(branch) && !string.IsNullOrEmpty(searchbydate) && searchbydate != "Monday, January 1, 0001")
{
receipts = receipts.Where(x => x.branch_num == branch && Convert.ToDateTime(x.voucher_date).ToString("dd/MM/yyyy") == Convert.ToDateTime(searchbydate).ToString("dd/MM/yyyy")).ToList();
}
else if (!string.IsNullOrEmpty(branch))
{
receipts = receipts.Where(x => x.branch_num == branch).ToList();
if (!string.IsNullOrEmpty(searchbydate) && searchbydate != "Monday, January 1, 0001")
{
receipts = receipts.Where(x => Convert.ToDateTime(x.voucher_date).ToString("dd/MM/yyyy") == Convert.ToDateTime(searchbydate).ToString("dd/MM/yyyy")).ToList();
}
}
else if (!string.IsNullOrEmpty(searchbydate) && searchbydate != "Monday, January 1, 0001")
{
if (!string.IsNullOrEmpty(branch))
{
receipts = receipts.Where(x => x.branch_num == branch).ToList();
}
receipts = receipts.Where(x => Convert.ToDateTime(x.voucher_date).ToString("dd/MM/yyyy") == Convert.ToDateTime(searchbydate).ToString("dd/MM/yyyy")).ToList();
}
gvDetails.DataSource = receipts;
gvDetails.DataBind();
lblTotalRecords.Text = receipts.Count.ToString();
}