从日期到日期的Gridview搜索框 [英] from date to date search box for a Gridview
本文介绍了从日期到日期的Gridview搜索框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网格视图我想要的是在日期之间建立一个搜索框,即从日期到日期。借助它我可以看到日期之间的记录。
我想带两个ajax控制两个带有日历扩展器的文本框和一个带有女巫帮助的按钮我想执行操作
I have A grid view what I want is to make a search box between dates i.e. from date and to date. with the help of which I can able to see the record between the dates.
I wanted to take two ajax control two textboxes with calender extender and a button with the help of witch I wanted to perform the operation
<table>
<tr>
<td colspan="2" align="center">
<asp:Label ID="Label1" runat="server" Text="Send Data From 1 Grid to Another Grid of Next Page"
Font-Bold="true" Font-Size="Large" Font-Names="Verdana" ForeColor="Maroon">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="Button1" runat="server" Text="Send Challan" Font-Names="Verdana"
Width="213px" BackColor="Orange" Font-Bold="True" OnClick="Button1_Click" Style="height: 26px" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:GridView ID="GridView1" runat="server" CssClass="grid" BackColor="LightGoldenrodYellow"
BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None"
AutoGenerateColumns="false">
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<asp:TemplateField HeaderText="DocketNo">
<asp:Label runat="server" ID="DocketNo" Text='<%# Bind("DocketNo") %>'>
<asp:TemplateField HeaderText="Date">
<asp:Label runat="server" ID="Date" Text='<%# Bind("Date") %>'>
<asp:TemplateField HeaderText="Branch">
<asp:Label runat="server" ID="Branch" Text='<%# Bind("Branch") %>'>
<asp:TemplateField HeaderText="To">
<asp:Label runat="server" ID="To" Text='<%# Bind("To") %>'>
<asp:TemplateField HeaderText="PKG">
<asp:Label runat="server" ID="PKTS" Text='<%# Bind("PKTS") %>'>
<asp:TemplateField HeaderText="Act Wt">
<asp:Label runat="server" ID="ActWt" Text='<%# Bind("ActWt") %>'>
推荐答案
那么,问题是什么?你已经知道你需要做什么了。
1.如你所说,放置两个带日历扩展器和按钮的文本框。
2.编写逻辑来过滤数据库中的行按钮单击事件。查询如
So, what is the problem? You already know what you need to do.
1. Place two textboxes with calendar extender and a button as you said.
2. Write logic to filter rows from database in the Button click event. Query like
SELECT [column1],[column2],[column3],[...]
FROM YourTableName
WHERE [Date]>=@FromDate AND [Date]<=@ToDate
这里@FromDate和@ToDate是日期过滤器文本框中的值。
3.现在将GridView与查询结果绑定
这就是全部!
Here @FromDate and @ToDate are the values from the textboxes for date filter.
3. Now bind the GridView with the query result
That's all !
这篇关于从日期到日期的Gridview搜索框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文