2011-10-03 34 views
1

如何使用asp.net和C#。如何存儲在數據庫中。請任何一個幫助我,我事先是新來這個.Thanks創建動態文本動態文本框如何創建使用asp.net和C#

+0

您的要求都有些模糊,可能是單獨的問題。你能告訴我們你有*試圖做什麼嗎? – Josh

+0

通常情況下,如果您發佈一些代碼,以便我們可以看到您的位置,則會更好。 –

回答

1

我希望這可以幫助你: 進行數據訪問,你可以看看這裏: 2.下載 「專業Asp.Net 4(Wrox的)」或「微軟ASP.NET 4步驟通過步驟」

而對於附加的文本框的代碼(在這種情況下)在dinamically一個gridview是這樣

void addTextBoxInGridView() 
     { 
      int nr = 0, nc = 0; 
      nr = this.GridView1.Rows.Count; 
      if (nr > 0) 
      { 
       nc = this.GridView1.HeaderRow.Cells.Count; 

       int r = 0, c = 0; 
       for (r = 0; r < nr; r++) 
       { 
        for (c = 0; c < nc; c++) 
        { 
         string v1 = ""; 
         v1 = HttpUtility.HtmlDecode(this.GridView1.Rows[r].Cells[c].Text.ToString()); 

         TextBox textbox = new TextBox(); 
         textbox.Text = v1; 
         textbox.EnableViewState = true; 
         textbox.Style["text-align"] = "center"; 
         textbox.Width = 40; 
         textbox.ID = "txt" + Convert.ToString(r) + Convert.ToString(c); 
         this.GridView1.Rows[r].Cells[c].Controls.Add(textbox); 
        } 
       } 
      } 

     } 

快樂代碼!!

相關問題