Click here to Skip to main content
15,924,679 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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

ASP.NET
<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") %>'>
Posted
Updated 25-Nov-14 18:20pm
v2
Comments
Maciej Los 25-Nov-14 16:25pm    
To be honest: it's even not a question. You need to provide as a minimum: what have you done and where are you stuck!
Member 11111143 25-Nov-14 23:05pm    
<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">
<alternatingrowstyle backcolor="PaleGoldenrod">
<footerstyle backcolor="Tan">
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<sortedascendingcellstyle backcolor="#FAFAE7">
<sortedascendingheaderstyle backcolor="#DAC09E">
<sorteddescendingcellstyle backcolor="#E1DB9C">
<sorteddescendingheaderstyle backcolor="#C2A47B">
<columns>
<asp:TemplateField HeaderText="DocketNo">
<itemtemplate>
<asp:Label runat="server" ID="DocketNo" Text='<%# Bind("DocketNo") %>'>


<asp:TemplateField HeaderText="Date">
<itemtemplate>
<asp:Label runat="server" ID="Date" Text='<%# Bind("Date") %>'>


<asp:TemplateField HeaderText="Branch">
<itemtemplate>
<asp:Label runat="server" ID="Branch" Text='<%# Bind("Branch") %>'>


<asp:TemplateField HeaderText="To">
<itemtemplate>
<asp:Label runat="server" ID="To" Text='<%# Bind("To") %>'>


<asp:TemplateField HeaderText="PKG">
<itemtemplate>
<asp:Label runat="server" ID="PKTS" Text='<%# Bind("PKTS") %>'>


<asp:TemplateField HeaderText="Act Wt">
<itemtemplate>
<asp:Label runat="server" ID="ActWt" Text='<%# Bind("ActWt") %>'>

1 solution

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
SQL
SELECT [column1],[column2],[column3],[...]
FROM YourTableName
WHERE [Date]>=@FromDate AND [Date]<=@ToDate

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 !
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900