Is it possible to display/show file that is in GridView by clicking a control inside the grid using QueryString?
For example I have 3 web forms and two GridViews on each of these web forms/webpages that display data from database using stored procedure.
I want to have "view" control on each of the GridViews, so that when control is clicked, it will redirect to another page and display the record of that row that was clicked.
Page1 has 2 GridViews, Page2 has two GridViews and Page3 has two GridViews but if I can get an example of one page, then I can use that for other pages.
I want to pass a QueryString based on the Id of the file in the GridView.
Then call the QueryString on the Display Page to show the document.
Reference Number FileName Date Action
8763533 My document1 17 May, 2022 ViewFile
0086342 Sample Paper 24 May, 2022 ViewFile
1265399 Alice Receipt 27 May, 2022 ViewFile
When the "ViewFile" is clicked it will redirect to another page to show the file based on the Reference number.
HTML
<asp:UpdatePanel ID="panel" runat="server">
<ContentTemplate>
<div class="container-fluid p-3 mb5 bg-white rounded" id="card">
<div class="grid-corner">
<div class="input-group">
<asp:TextBox ID="Searchbox" runat="server" placeholder="Reference N°" CssClass="form-control" Font-Size="10pt" BorderWidth="1"></asp:TextBox>
<div class="input-group-append">
<button id="searchbtn" runat="server" class="btn btn-primary">
<i class="far fa-search" aria-hidden="true"></i>
</button>
</div>
</div>
<asp:GridView ID="GridView1" runat="server" GridLines="None" AllowPaging="true" HeaderStyle-ForeColor="#05214d" HeaderStyle-Font-Bold="false" HeaderStyle-Font-Size="11pt" Font-Size="10pt"
AutoGenerateColumns="false" OnPageIndexChanging="OnPageIndexChanging" class="table" Width="100%">
<EmptyDataTemplate>
<div>
<hr />
<hr />
<asp:Label ID="labelTemp" runat="server" Font-Names="Roboto" Font-Size="12pt" Text="No Record Available"></asp:Label>
<hr />
<hr />
</div>
</EmptyDataTemplate>
<Columns>
<asp:BoundField DataField="Reference" HeaderText="Reference Number" />
<asp:BoundField DataField="FileName" HeaderText="File Name" />
<asp:BoundField DataField="Dated" HeaderText="Date" />
<asp:BoundField DataField="CreatedBy" HeaderText="Admin" />
</Columns>
</asp:GridView>
<div>
Showing Page
<asp:Label ID="lblPageIndex" runat="server" Text="Label" />
of
<asp:Label ID="lblTotalPage" runat="server" />
(<asp:Label ID="lblTotal" runat="server" />
Records)
<div class="dvPager">
<asp:Repeater ID="rptPager" runat="server">
<ItemTemplate>
<asp:LinkButton ID="lnkPage" runat="server" Text='<%#Eval("Text") %>' CommandArgument='<%# Eval("Value") %>'
CssClass='<%# Convert.ToBoolean(Eval("Enabled")) ? "page_enabled" : "page_disabled" %>'
OnClick="Page_Changed" OnClientClick='<%# !Convert.ToBoolean(Eval("Enabled")) ? "return false;" : "" %>'></asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
<br />
<br />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>