当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 比如鼠标移到一个超级链接上,显示它的有关信息 ......
 ·一个实例化的问题    »显示摘要«
    摘要: code1: class aa{ int i= 3; public void dd() { if(i==3){ return; // system.out.println("nfds"); } } public static void main(string[]args) { new aa().dd(); } } code2:......


asp.net下DataGrid数据批量提交问题

设计原则是这样的,因为用户在录入的时候需要选择若干品种,所以想用个GRID或者表格的控件显示出所有品种,后面的数据直接输入。  
  格式如下:  
  ====================  
  品种       |       数据           |  
  ====================  
  品种1     |     TEXTBOX       |  
  ====================  
  品种2     |     TEXTBOX       |  
  ====================  
  品种3     |     TEXTBOX       |  
  ====================  
   
  我用DATAGRID绑定了品种这个字段,数据是绑定的一个模板列,在显示的时候是一个TEXTBOX,HTML代码如下:  
  <asp:DataGrid   id="DataGrid1"   style="Z-INDEX:   101;   LEFT:   336px;   POSITION:   absolute;   TOP:   168px"  
  runat="server"   AutoGenerateColumns="False">  
  <Columns>  
  <asp:BoundColumn   DataField="品种"   ReadOnly="True"   HeaderText="品种"></asp:BoundColumn>  
  <asp:TemplateColumn   HeaderText="数据">  
  <ItemTemplate>  
  <asp:TextBox   id=TextBox1   runat="server"   Text=<%#   DataBinder.Eval(Container,   "DataItem.数据")   %>>  
  </asp:TextBox>  
  </ItemTemplate>  
  </asp:TemplateColumn>  
  </Columns>  
  </asp:DataGrid>  
   
  我用一个按纽来批量提交所有录入的数据,问题是提交的时候如何获取DATAGRID所有行的TEXTBOX的值,并且对应到每个品种,写入数据库。请高手指点一下,或者有没有比较方便的用于ASP。NET下的数据录入的表格控件,前提是可以绑定品种。

NO.1   作者: saucer

just   iterate   throught   DataGrid1.Items   collection,   if   you   are   use   DataSet/DataTable   directly,   you   can   consider   to   retrieve   the   data   from   the   database   first,   then   move   the   user   changes   into   the   datatable,   then   user   a   DataAdapter   to   update   the   database  
   
  foreach   (DataGridItem   dgi   in   DataGrid1.Items)  
  {  
      TextBox   t   =   dgi.FindControl("TextBox1")   as   TextBox1;  
      string   s   =   t.Text;  
      ....  
  }


    摘要: 比如说,在c#程序中,如何把“编码规范”转换为“編碼規范”,谢谢! ......
» 本期热门文章:
· 热门栏目:
» 相关精选文章
» 其它相关:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE