不需要这样啊,你应该使用绑定的方法,比如:
<asp:TemplateField HeaderText="性别" SortExpression="sex">
<EditItemTemplate>
<asp:DropDownList ID="TextBox1" runat="server" Text='<%# Bind("sex") %>'>
<asp:ListItem Value="男">男</asp:ListItem>
<asp:ListItem Value="女">女</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("sex") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
这样,你点击”编辑“按钮后,那个DropDownList里面的Text自动就是原来的值了
温馨提示:内容为网友见解,仅供参考