nbsp;ID="txtGender" runat="server" RepeatColumns="2">
<asp:ListItem Text=''男''></asp:ListItem>
<asp:ListItem Text=''女''></asp:ListItem>
</asp:RadioButtonList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="学历">
<ItemTemplate>
<asp:DropDownList ID="txtClassName" runat="server">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|ASPNET20Book.mdb;Persist Security Info=True"
ProviderName= "System.Data.OleDb" SelectCommand="SELECT * FROM [Student]"
UpdateCommand= "Update [Student] Set Title = @Title,Gender = @Gender,ClassName=@ClassName Where id=@id">
</asp:SqlDataSource>
<asp:Button ID="Button1" runat="server" Text="保存所有修改" OnClick="XianhuiMeng_Click" />
</form>
</body>
</html>
注意:对于SQL Server 数据库,参数名字不加@。另外注意:不同数据库类型和不同的数据源,UpdateCommand="Update [Student] Set Title = @Title,Gender = @Gender,ClassName=@ClassName Where id=@id"写法和SqlDataSource1.UpdateParameters.Add(new Parameter("@Title", TypeCode.String, ((TextBox)gvr.FindControl("txtTitle")).Text)); 的写法会有所区别。