2012-05-14 34 views
0

我有這個gridview頁腳行啓用插入新行。但是我不知道如何在sqldatasource中使用insert參數綁定文本框。請幫忙?如何綁定gridview templatefield footer文本框來插入參數?

  <asp:TemplateField HeaderText="Region Name" SortExpression="regionName"> 
       <FooterTemplate> 
         <asp:TextBox ID="tbInsert" runat="server" Text="" ></asp:TextBox> 
       </FooterTemplate> 
      </asp:TemplateField> 

回答

1

明白了,這樣做是在後面的代碼:

 if (e.CommandName == "Insert") 
     { 
      TextBox tbInsert = grv_regionManagement.FooterRow.FindControl("tbInsert") as TextBox; 
      sds_regions.InsertParameters["regionName"].DefaultValue = tbInsert.Text; 
      sds_regions.Insert(); 
     } 
相關問題