c#如何为datagridview某几列添加combox?
提供一种解决方案:
<asp:GridView ID="GVData" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
BorderStyle="Solid" BorderWidth="1px" OnRowDataBound="GVData_RowDataBound" PageSize="15" Width="100%" DataKeyNames ="ID">
<PagerSettings Mode="NumericFirstLast" Visible="False" />
<PagerStyle BackColor="LightSteelBlue" HorizontalAlign="Right" />
<HeaderStyle Font-Size="12px" Height="20px" />
<AlternatingRowStyle BackColor="WhiteSmoke" />
<Columns>
<asp:BoundField DataField="ID" HeaderText="id" Visible = "false"></asp:BoundField>
<asp:TemplateField HeaderText="开始时间">
<ItemTemplate>
<asp:TextBox ID="GVstartTime" Text='<%# Eval("GVstartTime") %>' runat="server" MaxLength="13" Width="76%" style="text-align:left" />
</ItemTemplate>
<ItemStyle Width="12%"/>
</asp:TemplateField>
<asp:TemplateField HeaderText="结束时间">
<ItemTemplate>
<asp:TextBox ID="GVendTime" Text='<%# Eval("GVendTime") %>' runat="server" MaxLength="13" Width="76%" style="text-align:left" />
</ItemTemplate>
<ItemStyle Width="12%"/>
</asp:TemplateField>
<asp:TemplateField HeaderText="学校名称">
<ItemTemplate>
<asp:TextBox ID="GVschoolName" Text='<%# Eval("GVschoolName") %>' runat="server" MaxLength="13" Width="100%" style="text-align:left" />
</ItemTemplate>
<ItemStyle Width="25%"/>
</asp:TemplateField>
<asp:TemplateField HeaderText="性质">
<ItemTemplate>
<asp:DropDownList ID="DropDownList3" runat="server" Width="100%">
<asp:ListItem>请选择</asp:ListItem>
<asp:ListItem>统考</asp:ListItem>
<asp:ListItem>自考</asp:ListItem>
<asp:ListItem>成教</asp:ListItem>
<asp:ListItem>网络</asp:ListItem>
<asp:ListItem>其他</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
<ItemStyle Width="10%"/>
</asp:TemplateField>
<asp:TemplateField HeaderText="学历">
<ItemTemplate>
<asp:TextBox ID="GVeducationStage" Text='<%# Eval("GVeducationStage") %>' runat="server" MaxLength="13" Width="100%" style="text-align:right" />
</ItemTemplate>
<ItemStyle Width="10%"/>
</asp:TemplateField>
<asp:TemplateField HeaderText="专业">
<ItemTemplate>
<asp:TextBox ID="GVmajor" Text='<%# Eval("GVmajor") %>' runat="server" MaxLength="13" Width="100%" style="text-align:right" />
</ItemTemplate>
<ItemStyle Width="15%"/>
</asp:TemplateField>
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<asp:HyperLink ID="HyperLink3" runat="server" Font-Underline="True" NavigateUrl='<%# "EmployeeManageAdd.aspx?ID="+ DataBinder.Eval(Container.DataItem, "ID")+"&strPageFalg=edit"%>'>
<img CLASS="inner_edit" src="../images/Button/btnDelete.jpg" />
</asp:HyperLink>
</ItemTemplate>
<ItemStyle HorizontalAlign="center" Width="12%"/>
</asp:TemplateField>
</Columns>
<RowStyle HorizontalAlign="Center" Height="25px" />
</asp:GridView>
是下拉的,查到DataGridViewComboBoxColumn,具体怎么实现?
百度文库DataGridViewComboBoxColumn 里面就有,稍微看看,应该不难