2011-01-06 102 views
0

我有一個WebForm在我打電話的功能下拉()從cs文件錯誤在asp.net C#代碼

參考:同我的朋友依禪張貼在Calling a C# function in asp.net

我得到誤差爲:

Error 1 'DropDown' does not contain a definition for 'DropDown' and no extension method 'DropDown' accepting a first argument of type 'DropDown' could be found (are you missing a using directive or an assembly reference?)

aspx.cs代碼如下:

using System; 
using System.Configuration; 
using System.Data; 
using System.Linq; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.HtmlControls; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Xml.Linq; 
using System.Data.Odbc; 
using System.Data.SqlClient; 
using System.Collections; 
using System.IO; 
using iTextSharp.text.html.simpleparser; 
using iTextSharp.text; 
using iTextSharp.text.pdf; 
using iTextSharp.text.html; 
public partial class _Default : System.Web.UI.Page 
{ 

    protected void Page_Load(object sender, EventArgs e) 
    { 

    } 
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) 
    { 
     DropDown abs =new DropDown(this.DropDownList2,this.DropDownList3); 
     abs.DropDown(); 
    } 

    //*******On click of GO 

    public void Button1_Click(object sender, EventArgs e) 
    { 
     Button4.Visible = true; 
     String dbDate = DateTime.ParseExact(TextBox3.Text, "dd/mm/yyyy", null).ToString("yyyy-mm-dd"); 


     String respo1 = ""; 
     String respo2 = ""; 
     String editorcont1 = ""; 
     int res = 0; 
     String sb = ""; 

     String petitioner = ""; 
     String petitioner1 = ""; 
     String resp = ""; 
     String resp1 = ""; 

     String respondants = ""; 
     String addr1 = ""; 
     String addr2 = ""; 


     var order = ""; 

     String nextdate = ""; 
     String nextdate1 = "**/**/****"; 
     String judge1 = ""; 
     String judge2 = ""; 
     String judge3 = ""; 



     String a = DropDownList1.SelectedItem.Value; 
     String b = DropDownList3.SelectedItem.Value.PadLeft(3, '0'); 
     String c = TextBox1.Text.PadLeft(5, '0').ToString(); 
     String d = TextBox2.Text.ToString(); 
     String digit = a + b + c + d; 
     String jjj = ""; 


     try 
     { 
      OdbcConnection casetype = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=10.155.160.130;Database=testcase;User=root;Password=;Option=3;"); 
      casetype.Open(); 

      String petresquery1 = "select fil_no from testcase.main where reg_no =? OR fil_no=?"; 
      OdbcCommand petrescmd1 = new OdbcCommand(petresquery1, casetype); 
      petrescmd1.Parameters.AddWithValue("?", digit); 
      petrescmd1.Parameters.AddWithValue("?", digit); 
      OdbcDataReader respetMyReader1 = petrescmd1.ExecuteReader(); 

      while (respetMyReader1.Read()) 
      { 
       String fil_no = respetMyReader1["fil_no"].ToString(); 
       HiddenField4.Value = fil_no; 
       //Response.Write(HiddenField4.Value); 
      } 





      string showmodifquery = "select notice from notice_aspx where fil_no=?"; 

      OdbcCommand showmodifcmd = new OdbcCommand(showmodifquery, casetype); 

      showmodifcmd.Parameters.AddWithValue("?", HiddenField4.Value); 
      OdbcDataReader showmodifMyReader = showmodifcmd.ExecuteReader(); 

      if (showmodifMyReader.Read()) 
      { 
       String showmodif1 = showmodifMyReader["notice"].ToString(); 
       Editor1.Content = showmodif1; 
      } 
      else 
      { 
       //************to get case type  
       string casetypequery = "select casename from casetype where skey=?"; 
       //************to get pet res 
       string petresquery = "select pet_name,res_name from testcase.main where reg_no =? OR fil_no=?"; 
       //*******to get respondants 
       string respoquery = "SELECT sr_no,partyname,addr1,addr2 FROM testcase.party where fil_no=? and pet_res='R'order by sr_no,party_lh,party_lh2,party_lh3,party_lh4,party_lh5"; 
       //*******to get order 
       string ordequery = "select orde from testcase.orddetpabak where fil_no=? and orderdate=?"; 
       //*********to get next date 
       string nextdatequery = "SELECT next_dt FROM testcase.heardt where fil_no=? and next_dt>?;"; 
       //*********to get jud1 
       string jud1query = "select jname from testcase.orddetpabak,testcase.judge where orddetpabak.jud1 = judge.jcode and fil_no=? and orderdate=?;"; 
       //*********to get jud2 
       string jud2query = "select jname from testcase.orddetpabak,testcase.judge where orddetpabak.jud2 = judge.jcode and fil_no=? and orderdate=?;"; 
       //*********to get jud3 
       string jud3query = "select jname from testcase.orddetpabak,testcase.judge where orddetpabak.jud3 = judge.jcode and fil_no=? and orderdate=?;"; 

       //************to get case type 
       OdbcCommand casetypecmd = new OdbcCommand(casetypequery, casetype); 
       String casetypefromdropdown = DropDownList3.SelectedItem.ToString(); 
       casetypecmd.Parameters.AddWithValue("?", casetypefromdropdown); 
       using (OdbcDataReader casetypeMyReader = casetypecmd.ExecuteReader()) 
       { 
        while (casetypeMyReader.Read()) 
        { 
         String casename = casetypeMyReader["casename"].ToString(); 
         HiddenField1.Value = casename; 
        } 
       } 

       //************to get pet res 
       OdbcCommand petrescmd = new OdbcCommand(petresquery, casetype); 
       petrescmd.Parameters.AddWithValue("?", digit); 
       petrescmd.Parameters.AddWithValue("?", digit); 
       using (OdbcDataReader respetMyReader = petrescmd.ExecuteReader()) 
       { 
        while (respetMyReader.Read()) 
        { 
         petitioner1 = respetMyReader["pet_name"].ToString(); 

         //petitioner1 = petitioner.Substring(0, 1) + petitioner.Substring(1).ToLower(); 
         resp1 = respetMyReader["res_name"].ToString(); 
         //resp1 = resp.Substring(0, 1) + resp.Substring(1).ToLower(); 

         //String fil_no = respetMyReader["fil_no"].ToString(); 
         //HiddenField4.Value = fil_no; 
         ////Response.Write(HiddenField4.Value); 
        } 
        if (petitioner1 == "") 
        { 
         Response.Write("<b><font color='red'>Wrong Entry!!!"); 
        } 
       } 


       //*******to get respondants 

       String respo = HiddenField4.Value; 
       OdbcCommand respocmd = new OdbcCommand(respoquery, casetype); 
       respocmd.Parameters.AddWithValue("?", respo); 
       using (OdbcDataReader respoMyReader = respocmd.ExecuteReader()) 
       { 
        while (respoMyReader.Read()) 
        { 
         respo1 = respoMyReader["sr_no"].ToString(); 
         respo2 = respoMyReader["partyname"].ToString(); 
         addr1 = respoMyReader["addr1"].ToString(); 
         addr2 = respoMyReader["addr2"].ToString(); 
         res = Convert.ToInt32(respo1); 
         //Response.Write(res); 
         //Response.Write(respo2); 

         //editorcont1 = "<table><tr><td width='10'>" + res + "</td><td>"+"<P align= 'left'>"+ respo2 +"</P></td>"+"</br>"; 

         ////HiddenField7.Value = editorcont1; 
         //asd(editorcont1); 

         //respondants = respo2.Substring(0, 1) + respo2.Substring(1).ToLower(); 
         //addr1 = addr1.Substring(0, 1) + addr1.Substring(1).ToLower(); 
         //addr2 = addr2.Substring(0, 1) + addr2.Substring(1).ToLower(); 
         editorcont1 = res + ")&nbsp;&nbsp;" + respo2 + "<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + addr1 + "&nbsp;&nbsp;" + addr2 + "<br/>"; 
         sb = sb + editorcont1; 
        } 
       } 

       //*******to get order 
       OdbcCommand ordecmd = new OdbcCommand(ordequery, casetype); 
       ordecmd.Parameters.AddWithValue("?", HiddenField4.Value); 
       ordecmd.Parameters.AddWithValue("?", dbDate); 
       using (OdbcDataReader ordeMyReader = ordecmd.ExecuteReader()) 
       { 
        while (ordeMyReader.Read()) 
        { 
         order = ordeMyReader["orde"].ToString(); 
        } 

       } 
       //*******to get nextdate 
       OdbcCommand nextdatecmd = new OdbcCommand(nextdatequery, casetype); 
       nextdatecmd.Parameters.AddWithValue("?", HiddenField4.Value); 
       nextdatecmd.Parameters.AddWithValue("?", dbDate); 
       using (OdbcDataReader nextdateMyReader = nextdatecmd.ExecuteReader()) 
       { 
        while (nextdateMyReader.Read()) 
        { 
         nextdate = nextdateMyReader["next_dt"].ToString(); 

        } 
       nextdate1 = Convert.ToDateTime(nextdate).ToString("dd/MM/yyyy"); 


       } 

       //*********to get jud1 
       OdbcCommand jud1cmd = new OdbcCommand(jud1query, casetype); 
       jud1cmd.Parameters.AddWithValue("?", HiddenField4.Value); 
       jud1cmd.Parameters.AddWithValue("?", dbDate); 
       using (OdbcDataReader jud1MyReader = jud1cmd.ExecuteReader()) 
       { 
        while (jud1MyReader.Read()) 
        { 
         judge1 = jud1MyReader["jname"].ToString(); 
         jjj = "J"; 
        } 
       } 


       //*********to get jud2 
       OdbcCommand jud2cmd = new OdbcCommand(jud2query, casetype); 
       jud2cmd.Parameters.AddWithValue("?", HiddenField4.Value); 
       jud2cmd.Parameters.AddWithValue("?", dbDate); 
       using (OdbcDataReader jud2MyReader = jud2cmd.ExecuteReader()) 
       { 
        while (jud2MyReader.Read()) 
        { 
         judge2 = jud2MyReader["jname"].ToString(); 
         jjj = "JJ"; 
        } 
       } 


       //*********to get jud3 
       OdbcCommand jud3cmd = new OdbcCommand(jud3query, casetype); 
       jud3cmd.Parameters.AddWithValue("?", HiddenField4.Value); 
       jud3cmd.Parameters.AddWithValue("?", dbDate); 
       using (OdbcDataReader jud3MyReader = jud3cmd.ExecuteReader()) 
       { 
        while (jud3MyReader.Read()) 
        { 
         judge3 = jud3MyReader["jname"].ToString(); 
         jjj = "JJJ"; 
        } 
       } 






       String tyear = TextBox2.Text; 
       tyear = tyear.Remove(0, 2); 

       String year = DateTime.Now.Year.ToString(); 
       year = year.Remove(0, 2); 

       TextBox4.Text = order; 

       string editorcontents = 
     "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No. J/" + DropDownList3.SelectedItem + "-" + TextBox1.Text + "-" + tyear + "/" + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "/" + year + 
     "<br/>" + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date:" + DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + 

     "<br/>" + "<P align='center'><b> IN THE HIGH COURT OF BOMBAY AT GOA </b></P>" + 
     "<P align='center'><b>PANAJI GOA</font></b></P>" + 
     "<br/>" + "<P align='center'><u><b>" + HiddenField1.Value + " NO. " + TextBox1.Text + " OF " + TextBox2.Text + "</b></u></P>" + 
     "<P align='center'><font size=3>(Under Article 227 of the Constitution of India)</font> </P>" + 

     "<br />" + 
     "<table><tr><td width='750px'><p align='left'>" + petitioner1 + "</p>" + "</td><td>" + "<p align='right'>" + "..Petitioner" + "</p>" + "</td></tr>" + "<tr><td><p align='center'>" + "V/s" + "</p>" + "</td><td></td>" + "</tr>" + "<tr><td width='75px'><p align='left'>" + resp1 + "</p>" + "</td><td>" + "<p align='right'>" + "..Respondent" + "</p>" + "</td></tr></table>" + 
        //"<p align='left'>" + petitioner1 + "<p align='right'>" + "...petitioner"+"</p>"+ 

     "<br/>" + "<P align= 'left'>From" + 
     "<br/>" + "Assistant Registrar," + 
     "<br/>" + "High Court Of Bombay at Goa Panaji Bench</P>" + 


     "<br/>" + "<P align= 'left'>To,</P>" + 
     "<br/>" + sb + "</br>" + 


     "<br/>" + "<P align= 'left'>Sir,</P></br>" + 
     "<P align='justify'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "The Petitioner abovenamed having presented a Petition to this Court under Article 227 of the Constitution of India, praying for reliefs as stated in the accompanying copy of the petition and the same having been registered in this Court as Writ Petition and this Court, having on the " + 
     "<font color='#0000FF'>" + TextBox3.Text + "</font>" + " ordered to issue notice, I have the honour to inform you that the matter will come up for " + 
     "<b><u>" + "admission on " + "<font color='#0000FF'>" + nextdate1 + "</font>" + " at 10.30 a.m. or thereafter on any day as per the convenience of this Court," + "</u></b>" + 
     "and that if no appearance is made on your behalf either in person or by an Advocate of this Court or an agent duly authorized and instructed by you, it will be heard and determined in your absence." + "</P>" + 

     "<br/><P align='center'>" + "Coram : " + judge1 + ", " + judge2 + ", " + judge3 +jjj+ "</P>" + 


     "<br/>" + 
     "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<P align='justify'>" + order.Replace(Environment.NewLine, "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;") + "</P>" + 


     "<br/><br/>" + "<P align= 'right'>" + "By Order of the Court,".Replace(Environment.NewLine, "<br/>") + "</P>" + 
     "<br/><br/>" + "<P align= 'right'>(G. M. Redker)&nbsp;&nbsp;&nbsp;&nbsp;" + 
     "<br/>" + "Assistant Registrar &nbsp;" + 
     "<br/>" + "High Court of Bombay" + 
     "<br/>" + "Panaji Bench (Goa)&nbsp;&nbsp;&nbsp;" + "</P>" + 


     "<br/><P align='left'>" + "Enclosure :-" + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(i)Copy Of Petition" + "</P>" + 
     "<br/><P align='left'>" + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(ii)" + "</P>" + 
     "<br/><P align='left'>" + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(iii)" + "</P>" + 


     "<br/><P align='justify'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "N.B. :- Attention is invited to Rules 11 and 13, Chapter XVII of the High Court Appellate Side Rules, 1960, which reads as follows :-" + "</P>" + 
     "<br/><P align='justify'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "Rule 11 :- An answer to the rule nisi showing cause against such application shall be made by filing an affidavit in the Office of the Registrar and by serving a copy thereof upon the applicant or his Advocate or attorney, as the case may be, at least two days before the returnable date of the rule." + "</P>" +   "<br/><P align='justify'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "Rule 13 :- No further affidavit or affidavits shall be filed by any party except with the leave of the Court." + "</P>" + 
     "<br/><p align='left'>" + "ep/-" + 
     "<BLOCKQUOTE style='page-break-before: always'>xdfghfdhgrfgbx blah</BLOCKQUOTE>"; 

       Editor1.Content = editorcontents; 


    string editorcont2 = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No. J/" + DropDownList3.SelectedItem + "-" + TextBox1.Text + "-" + tyear + "/" + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "/" + year + 
            "<br/>" + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date:" + DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year + 

            "<br/> <br/>" + "<P align='center'><b> IN THE HIGH COURT OF BOMBAY AT GOA " + 
            "<br/>" + " PANAJI BENCH </b></P>" + 

            "</br>" + "<P align='center'>" + "<u><b>" + HiddenField1.Value + " NO. " + TextBox1.Text + " OF " + TextBox2.Text + " </P>" + "</b></u>" + 

            "<br/> <br/>" + "<P align='justify'> From," + 
            "<br/>" + " The ASSISTANT REGISTRAR " + 
            "<br/>" + " High Court of Bombay at Goa" + 
            "<br/>" + " Panaji Bench </P>" + 

            "<br/> <br/>" + "<P align='justify'> To," + 
            "<br/>" + " The Registrar," + 
            "<br/>" + " City Civil Court " + 
            "<br/>" + " Bangalore </P>" + 

            "<br/> <br/>" + "<P align='left'> Sir, </P>" + 


            "<br/>" + "<P align='justify'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "I have the honour to forward herewith the accompanying notice alongwith copy of petition for service on the Respondent No. 2 in the case noted above and to request you to be so good as to arrange to serve the Original copy and to return the office copy to this Court duly served AT THE EARLIEST by causing the Original notice to be delivered to the Respondent No. 2 and by obtaining the acknowledgement on the Office Copy. If the said notice does not fall under your jurisdiction, kindly forward the same to the Court under whose jurisdiction it comes, under intimation to this office. Service Report may please be translated to English, if written in any other language. </p>" + 

            "<br/><br/>" + "<P align= 'right'>" + "By Order of The Court," + 
            "<br/><br/>" + "(G. M. Redker)&nbsp;&nbsp;&nbsp;&nbsp;" + 
            "<br/>" + "Assistant Registrar &nbsp;" + 
            "<br/>" + "High Court of Bombay" + 
            "<br/>" + "Panaji Bench (Goa)&nbsp;&nbsp;&nbsp;</P>" + 
            "<br/> <P align='left'>Encl. " + 
            "<br/> rc/- </P>"; 
    Editor2.Content = editorcont2; 
      } 
     } 
     catch (Exception er) 
     { } 



    } 
    protected void Button2_Click(object sender, EventArgs e) 
    { 

     String dbDate = DateTime.ParseExact(TextBox3.Text, "dd/mm/yyyy", null).ToString("yyyy-mm-dd"); 

     //Extract data from Page (pd). 
     //Label16.Text = Editor1.Content; // Attribute 
     // makae ready HttpContext 
     HttpContext.Current.Response.Clear(); 
     HttpContext.Current.Response.ContentType = "application/pdf"; 
     // Create PDF document 
     Document pdfDocument = new Document(PageSize.A4, 80, 50, 30, 65); 


     PdfWriter wri = PdfWriter.GetInstance(pdfDocument, new FileStream("d://" + HiddenField1.Value + HiddenField4.Value + dbDate + ".pdf", FileMode.Create)); 

     PdfWriter.GetInstance(pdfDocument, HttpContext.Current.Response.OutputStream); 

     pdfDocument.Open(); 
     string htmlText = Editor1.Content; 
     //string htmlText = htmlText1.Replace(Environment.NewLine, "<br/>"); 
     System.Collections.Generic.List<IElement> htmlarraylist = HTMLWorker.ParseToList (new StringReader(htmlText), null); 
     //Paragraph paragraph = new Paragraph("This is my first line using Paragraph."); 
     //pdfDocument.Add(paragraph); 
     for (int k = 0; k < htmlarraylist.Count; k++) 
     { 
      pdfDocument.Add((IElement)htmlarraylist[k]); 

     } 

    //***********FORWARDING LETTER  
     pdfDocument.NewPage(); 
     string htmlText2 = Editor2.Content; 

     System.Collections.Generic.List<IElement> htmlarraylist2 = HTMLWorker.ParseToList(new StringReader(htmlText2), null); 
     for (int k = 0; k < htmlarraylist2.Count; k++) 
     { 
      pdfDocument.Add((IElement)htmlarraylist2[k]); 

     } 
     pdfDocument.Close(); 
     HttpContext.Current.Response.End(); 
    } 



    protected void Button3_Click(object sender, EventArgs e) 
    { 
     String dbDate = DateTime.ParseExact(TextBox3.Text, "dd/mm/yyyy", null).ToString("yyyy-mm-dd"); 

     OdbcConnection MyConnection = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=10.155.160.130;Database=testcase;User=root;Password=;Option=3;"); 
     MyConnection.Open(); 
     String MyString = "select notice from notice_aspx where fil_no=? and orderdate=?"; 
     OdbcCommand MyCmd = new OdbcCommand(MyString, MyConnection); 
     MyCmd.Parameters.AddWithValue("", HiddenField4.Value); 
     MyCmd.Parameters.AddWithValue("", dbDate); 
     using (OdbcDataReader MyReader4 = MyCmd.ExecuteReader()) 
     { 
      //** 
      if (MyReader4.Read()) 
      { 

       String MyString1 = "UPDATE notice_aspx SET notice=? where fil_no=? AND orderdate=?"; 
       OdbcCommand MyCmd1 = new OdbcCommand(MyString1, MyConnection); 
       MyCmd1.Parameters.AddWithValue("", Editor1.Content.ToString()); 
       MyCmd1.Parameters.AddWithValue("", HiddenField4.Value.ToString()); 
       MyCmd1.Parameters.AddWithValue("", dbDate); 
       MyCmd1.ExecuteNonQuery(); 
      } 



      else 
      { 

       // set the SQL string 
       String strSQL = "INSERT INTO notice_aspx (fil_no,notice,orderdate) " + 
       "VALUES (?,?,?)"; 

       // Create the Command and set its properties 
       OdbcCommand objCmd = new OdbcCommand(strSQL, MyConnection); 
       //Response.Write("****"+HiddenField4.Value); 
       objCmd.Parameters.AddWithValue("", HiddenField4.Value.ToString()); 
       objCmd.Parameters.AddWithValue("", Editor1.Content.ToString()); 
       objCmd.Parameters.AddWithValue("", dbDate); 

       // execute the command 
       objCmd.ExecuteNonQuery(); 



      } 


     } 
    } 
    protected void Button4_Click(object sender, EventArgs e) 
    { 

    } 
    protected void Button4_Click1(object sender, EventArgs e) 
    { 
     Editor2.Visible = true; 
    } 
} 

.CS代碼如下

請參考: Calling a C# function in asp.net 如何解決這個問題。

+0

請更多信息。向我們顯示導致錯誤的行。你確定你粘貼的信息完全正確嗎? (這看起來有點奇怪。)你在cs文件的頂部使用哪些語句? – 2011-01-06 08:04:40

+0

請檢查編輯的問題aspx.cs代碼是在我的問題和答案.cs代碼是在另一個問題,我已經提供的鏈接。我的問題中的字符超過了限制。 – Ninad 2011-01-06 08:22:11

+0

簡化版本的代碼隱藏文件(僅包含相關部分)就足夠了。 – M4N 2011-01-06 08:32:35

回答

0

您正試圖從DropDown類型的對象調用DropDown方法。那是什麼?

4

我不太明白你試圖做(類下拉的源代碼將幫助),但:

類下拉不能有一種稱爲下拉()。此名稱被保留用於構造函數,這樣你就可以調用它只能是這樣的:

var dd = new DropDown(); 

不能調用類的構造就像一個實例方法,因此此行給出了一個錯誤:

abs.DropDown(); 

如果這是您想要調用的方法,那麼將該方法重命名爲不同的方法(難以在不知道方法應該做什麼的情況下提供一個好名字)。