I found the answer from
http:
<![CDATA[
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Text to Speech </title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:repeater id="rptOA" runat="server" xmlns:asp="#unknown">
<HeaderTemplate>
<table border="1">
<tr>
<th scope="col" style="width: 80px">
S.No
</th>
<th scope="col" style="width: 80px">
Option A
</th>
<th scope="col" style="width: 120px">
Option B
</th>
</tr>
</HeaderTemplate>
<itemtemplate>
<tr>
<td>
<asp:label id="lbl_Sno" runat="server" text="<%# Bind("OrtAna_SNo") %>"></asp:label>
</td>
<td>
<asp:radiobutton id="rdOrtAna_ADesc" runat="server" text="<%# Bind("OrtAna_ADesc") %>">
GroupName="Option" />
</asp:radiobutton></td>
<td>
<asp:radiobutton id="rdOrtAna_BDesc" runat="server" text="<%# Bind("OrtAna_BDesc") %>">
GroupName="Option" />
</asp:radiobutton></td>
</tr>
<tr>
<td colspan="3">
<asp:button id="btn_Spk" runat="server" text="Read" commandname="Speak" />
</td>
</tr>
</itemtemplate>
<footertemplate>
</footertemplate></table>
</asp:repeater>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Speech;
using System.Speech.Synthesis;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Threading;
public partial class TT : System.Web.UI.Page
{
SpeechSynthesizer sp1 = new SpeechSynthesizer();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
binddata();
}
}
public SqlConnection Con()
{
string Connectionstring = string.Empty;
Connectionstring = ConfigurationManager.ConnectionStrings["DBCon"].ToString();
SqlConnection conn = new SqlConnection(Connectionstring);
return conn;
}
public void binddata()
{
SqlConnection conn = Con();
SqlCommand cmd = new SqlCommand("select * from dbo.OrtAna order by OrtAna_SNo", conn);
cmd.CommandType = CommandType.Text;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
DataTable dt = new DataTable();
sda.Fill(dt);
rptOA.DataSource = dt;
rptOA.DataBind();
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
rptOA.ItemCommand += new RepeaterCommandEventHandler(rptOA_ItemCommand);
}
protected void rptOA_ItemCommand(object source, RepeaterCommandEventArgs e)
{
RadioButton rbt1 = (RadioButton)(e.Item.FindControl("rdOrtAna_ADesc"));
RadioButton rbt2 = (RadioButton)(e.Item.FindControl("rdOrtAna_BDesc"));
sp1.SelectVoiceByHints(VoiceGender.Male);
sp1.Volume = 100;
sp1.Rate = 0;
if (e.CommandName == "Speak")
{
sp1.SpeakAsync(rbt1.Text);
Thread.Sleep(100);
sp1.SpeakAsync(rbt2.Text);
}
}
}
Narendran Namachivayam