|
本帖最后由 treedun 于 2013-11-20 11:09 编辑
上传了几十次,永远在90%,贴代码了。
- <%@ Page Language="C#" AutoEventWireup="True" CodeBehind="hello.aspx.cs" Inherits="EmptyProjectNet40.hello" %>
- <!DOCTYPE html>
- <html>
- <head runat="server">
- <title></title>
- <link href="../css/main.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <form id="form1" runat="server">
- <x:PageManager ID="PageManager1" runat="server" />
- <x:DatePicker runat="server" Label="开始日期" EmptyText="开始日期" ID="dp_start_date"> </x:DatePicker>
- <x:DatePicker runat="server" Label="结束日期" EmptyText="结束日期" ID="dp_end_date"> </x:DatePicker>
-
-
- <x:Button ID="btn_search" CssClass="btn-in-form" runat="server" Icon="ApplicationGo"
- Text="查询数据" OnClick="btn_search_Click" EnableAjax="false" DisableControlBeforePostBack="false"></x:Button>
- <x:Grid ID="Grid2" Title="RM进口数据" PageSize="80" ShowBorder="false" AllowPaging="true"
- ShowHeader="False" runat="server" EnableCheckBoxSelect="False"
- DataKeyNames="Id" EnableRowNumber="True" IsDatabasePaging="true" OnPageIndexChange="Grid2_PageIndexChange"
- EnableMultiSelect="false" EnableRowSelectEvent="true" AllowSorting="true" SortColumnIndex="0"
- SortDirection="DESC" OnSort="Grid2_Sort">
- <Columns>
- <x:BoundField Width="20px" DataField="id" SortField="id" DataFormatString="{0}" HeaderText="id" Hidden="True" HideMode="Offsets" />
- <x:BoundField Width="150px" DataField="rm_ieguandanhao" SortField="rm_ieguandanhao" DataFormatString="{0}" HeaderText="报关单号" />
- </Columns>
- </x:Grid>
- </form>
- </body>
- </html>
复制代码- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using FineUI.Examples;
- using System.Configuration;
- using System.Data;
- using System.Data.SqlClient;
- using System.Data.Sql;
- using FineUI;
- using System.Text;
- namespace EmptyProjectNet40
- {
- public partial class hello : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- DateTime now = DateTime.Now;
- DateTime d1 = new DateTime(now.Year, now.Month, 1);
- DateTime d2 = d1.AddMonths(1).AddDays(-1);
- dp_start_date.Text = d1.ToString("yyyy-MM-dd");
- dp_end_date.Text = d2.ToString("yyyy-MM-dd");
- }
- }
- /// <summary>
- /// 默认显示本月
- /// </summary>
- protected void BindGrid()
- {
- string dsd = dp_start_date.Text.Trim();
- string ded = dp_end_date.Text.Trim();
-
- DataTable dt = new DataTable();
- dt = SqlHelper.ExecuteDataset(SqlHelper.Conn_zhangcehexiao, CommandType.Text, string.Format(@"select id,rm_ieguandanhao,rm_shenbaoriqi from RM_jinkou
- WHERE rm_shenbaoriqi BETWEEN '{0}' AND '{1}'", dsd, ded)).Tables[0];
- Grid2.DataSource = dt;
- Grid2.DataBind();
- }
- #region 排序和翻页
- protected void Grid2_PageIndexChange(object sender, FineUI.GridPageEventArgs e)
- {
- Grid2.PageIndex = e.NewPageIndex;
- BindGrid();
- }
- protected void Grid2_Sort(object sender, FineUI.GridSortEventArgs e)
- {
- Grid2.SortDirection = e.SortDirection;
- Grid2.SortColumnIndex = e.ColumnIndex;
- BindGrid();
- }
- #endregion
- /// <summary>
- /// 按日期范围查找
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void btn_search_Click(object sender, EventArgs e)
- {
- string dsd = dp_start_date.Text.Trim();
- string ded = dp_end_date.Text.Trim();
- if (dsd != "" && ded != "")
- {
- BindGrid();
- }
- else
- {
- Alert.Show("日期不能为空:(");
- }
- }
- }
- }
复制代码
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|