补充一下:
<asp:DataGrid id="DataGrid2" Width="100%" style="BORDER-RIGHT: #99ccff 1px solid; BORDER-TOP: #99ccff 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #99ccff 1px solid; BORDER-BOTTOM: #99ccff 1px solid"
HeaderStyle-BackColor="#99ccff" AllowPaging="True" OnEditCommand="mydatagrid_edit"
OnCancelCommand="mydatagrid_cancel" OnUpdateCommand="mydatagrid_update" OnDeleteCommand="mydatagrid_delete"
DataKeyField="id" AutoGenerateColumns="False" runat="server">
<Columns>
<asp:EditCommandColumn HeaderText="操作" EditText="编辑" CancelText="取消" UpdateText="更新">
<ItemStyle Wrap="False" />
<HeaderStyle Width="90px" />
</asp:EditCommandColumn>
<asp:TemplateColumn HeaderText="指定组">
<ItemTemplate> <asp:DropDownList ID = "ddlgroup" runat="server" DataTextField="groupname" DataValueField="gid" DataSourceID="SqlDataSource1"> </asp:DropDownList> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString=" <%$ ConnectionStrings:TY3LConnectionString %>"
SelectCommand="select u.id,g.id as gid,g.groupname,u.userno,u.username,u.userpwd,u.macaddress,u.keyvalue,u.memo from tblusers u left join tblgroup g on u.groupid=g.id" >
</asp:SqlDataSource>
</ItemTemplate>
<HeaderStyle CssClass="inputs" Width="132px" />
</asp:TemplateColumn>
<asp:BoundColumn DataField="memo" HeaderText="备注">
<HeaderStyle Width="132px" />
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="操作">
<ItemTemplate>
<asp:Button ID="Delete" CommandName="delete" Text="删 除" Runat="server" CssClass="inputs"> </asp:Button>
</ItemTemplate>
<HeaderStyle CssClass="inputs" Width="132px" />
</asp:TemplateColumn>
</Columns>
<PagerStyle Visible="False"> </PagerStyle>
<HeaderStyle BackColor="#99CCFF" />
</asp:DataGrid>