I would want upon selecting the name in my GridView the computer gives the sound of the text value selected.
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ListComit.aspx.vb" Inherits="SulaSignar.ListComit" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ListView ID="ListView1" runat="server">
<ItemTemplate>
<div>
<asp:Label ID="lblterm" runat="server" Text='<%#Eval("Term") %>'></asp:Label>
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="voice"><i class="fa fa-volume-down"></i></asp:LinkButton>
</div>
</ItemTemplate>
</asp:ListView>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
if (!('speechSynthesis' in window)) {
alert("You don't have speechSynthesis");
}
$('[id*=LinkButton1]').on('click', function () {
var term = $(this).closest('div').find('[id*=lblterm]').html();
var voices = window.speechSynthesis.getVoices();
var speech = new SpeechSynthesisUtterance();
speech.voice = voices[2];
speech.rate = 1;
speech.pitch = 1;
speech.text = term;
speechSynthesis.speak(speech);
return false;
});
});
</script>
</div>
</form>
</body>
</html>
If Not Me.IsPostBack Then
Dim dt As DataTable = New DataTable()
dt.Columns.AddRange(New DataColumn() {New DataColumn("Term")})
dt.Rows.Add("Iam Going To School")
dt.Rows.Add("Makumbi Please Come In")
dt.Rows.Add("Namakula Come and See the Doctor in Room Number 5")
ListView1.DataSource = dt
ListView1.DataBind()
End If
I wanted to integrate this above into my GridView below
Public Class DoctorCalling
Inherits System.Web.UI.Page
Dim conString As String = ConfigurationManager.ConnectionStrings("TRIALSIGNARConnectionString").ConnectionString
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Using con As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("TRIALSIGNARConnectionString").ConnectionString)
Using cmd As SqlCommand = New SqlCommand("SELECT Account,Name,age,Phone,sex,stdtype,Category,acnos, RANK () OVER (ORDER BY dates) Slot FROM Student WHERE CAST(Dates AS DATE) = CAST(GETDATE() AS DATE) AND ISNULL(rStatus,'') = ''", con)
' cmd.Parameters.AddWithValue("@CustomerId", ID)
Using da As SqlDataAdapter = New SqlDataAdapter(cmd)
Using dt As DataTable = New DataTable()
da.Fill(dt)
Me.PatientCallGrid.DataSource = dt
Me.PatientCallGrid.DataBind()
PatientCallGrid.UseAccessibleHeader = True
PatientCallGrid.FooterRow.TableSection = TableRowSection.TableFooter
PatientCallGrid.HeaderRow.TableSection = TableRowSection.TableHeader
End Using
End Using
End Using
End Using
End If
End Sub
Private Sub PatientCallGrid_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles PatientCallGrid.RowCommand
If e.CommandName = "Patient" Then
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim row As GridViewRow = PatientCallGrid.Rows(index)
Dim named As String = PatientCallGrid.Rows(index).Cells(1).Text
Dim namesd As String = PatientCallGrid.Rows(index).Cells(2).Text
Dim docment As String = PatientCallGrid.Rows(index).Cells(7).Text
bindgrid()
End If
End Sub
Private Sub bindgrid()
Using con As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("TRIALSIGNARConnectionString").ConnectionString)
Using cmd As SqlCommand = New SqlCommand("SELECT Account,Name,age,Phone,sex,stdtype,Category,acnos, RANK () OVER (ORDER BY dates) Slot FROM Student WHERE CAST(Dates AS DATE) = CAST(GETDATE() AS DATE) AND ISNULL(rStatus,'') = ''", con)
' cmd.Parameters.AddWithValue("@CustomerId", ID)
Using da As SqlDataAdapter = New SqlDataAdapter(cmd)
Using dt As DataTable = New DataTable()
da.Fill(dt)
Me.PatientCallGrid.DataSource = dt
Me.PatientCallGrid.DataBind()
PatientCallGrid.UseAccessibleHeader = True
PatientCallGrid.FooterRow.TableSection = TableRowSection.TableFooter
PatientCallGrid.HeaderRow.TableSection = TableRowSection.TableHeader
End Using
End Using
End Using
End Using
End Sub
End Class
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="DoctorCalling.aspx.vb" Inherits="SulaSignar.DoctorCalling" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="../Scripts/Jquery-3.5.1.js"></script>
<script type="text/javascript" src="../Scripts/Jquery.datatables.min.js"></script>
<script type="text/javascript" src="../Scripts/datatable.fixedColumns.min.js"></script>
<link href="../Scripts/Jquery.datatables.min.css" rel="stylesheet" type="text/css" />
<link href="../Scripts/fixedColumns.dataTables.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
$('#PatientCallGrid tfoot tr').appendTo('#PatientCallGrid thead');
$('#PatientCallGrid').removeAttr('width').DataTable({
bLengthChange: true,
lengthMenu: [[20, 25, -1], [20, 25, "All"]],
bFilter: true,
bSort: true,
scrollCollapse: true,
paging: true,
fixedColumns: false,
orderCellsTop: true
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2">
<asp:GridView ID="PatientCallGrid" runat="server">
<Columns>
<asp:ButtonField CommandName="Patient" HeaderText="Call Patient" ShowHeader="True" Text="Call Patient" />
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</form>
</body>
</html>