0
我是ASP.net的新手,尝试在Gridview控件的标题字段下添加下拉列表和搜索文本框。在GridView标题中添加下拉菜单
<asp:GridView ID="EmpGridView" runat="server" AutoGenerateColumns="false"
DataKeyNames="EMPLOYEEID"
AllowSorting="True" AllowPaging="true" PageSize="50"
OnPageIndexChanging="EmpGridView_PageIndexChanging" style="margin-right: 52px" OnSelectedIndexChanged="EmpGridView_SelectedIndexChanged"
>
<Columns>
<asp:BoundField DataField="EMPLOYEEID"
HeaderText="Employee ID" ReadOnly="true"
SortExpression="EMPLOYEEID" />
<asp:BoundField DataField="PERSONNAME"
HeaderText="Person Name" ReadOnly="true"
SortExpression="PERSONNAME" />
<asp:BoundField DataField="DIVISIONNAME"
HeaderText="Division Name" ReadOnly="true"
SortExpression="DIVISIONNAME" />
<asp:BoundField DataField="DESIGNATION"
HeaderText="Designation" ReadOnly="true"
SortExpression="DESIGNATION"
/>
<asp:BoundField DataField="CNIC"
HeaderText="CNIC" ReadOnly="true"
SortExpression="CNIC" />
</Columns>
</asp:GridView>
我想以下
EMPLOYEEID PERSONNAME DIVISIONNAME <----HeaderText
TextBox control TextBox Control DropDownlist control <------aspcontrols
..data ..data ..data <------ rest is db
..data ..data ..data
含义我想我的标签有太多与我的asp.net控制 我应该怎么办呢?
到目前为止,我尝试了以下方法,但无法找到将其放置的位置?因为如果我单独添加它,那么每个控件都有我不想要的行,并且boundfield标记不允许它在其中。
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="searchBox" runat="server" />
</ItemTemplate>
</asp:TemplateField>
对冲PLZ还告诉我,如果ü有时间如何使该文本框搜索或其他控件让你可以为此推荐? – 2014-09-10 08:47:10
同样,您可以在标题中添加一个按钮。在gridview的RowCommand事件中,使用EmpGridView.HeaderRow.FindControl(“searchBox”)作为TextBox。 – 2014-09-10 09:02:20