日期:2014-05-17 浏览次数:20934 次
<asp:TemplateColumn HeaderText="月份">
<ItemStyle wrap="false" HorizontalAlign="left"></ItemStyle>
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "yue") %>' style="width:90" ID="Label31" name="Label3"/>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="edit_yue" onfocus="jlyz()" onblur="pdsz()" style="Font-Size:10pt;width:90;height:22;cursor:hand" Text='<%# DataBinder.Eval(Container.DataItem, "yue") %>'/>
</EditItemTemplate>
</asp:TemplateColumn>
TemplateColumn tem = new TemplateColumn();
tem.ItemStyle.Wrap = false;
Label label = new Label();
label.ID="label"+i;
label.Text=ds.Tables[0].Columns[i].ToString();
tem.ItemTemplate = (ITemplate)label;
TextBox tb = new TextBox();
tb.ID = "tb" + i;
tem.EditItemTemplate = (ITemplate)tb;
this.DataGrid.Columns.Add(tem);