I have icons in my ASP.Net GridView. i want that icons to redirect to another page.
page i want to redirect WardMedicineUse.aspx
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="patient-table" Width="100%">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
Registration
</HeaderTemplate>
<ItemTemplate>
<%# Eval("Registration") %>
<br></br>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Date/time
</HeaderTemplate>
<ItemTemplate>
<%# Eval("DateTime") %>
<br></br>
<%# Eval("Time") %>
<br></br>
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField>
<HeaderTemplate>
Time
</HeaderTemplate>
<ItemTemplate>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField>
<HeaderTemplate>
Disease
</HeaderTemplate>
<ItemTemplate>
<%# Eval("Disease")%>
<br></br>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Name
</HeaderTemplate>
<ItemTemplate>
<%# Eval("PFName") %>
<br></br>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Gender
</HeaderTemplate>
<ItemTemplate>
<%# Eval("Gender") %>
<br></br>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:TemplateField>
<HeaderTemplate>
Ward
</HeaderTemplate>
<ItemTemplate>
<%# Eval("ward_name") %> <br></br>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField>
<HeaderTemplate>
Ward#
</HeaderTemplate>
<ItemTemplate>
<%# Eval("BedNo") %>
<br></br>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Consultant
</HeaderTemplate>
<ItemTemplate>
<%# Eval("DoctorName") %>
<br></br>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:TemplateField>
<HeaderTemplate>
Billing Party
</HeaderTemplate>
<ItemTemplate>
<%# Eval("BillPartyName") %> <br></br>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField>
<HeaderTemplate>
Options
</HeaderTemplate>
<ItemTemplate>
<div style="display: flex; justify-content: space-around;">
<div class="option-icons">
<asp:LinkButton ID="LinkButton1" runat="server">
<img src="../Nurseimg/11.1.png" alt="11.1.png" />
</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server">
<img src="../Nurseimg/10.png" alt="10.png" />
</asp:LinkButton>
<asp:LinkButton ID="LinkButton3" runat="server">
<img src="../Nurseimg/9.png" alt="9.png" />
</asp:LinkButton>
<asp:LinkButton ID="LinkButton4" runat="server">
<img src="../Nurseimg/7.png" alt="7.png" />
</asp:LinkButton>
<asp:LinkButton ID="LinkButton5" runat="server">
<img src="../Nurseimg/6.1.png" alt="6.1.png" />
</asp:LinkButton>
<asp:LinkButton ID="LinkButton6" runat="server">
<img src="../Nurseimg/5.png" alt="5.png" />
</asp:LinkButton>
<asp:LinkButton ID="LinkButton7" runat="server">
<img src="../Nurseimg/3.1.png" alt="3.1.png" />
</asp:LinkButton>
<asp:LinkButton ID="LinkButton8" runat="server">
<img src="../Nurseimg/2.png" alt="2.png" />
</asp:LinkButton>
<asp:LinkButton ID="LinkButton9" runat="server">
<img src="../Nurseimg/1.1.png" alt="1.1.png" />
</asp:LinkButton>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
vb.net code
Imports System.Data
Imports System.Data.SqlClient
Partial Class Doctor_Main_Page
Inherits System.Web.UI.Page
Dim ENC As New Encryption
Dim constr As String = ConfigurationManager.ConnectionStrings("Reg_ConnectionString").ConnectionString
Dim Pt_Reg_No As String = ""
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Ensure initialization code here
BindGrid()
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Fill_DataList(0)
End Sub
Private Sub BindGrid()
Dim constr As String = ConfigurationManager.ConnectionStrings("Reg_ConnectionString").ConnectionString
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("Select_Patient_For_NurseMain_Page_doc", con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@hospitalid", DropDownListhospital.SelectedValue)
con.Open()
Using sda As New SqlDataAdapter(cmd)
Dim dt As New DataTable()
sda.Fill(dt)
For Each row As DataRow In dt.Rows
row("Registration") = ENC.Encrypt_Main(row("Registration").ToString(), False)
row("PFname") = ENC.Encrypt_Main(row("PFname").ToString(), False)
Next
GridView1.DataSource = dt
GridView1.DataBind()
End Using
End Using
End Using
End Sub
Sub Fill_DataList(ByVal subDept As Integer)
Try
Dim constr As String = ConfigurationManager.ConnectionStrings("Reg_ConnectionString").ConnectionString
Dim con As SqlConnection = New SqlConnection(constr)
Dim command As SqlCommand = New SqlCommand("Select_Patient_For_NurseMain_Page", con)
command.CommandType = CommandType.StoredProcedure
command.CommandTimeout = 120 ' Set the command timeout to 120 seconds
command.Parameters.AddWithValue("@DoctorID", Session("Emp_Id"))
If TextBoxPFName.Text = "" Then
command.Parameters.AddWithValue("@PFName", "%")
Else
command.Parameters.AddWithValue("@PFName", ENC.Encrypt_Main(ENC.TitleCase(TextBoxPFName.Text), True))
End If
If TextBoxRegNo.Text = "" Then
command.Parameters.AddWithValue("@RegNo", "%")
Else
command.Parameters.AddWithValue("@RegNo", ENC.Encrypt_Main(TextBoxRegNo.Text, True))
End If
If TextBoxRegNo.Text = "" Then
command.Parameters.AddWithValue("@yearlyNo", 0)
Else
command.Parameters.AddWithValue("@yearlyNo", TextBoxRegNo.Text)
End If
command.Parameters.AddWithValue("@Deptid", DropDownListDept.SelectedValue)
command.Parameters.AddWithValue("@request_type_id", 1)
command.Parameters.AddWithValue("@SubDept_id", subDept)
command.Parameters.AddWithValue("@hospitalId", Session("hospitalId"))
command.Parameters.AddWithValue("@wardID", DDL_Ward.SelectedValue)
command.Parameters.AddWithValue("@Gender", DropDownListgender.SelectedValue)
con.Open()
Dim da As New SqlDataAdapter(command)
Dim ds As New DataSet
da.Fill(ds, "PatientDataList")
DataList1.DataSource = ds.Tables(0)
DataList1.DataBind()
Catch ex As Exception
' Log the exception details here
' For example: LogError(ex)
End Try
End Sub
Protected Sub DropDownListDept_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownListDept.PreRender
If Not Page.IsPostBack Then
DropDownListDept.Items.Insert(0, New ListItem("All", 0))
DropDownListDept.SelectedValue = Session("dept_id")
DataList1.DataBind()
' DataListSubDepartment.DataBind()
End If
End Sub
Protected Sub DataList1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataList1.PreRender
For i As Integer = 0 To DataList1.Items.Count - 1
Dim lnkName As LinkButton = CType(DataList1.Items(i).FindControl("LinkButtonName"), LinkButton)
Dim lblprfix As Label = CType(DataList1.Items(i).FindControl("PrefixLabel"), Label)
Dim lblPFName As Label = CType(DataList1.Items(i).FindControl("PFNameLabel"), Label)
Dim lblPMName As Label = CType(DataList1.Items(i).FindControl("PMNameLabel"), Label)
Dim lblPLName As Label = CType(DataList1.Items(i).FindControl("PLNameLabel"), Label)
Dim lblRegNo As Label = CType(DataList1.Items(i).FindControl("LabelRegNo"), Label)
If lnkName IsNot Nothing AndAlso lblprfix IsNot Nothing AndAlso lblPFName IsNot Nothing AndAlso lblPMName IsNot Nothing AndAlso lblPLName IsNot Nothing Then
lnkName.Text = lblprfix.Text & " " & ENC.Encrypt_Main(lblPFName.Text, False) & " " & ENC.Encrypt_Main(lblPMName.Text, False) & " " & ENC.Encrypt_Main(lblPLName.Text, False)
End If
If lblRegNo IsNot Nothing Then
lblRegNo.Text = ENC.Encrypt_Main(lblRegNo.Text, False)
End If
Dim linkButton1 As LinkButton = CType(DataList1.Items(i).FindControl("LinkButton1"), LinkButton)
If linkButton1 IsNot Nothing Then
End If
Next
End Sub
Protected Sub DataList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataList1.SelectedIndexChanged
'Label3.Text = "select"
Dim lblregno As HiddenField = DataList1.Items(DataList1.SelectedIndex).FindControl("HiddenField_reg_no")
Dim lblpayid As HiddenField = DataList1.Items(DataList1.SelectedIndex).FindControl("HiddenField_pay_ID")
Session.Add("registrationno", lblregno.Value)
Dim a As String
a = visit(lblregno.Value)
Session.Add("yearlyno", lblpayid.Value)
Dim conInsert As SqlConnection = New SqlConnection(constr)
Dim cmd As SqlCommand = New SqlCommand("select *from BasicDataInfo.dbo.Pt_Assign_Bed where Yearly_No=@YearlyNo and Current_Bed_status=1", conInsert)
cmd.Parameters.AddWithValue("@YearlyNo", lblpayid.Value)
cmd.CommandType = CommandType.Text
cmd.CommandTimeout = 120 ' Set the command timeout to 120 seconds
conInsert.Open()
Dim da As SqlDataAdapter = New SqlDataAdapter(cmd)
Dim ds As DataSet = New DataSet()
da.Fill(ds, "IDTable")
Dim cmd1 As SqlCommand = New SqlCommand("select *from Registration.dbo.PT_WardAdmission where YearlyNo=@YearlyNo", conInsert)
cmd1.Parameters.AddWithValue("@YearlyNo", lblpayid.Value)
cmd1.CommandType = CommandType.Text
cmd1.CommandTimeout = 120 ' Set the command timeout to 120 seconds
Dim da1 As SqlDataAdapter = New SqlDataAdapter(cmd1)
Dim ds1 As DataSet = New DataSet()
da1.Fill(ds1, "IDTable1")
conInsert.Close()
conInsert.Dispose()
If ds.Tables("IDTable").Rows.Count > 0 And ds1.Tables("IDTable1").Rows.Count > 0 Then
Response.Redirect("~/Nursing/Nursing_Notes.aspx?RegNo=" & lblregno.Value)
Else
Response.Redirect("~/Pt_EMR/Pt_WardAdmission.aspx?regno=" & lblregno.Value + "&payid=" & lblpayid.Value)
End If
End Sub
Protected Sub DropDownListDept_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownListDept.SelectedIndexChanged
Fill_DataList(0)
End Sub
Function visit(ByVal regno As String) As String
Dim con As SqlConnection = New SqlConnection(constr)
Dim command As SqlCommand = New SqlCommand("select Max(Payment.PayID) from Payment where Payment.RegNo =@Reg_no", con)
command.Parameters.AddWithValue("@Reg_no", regno)
command.CommandTimeout = 120
con.Open()
Dim result As String = command.ExecuteScalar().ToString()
con.Close()
Return result
End Function
Protected Sub DropDownListgender_SelectedIndexChanged(sender As Object, e As EventArgs)
Fill_DataList(0)
End Sub
Protected Sub DDL_Ward_SelectedIndexChanged(sender As Object, e As EventArgs)
Fill_DataList(0)
End Sub
Protected Sub DropDownListhospital_SelectedIndexChanged(sender As Object, e As EventArgs)
BindGrid()
End Sub
End Class