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