首页 > 代码库 > asp.net 自带ajax 控件的小实例
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(); }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。