asp.net 自带ajax 控件的小实例

 <form id="Form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <asp:Label ID="Label1" runat="server" Text="车牌号:"></asp:Label>
        <asp:TextBox ID="tbVehicleLic" runat="server"></asp:TextBox>
        <asp:Label ID="Label2" runat="server" Text="离线间隔(分钟):"></asp:Label>
        <asp:TextBox ID="tbTimeSpan" runat="server">30</asp:TextBox>
        <asp:Button ID="btnSearch" runat="server" onclick="btnSearch_Click" Text="查询" Width="80px" />
    </div>
    <div>    
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
          <!--下面是一个报表--> <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos="(集合)" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="100%" Height="70%"> <LocalReport ReportPath="bin\Pages\Report\LastOnlineRpt.rdlc"> </LocalReport> </rsweb:ReportViewer> </ContentTemplate> </asp:UpdatePanel> </div> </form>

后台

 protected void Page_Load(object sender, EventArgs e)
        {
            ScriptManager1.RegisterAsyncPostBackControl(btnSearch);//给按钮注册异步事件
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string vehicleLic = this.tbVehicleLic.Text;
            double timeSpan = Convert.ToDouble(this.tbTimeSpan.Text);
            string lineID = "164,165,166,167";
            MainBLL bll = new MainBLL();
            var dt = bll.GetBusStatusByLineID(lineID, vehicleLic, timeSpan);
            ReportDataSource ReportData = new ReportDataSource("DataSet1", dt);
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportViewer1.LocalReport.DataSources.Add(ReportData);
            //this.UpdatePanel1.Update();
        }

asp.net 自带ajax 控件的小实例,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。