<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 控件的小实例,布布扣,bubuko.com
时间: 2024-10-14 00:23:34