Pawan Rajesh

Pawan Rajesh

  • NA
  • 5
  • 852

Single quote inside double quote in c#

Apr 10 2015 9:52 AM
I want to result like this --- onclick=onclick="report('a1')" --- Please help me 
C#-- Code
strHTML = "<table id='table1'> <colgroup><col width='190'/></colgroup><tbody>";                 for (int i = 0; i < objDs.Tables[0].Rows.Count; i++)                 {                     if (i <= 10)                     {                         strUniqueID = "a" + i;                         strBGColor = "a" + i.ToString();                     }                     else                     {                         strUniqueID = "a" + i;                         strBGColor = "a" + (i - 1);                     }                     strSubject = objDs.Tables[0].Rows[i]["SubjectName"].ToString();                     iSubjectID = Convert.ToInt32(objDs.Tables[0].Rows[i]["Subjectid"]);                       strHTML = strHTML + "<tr><td class='dark'><div id='" + strUniqueID + "' class='drag clone " + strBGColor + "'>" + strSubject + "</div><input id='b_" + strUniqueID + "' class='" + strUniqueID + "' type='button' value='' onclick='report(" + strUniqueID + ")' title='Show only " + strSubject + "'/></td></tr>";                   }                 strHTML = strHTML + "<tr><td class='trash' title='Trash'>Trash</td></tr>";                 strHTML = strHTML + "</tbody></table>";                 left.InnerHtml = strHTML;


---OutPut
English Test P
<input id='b_a0' class='a0' type='button' value='' onclick='report(a0)' title='Show only English Test P'/>
Kunal
<input id='b_a1' class='a1' type='button' value='' onclick='report(a1)' title='Show only Kunal'/>
Kunwar
<input id='b_a2' class='a2' type='button' value='' onclick='report(a2)' title='Show only Kunwar'/>
Maths
<input id='b_a3' class='a3' type='button' value='' onclick='report(a3)' title='Show only Maths'/>
Maths Test
<input id='b_a4' class='a4' type='button' value='' onclick='report(a4)' title='Show only Maths Test'/>
Raj
<input id='b_a5' class='a5' type='button' value='' onclick='report(a5)' title='Show only Raj'/>
Trash

Answers (1)