Narendran N

Narendran N

  • NA
  • 27
  • 3.9k

SpeechSynthesizer & SpeechRecognizer

Jul 25 2016 7:21 AM


Am enhancing en existing web application which makes the visually impaired people, to be used based on the Text to Speech & Speech Recognition

The same code is working fine in windows application, but not in web application.

If I put break point, it's coming to the point but the code is not getting execute.

Here is the code, please do the needful.

  1. using System.Speech;  
  2. using System.Speech.Synthesis;  
  3. using System.Threading;  
  4. using System.Speech.Recognition;  
  5.   
  6.   
  7.   
  8.  SpeechSynthesizer ss = new SpeechSynthesizer();  
  9.     PromptBuilder pb = new PromptBuilder();  
  10.     SpeechRecognitionEngine sre = new SpeechRecognitionEngine();   
  11.     SpeechRecognizer sr = new SpeechRecognizer();  
  12.   
  13.    protected void btn_Spk_Click(object sender, EventArgs e)      
  14.     {  
  15.         string optiona, optionb, optionc;  
  16.         Choices clist = new Choices();  
  17.         foreach (GridViewRow row in gvtemperament.Rows)  
  18.         {  
  19.             RadioButton rblist1 = ((RadioButton)row.FindControl("rdTemp_Opt1"));  
  20.             RadioButton rblist2 = ((RadioButton)row.FindControl("rdTemp_Opt2"));  
  21.             RadioButton rblist3 = ((RadioButton)row.FindControl("rdTemp_Opt3"));  
  22.             Label lbl1 = (Label)row.FindControl("lbl_desc");  
  23.             if (row.Cells[0].Text == "1")  
  24.             {  
  25.                 ss.SelectVoiceByHints(VoiceGender.Female);  
  26.                 ss.Volume = 100;  
  27.                 ss.Rate = -3;  
  28.                 pb.ClearContent();  
  29.                 pb.AppendText("Please answer all the Questions and you starts here!");  
  30.                 ss.Speak(pb);  
  31.                 Thread.Sleep(1500);  
  32.   
  33.                 pb.ClearContent();  
  34.                 pb.AppendText(lbl1.Text);  
  35.                 ss.Speak(pb);  
  36.                 Thread.Sleep(1500);  
  37.   
  38.                 ss.SelectVoiceByHints(VoiceGender.Male);  
  39.                 pb.ClearContent();  
  40.                 pb.AppendText("Options are ");  
  41.                 ss.Speak(pb);  
  42.   
  43.                 optiona = rblist1.Text;  
  44.                 optionb = rblist2.Text;  
  45.                 optionc = "Not Sure";  
  46.   
  47.                   
  48.                 pb.ClearContent();  
  49.                 pb.AppendText(optiona);  
  50.                 ss.Speak(pb);  
  51.                 Thread.Sleep(700);  
  52.   
  53.                 pb.ClearContent();  
  54.                 pb.AppendText(optionb);  
  55.                 ss.Speak(pb);  
  56.                 Thread.Sleep(700);  
  57.   
  58.                 pb.ClearContent();  
  59.                 pb.AppendText(optionc);  
  60.                 ss.Speak(pb);  
  61.   
  62.                 Thread.Sleep(150);  
  63.   
  64.                 clist.Add(new string[] { "Yes""No""Not Sure" });  
  65.                 Grammar gr = new Grammar(new GrammarBuilder(clist));  
  66.                 try  
  67.                 {  
  68.                     sre.RequestRecognizerUpdate();  
  69.                     sre.LoadGrammar(gr);  
  70.                     sre.SpeechRecognized += sre_SpeechRecognized;  
  71.                     sre.SetInputToDefaultAudioDevice();  
  72.                     sre.RecognizeAsync(RecognizeMode.Multiple);  
  73.                 }  
  74.                 catch (Exception ex)  
  75.                 {  
  76.                      this.ClientScript.RegisterStartupScript(this.GetType(), "alert""<script language=\"javascript\">" + "alert('Error');</script>");  
  77.                 }  
  78.             }  
  79.             else if (row.Cells[0].Text == "2")  
  80.             {  
  81.                 ss.SelectVoiceByHints(VoiceGender.Female);  
  82.                 ss.Volume = 100;  
  83.                 ss.Rate = -3;  
  84.   
  85.                 pb.ClearContent();  
  86.                 pb.AppendText(lbl1.Text);  
  87.                 ss.Speak(pb);  
  88.                 Thread.Sleep(1500);  
  89.   
  90.                 ss.SelectVoiceByHints(VoiceGender.Male);  
  91.                 pb.ClearContent();  
  92.                 pb.AppendText("Options are ");  
  93.                 ss.Speak(pb);  
  94.   
  95.                 optiona = rblist1.Text;  
  96.                 optionb = rblist2.Text;  
  97.                 optionc = "Not Sure";  
  98.   
  99.    
  100.                 pb.ClearContent();  
  101.                 pb.AppendText(optiona);  
  102.                 ss.Speak(pb);  
  103.                 Thread.Sleep(700);  
  104.   
  105.                 pb.ClearContent();  
  106.                 pb.AppendText(optionb);  
  107.                 ss.Speak(pb);  
  108.                 Thread.Sleep(700);  
  109.    
  110.                 pb.ClearContent();  
  111.                 pb.AppendText(optionc);  
  112.                 ss.Speak(pb);  
  113.   
  114.                 Thread.Sleep(150);  
  115.                 clist.Add(new string[] { "Yes""No""Not Sure" });  
  116.                 Grammar gr = new Grammar(new GrammarBuilder(clist));  
  117.                 try  
  118.                 {  
  119.                     sre.RequestRecognizerUpdate();  
  120.                     sre.LoadGrammar(gr);  
  121.                     sre.SpeechRecognized += sre_SpeechRecognized;  
  122.                     sre.SetInputToDefaultAudioDevice();  
  123.                     sre.RecognizeAsync(RecognizeMode.Multiple);  
  124.                 }  
  125.                 catch (Exception ex)  
  126.                 {  
  127.                      this.ClientScript.RegisterStartupScript(this.GetType(), "alert""<script language=\"javascript\">" + "alert('Error');</script>");  
  128.                 }  
  129.             }  
  130.             else if (row.Cells[0].Text == "3")  
  131.             {  
  132.                 ss.SelectVoiceByHints(VoiceGender.Female);  
  133.                 ss.Volume = 100;  
  134.                 ss.Rate = -3;  
  135.   
  136.                 pb.ClearContent();  
  137.                 pb.AppendText(lbl1.Text);  
  138.                 ss.Speak(pb);  
  139.                 Thread.Sleep(1500);  
  140.   
  141.                 ss.SelectVoiceByHints(VoiceGender.Male);  
  142.                 pb.ClearContent();  
  143.                 pb.AppendText("Options are ");  
  144.                 ss.Speak(pb);  
  145.   
  146.                 optiona = rblist1.Text;  
  147.                 optionb = rblist2.Text;  
  148.                 optionc = "Not Sure";  
  149.                                                              
  150.                 pb.ClearContent();  
  151.                 pb.AppendText(optiona);  
  152.                 ss.Speak(pb);  
  153.                 Thread.Sleep(700);  
  154.   
  155.                 pb.ClearContent();  
  156.                 pb.AppendText(optionb);  
  157.                 ss.Speak(pb);  
  158.                 Thread.Sleep(700);  
  159.   
  160.                 pb.ClearContent();  
  161.                 pb.AppendText(optionc);  
  162.                 ss.Speak(pb);  
  163.                 Thread.Sleep(150);  
  164.                 clist.Add(new string[] { "Yes""No""Not Sure" });  
  165.                 Grammar gr = new Grammar(new GrammarBuilder(clist));  
  166.                 try  
  167.                 {  
  168.                     sre.RequestRecognizerUpdate();  
  169.                     sre.LoadGrammar(gr);  
  170.                     sre.SpeechRecognized += sre_SpeechRecognized;  
  171.                     sre.SetInputToDefaultAudioDevice();  
  172.                     sre.RecognizeAsync(RecognizeMode.Multiple);  
  173.                 }  
  174.                 catch (Exception ex)  
  175.                 {  
  176.                       this.ClientScript.RegisterStartupScript(this.GetType(), "alert""<script language=\"javascript\">" + "alert('Error');</script>");  
  177.                 }  
  178.             }  
  179.             else if (row.Cells[0].Text == "4")  
  180.             {  
  181.                 ss.SelectVoiceByHints(VoiceGender.Female);  
  182.                 ss.Volume = 100;  
  183.                 ss.Rate = -3;  
  184.   
  185.                 pb.ClearContent();  
  186.                 pb.AppendText(lbl1.Text);  
  187.                 ss.Speak(pb);  
  188.                 Thread.Sleep(1500);  
  189.   
  190.                 ss.SelectVoiceByHints(VoiceGender.Male);  
  191.                 pb.ClearContent();  
  192.                 pb.AppendText("Options are ");  
  193.                 ss.Speak(pb);  
  194.   
  195.                 optiona = rblist1.Text;  
  196.                 optionb = rblist2.Text;  
  197.                 optionc = "Not Sure";  
  198.                                        
  199.                 pb.ClearContent();  
  200.                 pb.AppendText(optiona);  
  201.                 ss.Speak(pb);  
  202.                 Thread.Sleep(700);  
  203.   
  204.                 pb.ClearContent();  
  205.                 pb.AppendText(optionb);  
  206.                 ss.Speak(pb);  
  207.                 Thread.Sleep(700);  
  208.   
  209.                 pb.ClearContent();  
  210.                 pb.AppendText(optionc);  
  211.                 ss.Speak(pb);  
  212.                 Thread.Sleep(150);  
  213.                 clist.Add(new string[] { "Yes""No""Not Sure" });  
  214.                 Grammar gr = new Grammar(new GrammarBuilder(clist));  
  215.                 try  
  216.                 {  
  217.                     sre.RequestRecognizerUpdate();  
  218.                     sre.LoadGrammar(gr);  
  219.                     sre.SpeechRecognized += sre_SpeechRecognized;  
  220.                     sre.SetInputToDefaultAudioDevice();  
  221.                     sre.RecognizeAsync(RecognizeMode.Multiple);  
  222.                 }  
  223.                 catch (Exception ex)  
  224.                 {  
  225.                     this.ClientScript.RegisterStartupScript(this.GetType(), "alert""<script language=\"javascript\">" + "alert('Error');</script>");  
  226.                 }  
  227.             }  
  228.             else if (row.Cells[0].Text == "5")  
  229.             {  
  230.                 ss.SelectVoiceByHints(VoiceGender.Female);  
  231.                 ss.Volume = 100;  
  232.                 ss.Rate = -3;  
  233.                 pb.ClearContent();  
  234.                 pb.AppendText(lbl1.Text);  
  235.                 ss.Speak(pb);  
  236.                 Thread.Sleep(1500);  
  237.   
  238.                 ss.SelectVoiceByHints(VoiceGender.Male);  
  239.                 pb.ClearContent();  
  240.                 pb.AppendText("Options are ");  
  241.                 ss.Speak(pb);  
  242.   
  243.                 optiona = rblist1.Text;  
  244.                 optionb = rblist2.Text;  
  245.                 optionc = "Not Sure";  
  246.   
  247.                 pb.ClearContent();  
  248.                 pb.AppendText(optiona);  
  249.                 ss.Speak(pb);  
  250.                 Thread.Sleep(700);  
  251.   
  252.                 pb.ClearContent();  
  253.                 pb.AppendText(optionb);  
  254.                 ss.Speak(pb);  
  255.                 Thread.Sleep(700);  
  256.   
  257.                 pb.ClearContent();  
  258.                 pb.AppendText(optionc);  
  259.                 ss.Speak(pb);  
  260.                 Thread.Sleep(150);  
  261.                 clist.Add(new string[] { "Yes""No""Not Sure" });  
  262.                 Grammar gr = new Grammar(new GrammarBuilder(clist));  
  263.                 try  
  264.                 {  
  265.                     sre.RequestRecognizerUpdate();  
  266.                     sre.LoadGrammar(gr);  
  267.                     sre.SpeechRecognized += sre_SpeechRecognized;  
  268.                     sre.SetInputToDefaultAudioDevice();  
  269.                     sre.RecognizeAsync(RecognizeMode.Multiple);  
  270.                 }  
  271.                 catch (Exception ex)  
  272.                 {  
  273.                      this.ClientScript.RegisterStartupScript(this.GetType(), "alert""<script language=\"javascript\">" + "alert('Error');</script>");  
  274.                 }  
  275.             }  
  276.             else if (row.Cells[0].Text == "6")  
  277.             {  
  278.                 ss.SelectVoiceByHints(VoiceGender.Female);  
  279.                 ss.Volume = 100;  
  280.                 ss.Rate = -3;  
  281.                 pb.ClearContent();  
  282.                 pb.AppendText(lbl1.Text);  
  283.                 ss.Speak(pb);  
  284.                 Thread.Sleep(1500);  
  285.   
  286.                 ss.SelectVoiceByHints(VoiceGender.Male);  
  287.                 pb.ClearContent();  
  288.                 pb.AppendText("Options are ");  
  289.                 ss.Speak(pb);  
  290.   
  291.                 optiona = rblist1.Text;  
  292.                 optionb = rblist2.Text;  
  293.                 optionc = "Not Sure";  
  294.   
  295.                 pb.ClearContent();  
  296.                 pb.AppendText(optiona);  
  297.                 ss.Speak(pb);  
  298.                 Thread.Sleep(700);  
  299.   
  300.                 pb.ClearContent();  
  301.                 pb.AppendText(optionb);  
  302.                 ss.Speak(pb);  
  303.                 Thread.Sleep(700);  
  304.   
  305.                 pb.ClearContent();  
  306.                 pb.AppendText(optionc);  
  307.                 ss.Speak(pb);  
  308.                 Thread.Sleep(150);  
  309.                 clist.Add(new string[] { "Yes""No""Not Sure" });  
  310.                 Grammar gr = new Grammar(new GrammarBuilder(clist));  
  311.                 try  
  312.                 {  
  313.                     sre.RequestRecognizerUpdate();  
  314.                     sre.LoadGrammar(gr);  
  315.                     sre.SpeechRecognized += sre_SpeechRecognized;  
  316.                     sre.SetInputToDefaultAudioDevice();  
  317.                     sre.RecognizeAsync(RecognizeMode.Multiple);  
  318.                 }  
  319.                 catch (Exception ex)  
  320.                 {  
  321.                      this.ClientScript.RegisterStartupScript(this.GetType(), "alert""<script language=\"javascript\">" + "alert('Error');</script>");  
  322.                 }  
  323.             }  
  324.             else if (row.Cells[0].Text == "7")  
  325.             {  
  326.                 ss.SelectVoiceByHints(VoiceGender.Female);  
  327.                 ss.Volume = 100;  
  328.                 ss.Rate = -3;  
  329.                 pb.ClearContent();  
  330.                 pb.AppendText(lbl1.Text);  
  331.                 ss.Speak(pb);  
  332.                 Thread.Sleep(1500);  
  333.   
  334.                 ss.SelectVoiceByHints(VoiceGender.Male);  
  335.                 pb.ClearContent();  
  336.                 pb.AppendText("Options are ");  
  337.                 ss.Speak(pb);  
  338.   
  339.                 optiona = rblist1.Text;  
  340.                 optionb = rblist2.Text;  
  341.                 optionc = "Not Sure";  
  342.   
  343.                 pb.ClearContent();  
  344.                 pb.AppendText(optiona);  
  345.                 ss.Speak(pb);  
  346.                 Thread.Sleep(700);  
  347.   
  348.                 pb.ClearContent();  
  349.                 pb.AppendText(optionb);  
  350.                 ss.Speak(pb);  
  351.                 Thread.Sleep(700);  
  352.   
  353.                 pb.ClearContent();  
  354.                 pb.AppendText(optionc);  
  355.                 ss.Speak(pb);  
  356.                 Thread.Sleep(150);  
  357.                 clist.Add(new string[] { "Yes""No""Not Sure" });  
  358.                 Grammar gr = new Grammar(new GrammarBuilder(clist));  
  359.                 try  
  360.                 {  
  361.                     sre.RequestRecognizerUpdate();  
  362.                     sre.LoadGrammar(gr);  
  363.                     sre.SpeechRecognized += sre_SpeechRecognized;  
  364.                     sre.SetInputToDefaultAudioDevice();  
  365.                     sre.RecognizeAsync(RecognizeMode.Multiple);  
  366.                 }  
  367.                 catch (Exception ex)  
  368.                 {  
  369.                      this.ClientScript.RegisterStartupScript(this.GetType(), "alert""<script language=\"javascript\">" + "alert('Error');</script>");  
  370.                 }  
  371.             }  
  372.             else if (row.Cells[0].Text == "8")  
  373.             {  
  374.                 ss.SelectVoiceByHints(VoiceGender.Female);  
  375.                 ss.Volume = 100;  
  376.                 ss.Rate = -3;  
  377.                 pb.ClearContent();  
  378.                 pb.AppendText(lbl1.Text);  
  379.                 ss.Speak(pb);  
  380.                 Thread.Sleep(1500);  
  381.   
  382.                 ss.SelectVoiceByHints(VoiceGender.Male);  
  383.                 pb.ClearContent();  
  384.                 pb.AppendText("Options are ");  
  385.                 ss.Speak(pb);  
  386.   
  387.                 optiona = rblist1.Text;  
  388.                 optionb = rblist2.Text;  
  389.                 optionc = "Not Sure";  
  390.   
  391.                 pb.ClearContent();  
  392.                 pb.AppendText(optiona);  
  393.                 ss.Speak(pb);  
  394.                 Thread.Sleep(700);  
  395.   
  396.                 pb.ClearContent();  
  397.                 pb.AppendText(optionb);  
  398.                 ss.Speak(pb);  
  399.                 Thread.Sleep(700);  
  400.   
  401.                 pb.ClearContent();  
  402.                 pb.AppendText(optionc);  
  403.                 ss.Speak(pb);  
  404.                 Thread.Sleep(150);  
  405.                 clist.Add(new string[] { "Yes""No""Not Sure" });  
  406.                 Grammar gr = new Grammar(new GrammarBuilder(clist));  
  407.                 try  
  408.                 {  
  409.                     sre.RequestRecognizerUpdate();  
  410.                     sre.LoadGrammar(gr);  
  411.                     sre.SpeechRecognized += sre_SpeechRecognized;  
  412.                     sre.SetInputToDefaultAudioDevice();  
  413.                     sre.RecognizeAsync(RecognizeMode.Multiple);  
  414.                 }  
  415.                 catch (Exception ex)  
  416.                 {  
  417.                       this.ClientScript.RegisterStartupScript(this.GetType(), "alert""<script language=\"javascript\">" + "alert('Error');</script>");  
  418.                 }  
  419.             }  
  420.             else if (row.Cells[0].Text == "9")  
  421.             {  
  422.                 ss.SelectVoiceByHints(VoiceGender.Female);  
  423.                 ss.Volume = 100;  
  424.                 ss.Rate = -3;  
  425.                 pb.ClearContent();  
  426.                 pb.AppendText(lbl1.Text);  
  427.                 ss.Speak(pb);  
  428.                 Thread.Sleep(1500);  
  429.   
  430.                 ss.SelectVoiceByHints(VoiceGender.Male);  
  431.                 pb.ClearContent();  
  432.                 pb.AppendText("Options are ");  
  433.                 ss.Speak(pb);  
  434.   
  435.                 optiona = rblist1.Text;  
  436.                 optionb = rblist2.Text;  
  437.                 optionc = "Not Sure";  
  438.   
  439.                 pb.ClearContent();  
  440.                 pb.AppendText(optiona);  
  441.                 ss.Speak(pb);  
  442.                 Thread.Sleep(700);  
  443.   
  444.                 pb.ClearContent();  
  445.                 pb.AppendText(optionb);  
  446.                 ss.Speak(pb);  
  447.                 Thread.Sleep(700);  
  448.   
  449.                 pb.ClearContent();  
  450.                 pb.AppendText(optionc);  
  451.                 ss.Speak(pb);  
  452.                 Thread.Sleep(150);  
  453.                 clist.Add(new string[] { "Yes""No""Not Sure" });  
  454.                 Grammar gr = new Grammar(new GrammarBuilder(clist));  
  455.                 try  
  456.                 {  
  457.                     sre.RequestRecognizerUpdate();  
  458.                     sre.LoadGrammar(gr);  
  459.                     sre.SpeechRecognized += sre_SpeechRecognized;  
  460.                     sre.SetInputToDefaultAudioDevice();  
  461.                     sre.RecognizeAsync(RecognizeMode.Multiple);  
  462.                 }  
  463.                 catch (Exception ex)  
  464.                 {  
  465.                      this.ClientScript.RegisterStartupScript(this.GetType(), "alert""<script language=\"javascript\">" + "alert('Error');</script>");  
  466.                 }  
  467.             }  
  468.             else if (row.Cells[0].Text == "10")  
  469.             {  
  470.                 ss.SelectVoiceByHints(VoiceGender.Female);  
  471.                 ss.Volume = 100;  
  472.                 ss.Rate = -3;  
  473.                 pb.ClearContent();  
  474.                 pb.AppendText(lbl1.Text);  
  475.                 ss.Speak(pb);  
  476.                 Thread.Sleep(1500);  
  477.   
  478.                 ss.SelectVoiceByHints(VoiceGender.Male);  
  479.                 pb.ClearContent();  
  480.                 pb.AppendText("Options are ");  
  481.                 ss.Speak(pb);  
  482.   
  483.                 optiona = rblist1.Text;  
  484.                 optionb = rblist2.Text;  
  485.                 optionc = "Not Sure";  
  486.   
  487.                 pb.ClearContent();  
  488.                 pb.AppendText(optiona);  
  489.                 ss.Speak(pb);  
  490.                 Thread.Sleep(700);  
  491.   
  492.                 pb.ClearContent();  
  493.                 pb.AppendText(optionb);  
  494.                 ss.Speak(pb);  
  495.                 Thread.Sleep(700);  
  496.   
  497.                 pb.ClearContent();  
  498.                 pb.AppendText(optionc);  
  499.                 ss.Speak(pb);  
  500.                 Thread.Sleep(150);  
  501.                 clist.Add(new string[] { "Yes""No""Not Sure" });  
  502.                 Grammar gr = new Grammar(new GrammarBuilder(clist));  
  503.                 try  
  504.                 {  
  505.                     sre.RequestRecognizerUpdate();  
  506.                     sre.LoadGrammar(gr);  
  507.                     sre.SpeechRecognized += sre_SpeechRecognized;  
  508.                     sre.SetInputToDefaultAudioDevice();  
  509.                     sre.RecognizeAsync(RecognizeMode.Multiple);  
  510.                 }  
  511.                 catch (Exception ex)  
  512.                 {  
  513.                     this.ClientScript.RegisterStartupScript(this.GetType(), "alert""<script language=\"javascript\">" + "alert('Error');</script>");  
  514.                 }  
  515.             }  
  516.         }  
  517.     }  
  518.   
  519.   void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)  
  520.   {  
  521.         foreach (GridViewRow row in gvtemperament.Rows)  
  522.         {  
  523.             RadioButton rblist1 = ((RadioButton)row.FindControl("rdTemp_Opt1"));  
  524.             RadioButton rblist2 = ((RadioButton)row.FindControl("rdTemp_Opt2"));  
  525.             RadioButton rblist3 = ((RadioButton)row.FindControl("rdTemp_Opt3"));  
  526.             Label lbl1 = (Label)row.FindControl("lbl_desc");  
  527.   
  528.             if (row.Cells[0].Text == "1")  
  529.             {  
  530.                 if (e.Result.Text == "Yes")  
  531.                 {                       
  532.                     rblist1.Checked = true;  
  533.                     rblist1.Text = "Narendran";  
  534.                 }  
  535.                 else if (e.Result.Text == "No")  
  536.                 {  
  537.                     rblist2.Checked = true;  
  538.                         rblist1.Text = "Naren";  
  539.                 }  
  540.                 else //if (e.Result.Text == "Not Sure")  
  541.                 {  
  542.                     rblist3.Checked = true;  
  543.                     rblist1.Text = "Chk";  
  544.                 }  
  545.             }  
  546.             else if (row.Cells[0].Text == "2")  
  547.             {  
  548.                 if (e.Result.Text == "Yes")  
  549.                 {  
  550.                     rblist1.Checked = true;  
  551.                     rblist1.Text = "Round2";  
  552.                 }  
  553.                 else if (e.Result.Text == "No")  
  554.                 {  
  555.                     rblist2.Checked = true;  
  556.                     rblist2.Text = "Round2";  
  557.                 }  
  558.                 else //if (e.Result.Text == "Not Sure")  
  559.                 {  
  560.                     rblist3.Checked = true;   
  561.                     rblist3.Text = "Round2";  
  562.                 }  
  563.             }  
  564.   
  565.             else if (row.Cells[0].Text == "3")  
  566.             {  
  567.                 if (e.Result.Text == "Yes")  
  568.                 {  
  569.                     rblist1.Checked = true;  
  570.                 }  
  571.                 else if (e.Result.Text == "No")  
  572.                 {  
  573.                     rblist2.Checked = true;  
  574.                 }  
  575.                 else //if (e.Result.Text == "Not Sure")  
  576.                 {  
  577.                     rblist3.Checked = true;  
  578.                 }  
  579.             }  
  580.   
  581.             else if (row.Cells[0].Text == "4")  
  582.             {  
  583.                 if (e.Result.Text == "Yes")  
  584.                 {  
  585.                     rblist1.Checked = true;  
  586.                 }  
  587.                 else if (e.Result.Text == "No")  
  588.                 {  
  589.                     rblist2.Checked = true;  
  590.                 }  
  591.                 else //if (e.Result.Text == "Not Sure")  
  592.                 {  
  593.                     rblist3.Checked = true;  
  594.                 }  
  595.             }  
  596.   
  597.             else if (row.Cells[0].Text == "5")  
  598.             {  
  599.                 if (e.Result.Text == "Yes")  
  600.                 {  
  601.                     rblist1.Checked = true;  
  602.                 }  
  603.                 else if (e.Result.Text == "No")  
  604.                 {  
  605.                     rblist2.Checked = true;  
  606.                 }  
  607.                 else //if (e.Result.Text == "Not Sure")  
  608.                 {  
  609.                     rblist3.Checked = true;  
  610.                 }  
  611.             }  
  612.   
  613.             else if (row.Cells[0].Text == "6")  
  614.             {  
  615.                 if (e.Result.Text == "Yes")  
  616.                 {  
  617.                     rblist1.Checked = true;  
  618.                 }  
  619.                 else if (e.Result.Text == "No")  
  620.                 {  
  621.                     rblist2.Checked = true;  
  622.                 }  
  623.                 else //if (e.Result.Text == "Not Sure")  
  624.                 {  
  625.                     rblist3.Checked = true;  
  626.                 }  
  627.             }  
  628.             else if (row.Cells[0].Text == "7")  
  629.             {  
  630.                 if (e.Result.Text == "Yes")  
  631.                 {  
  632.                     rblist1.Checked = true;  
  633.                 }  
  634.                 else if (e.Result.Text == "No")  
  635.                 {  
  636.                     rblist2.Checked = true;  
  637.                 }  
  638.                 else //if (e.Result.Text == "Not Sure")  
  639.                 {  
  640.                     rblist3.Checked = true;  
  641.                 }  
  642.             }  
  643.   
  644.             else if (row.Cells[0].Text == "8")  
  645.             {  
  646.                 if (e.Result.Text == "Yes")  
  647.                 {  
  648.                     rblist1.Checked = true;  
  649.                 }  
  650.                 else if (e.Result.Text == "No")  
  651.                 {  
  652.                     rblist2.Checked = true;  
  653.                 }  
  654.                 else //if (e.Result.Text == "Not Sure")  
  655.                 {  
  656.                     rblist3.Checked = true;  
  657.                 }  
  658.             }  
  659.   
  660.             else if (row.Cells[0].Text == "9")  
  661.             {  
  662.                 if (e.Result.Text == "Yes")  
  663.                 {  
  664.                     rblist1.Checked = true;  
  665.                 }  
  666.                 else if (e.Result.Text == "No")  
  667.                 {  
  668.                     rblist2.Checked = true;  
  669.                 }  
  670.                 else //if (e.Result.Text == "Not Sure")  
  671.                 {  
  672.                     rblist3.Checked = true;  
  673.                 }  
  674.             }  
  675.   
  676.             else if (row.Cells[0].Text == "10")  
  677.             {  
  678.                 if (e.Result.Text == "Yes")  
  679.                 {  
  680.                     rblist1.Checked = true;  
  681.                 }  
  682.                 else if (e.Result.Text == "No")  
  683.                 {  
  684.                     rblist2.Checked = true;  
  685.                 }  
  686.                 else //if (e.Result.Text == "Not Sure")  
  687.                 {  
  688.                     rblist3.Checked = true;  
  689.                 }  
  690.             }  
  691.             else  
  692.             {  
  693.   
  694.             }  
  695.         }  
  696.     }    
 

Please do the needful.

Narendran Namachivayam.


Answers (2)