javascript for html buttons in c#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smfaheem
    New Member
    • Sep 2007
    • 1

    #1

    javascript for html buttons in c#

    I have a problen regarding javascript that , i m generating html buttons in c# file for asp.net webpage and applying javascript on that html button but it is giving exception .The code is

    try
    {
    string sql = "Select AdFile, AdLink, '" + StringFormat.To String() + "' as Sampleview, Adweightage, " +
    "'<input type=\"checkBox \" value=\"on\" name=\"selectCh k' + AdFile + '\">' as cusSelect, " +
    "'<input type=\"text\" size=\"10\" value=\"' + str(Adweightage ) + '\" name=\"txtAdwei ghtage' + AdFile + '\">' as cusAdweightage, " +
    "'<input type=\"submit\" value=\"Delete\ " onclick=\"retur n confirm('Are you sure want to delete?');\" name=\"btnDel' + AdFile + '\">' as cusDel, " +
    " iif(IsEnabled,' <input type=\"checkBox \" title=\"Enable\ " onclick=\"check Adcredits(this. name)\" checked value=\"on\" name=\"chkEnabl e' + AdFile + '\">','<input type=\"checkBox \" onclick=\"check Adcredits(this. name)\" title=\"Enable\ " value=\"on\" name=\"chkEnabl e' + AdFile + '\">') as cusEnable " +
    " FROM BuinessAds " +
    " WHERE BizId =" + BusinessID.Valu e + " AND AdType='Custom' ";
    onclick="return confirm('Are you sure want to delete?');"
    OdbcDataAdapter bizDataAdapter = new OdbcDataAdapter (sql, con);
    DataTable dt = new DataTable();
    bizDataAdapter. Fill(dt);
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Originally posted by smfaheem
    I have a problen regarding javascript that , i m generating html buttons in c# file for asp.net webpage and applying javascript on that html button but it is giving exception .The code is

    try
    {
    string sql = "Select AdFile, AdLink, '" + StringFormat.To String() + "' as Sampleview, Adweightage, " +
    "'<input type=\"checkBox \" value=\"on\" name=\"selectCh k' + AdFile + '\">' as cusSelect, " +
    "'<input type=\"text\" size=\"10\" value=\"' + str(Adweightage ) + '\" name=\"txtAdwei ghtage' + AdFile + '\">' as cusAdweightage, " +
    "'<input type=\"submit\" value=\"Delete\ " onclick=\"retur n confirm('Are you sure want to delete?');\" name=\"btnDel' + AdFile + '\">' as cusDel, " +
    " iif(IsEnabled,' <input type=\"checkBox \" title=\"Enable\ " onclick=\"check Adcredits(this. name)\" checked value=\"on\" name=\"chkEnabl e' + AdFile + '\">','<input type=\"checkBox \" onclick=\"check Adcredits(this. name)\" title=\"Enable\ " value=\"on\" name=\"chkEnabl e' + AdFile + '\">') as cusEnable " +
    " FROM BuinessAds " +
    " WHERE BizId =" + BusinessID.Valu e + " AND AdType='Custom' ";
    onclick="return confirm('Are you sure want to delete?');"
    OdbcDataAdapter bizDataAdapter = new OdbcDataAdapter (sql, con);
    DataTable dt = new DataTable();
    bizDataAdapter. Fill(dt);
    moved to .NET forum

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      Uhh you are aware that you're generating a pretty much worthless string right?
      All of those special asp calls have to happen at the parser on the server side.
      What you have is probably just going to wrtie plain html out to a page.

      Comment

      • davef
        New Member
        • Sep 2007
        • 98

        #4
        Huh? What are you trying to accomplish with that string??

        Comment

        Working...