关于DataGrid绑定数据后的修改
我在一个DataGrid中绑定了两个列(用户ID \ 用户姓名),一个摸版列(职务),并且填加了一个按钮列(编辑\更新\取消),希望是在点击 "编辑 "的时候,将 "职务 "这列变成一个Dropdownlist以便用户修改,但是现在的问题是:当我点击 "编辑 "的时候,虽然出现了Dropdownlist,但是之前的那两个绑定的列也自动变成了TextBox,我希望的效果是只有 "职务 "那列变成Dropdownlist,之前的列要保持原样就可以了,应该如何实现哦??
代码如下:
<asp:DataGrid id= "UserGrid " runat= "server " Width= "548px " BorderColor= "#DEDFDE " BorderStyle= "None "
BorderWidth= "1px " BackColor= "White " CellPadding= "4 " GridLines= "Vertical " ForeColor= "Black "
AutoGenerateColumns= "False " Height= "164px ">
<FooterStyle BackColor= "#CCCC99 "> </FooterStyle>
<SelectedItemStyle Font-Bold= "True " ForeColor= "White " BackColor= "#CE5D5A "> </SelectedItemStyle>
<AlternatingItemStyle BackColor= "White "> </AlternatingItemStyle>
<ItemStyle BackColor= "#F7F7DE "> </ItemStyle>
<HeaderStyle Font-Bold= "True " ForeColor= "White " BackColor= "#6B696B "> </HeaderStyle>
<Columns>
<asp:BoundColumn DataField= "uid " HeaderText= "用户ID ">
<ItemStyle Font-Size= "12pt "> </ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField= "uname " HeaderText= "用户姓名 ">
<ItemStyle Font-Size= "12pt "> </ItemStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText= "职务 ">
<ItemTemplate>
<asp:Label id=positionLabel runat= "server " Text= ' <%# DataBinder.Eval(Container, "DataItem.dname ") %> '>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID= "position " runat= "server " Width= "100% " AutoPostBack= "True "> </asp:DropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:EditCommandColumn ButtonType= "LinkButton " UpdateText= "更新 " CancelText= "取消 " EditText= "编辑 "> </asp:EditCommandColumn>
</Columns>
<PagerStyle HorizontalAlign= "Right " ForeColor= "Black " BackColor= "#F7F7DE " Mode= "NumericPages "> </PagerStyle>
</asp:DataGrid>
====================================================================================================================================================
我觉得最主要的是列的那几行
<Columns>
<asp:BoundColumn DataField= "uid " HeaderText= "用户ID ">
<ItemStyle Font-Size= "12pt "> </ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField= "uname " HeaderText= "用户姓名 ">
<ItemStyle Font-Size= "12pt "> </ItemStyle>