首页 \ 问答 \ 分页GridView(Paging GridView)

分页GridView(Paging GridView)

我有一个简单的查询:

Dim info As New SailMembersDataContext
Dim query = From p In info.Individuals
GridView1.DataSource = query
GridView1.DataBind()

我想知道如何在页面上添加分页到例如10的查询,我试图在GridView上使用内置的分页,但这只会产生错误:

GridView的'GridView1'触发了未处理的事件PageIndexChanging

尝试更改为其他页面时。


I have a simple query:

Dim info As New SailMembersDataContext
Dim query = From p In info.Individuals
GridView1.DataSource = query
GridView1.DataBind()

and i was wondering how i can add paging to this query for example 10 on a page i have tried to use the built in paging on the GridView but this just produces the error:

The GridView 'GridView1' fired event PageIndexChanging which wasn't handled.

When trying to change to another page.


原文:https://stackoverflow.com/questions/4862809
更新时间:2023-06-18 16:06

最满意答案

我假设每当数据进入时都会设置“GPSlastdatatime”?

因此,您的“时间跨度”值将为负值

切换减法行的顺序:

TimeSpan span = timenow - GPSlastdatatime;

顺便说一句,你可以像这样在一行中完成所有这些:

timespan = (DateTime.Now - GPSlastdatatime).TotalSeconds;

I assume "GPSlastdatatime" is set whenever data comes in?

As is, your "timespan" value is going to be negative.

Switch the order of your subtraction line:

TimeSpan span = timenow - GPSlastdatatime;

By the way, you could do it all in one line like this:

timespan = (DateTime.Now - GPSlastdatatime).TotalSeconds;

相关问答

更多
  • 1)您需要注册到串行端口的DataRecieved事件以接收来自SerialPort实例的响应。 sp = new SerialPort(); sp.DataReceived += sp_DataReceived; 然后,在sp_DataRecieved中: void sp_DataReceived(object sender, SerialDataReceivedEventArgs e) { // this the read buffer byte[] b ...
  • 您的实现从tx_empty()返回0 ,这意味着“ 不为空 ”。 来自kernel.org/doc/Documentation/serial/driver : tx_empty(port) 此函数测试'port'描述的端口的发送器fifo和shifter是否为空。 如果为空,则此函数应返回TIOCSER_TEMT ,否则返回0.如果端口不支持此操作,则应返回TIOCSER_TEMT 。 Your implementation returns 0 from tx_empty() which means "no ...
  • SerialPort.ReadLine被定义为阻止“直到第一次出现NewLine值”,其中NewLine默认为换行符。 您是否在流中发送换行符? 请注意,换行符(ASCII 0x0A)与您可能要发送的回车符(ASCII 0x0D)不同。 如果需要,您可以重新定义NewLine,或者如果行结尾感觉不对,您可以使用SerialPort.ReadTo读取给定的字符串。 您还可以设置读取超时 。 您可能更喜欢从端口读取给定数量的字节,而不是使用其中一个SerialPort.Read重载。 如果这些都不适用,请确保您 ...
  • 如果有人在与微控制器通信时通过串口接收奇怪的字符,则应确保为9600 bauds指定了正确的时钟或XTAL以及SPBRG ,使用SPBRG = 23和XTAL = 3.686 If anyone receiving weird characters via serial port when communicating with a Microcontroller, you should make sure that you specified the right Clock or XTAL, as well ...
  • 事件DataReceived在与创建控件textBox1不同的线程上使用DataReceivedHandler方法处理。 所以在运行你的程序时你应该得到一个System.InvalidOperationException 。 其中恰恰说明了我刚刚描述的内容。 要摆脱这种困境,您可以使用Control.BeginInvoke方法,该方法将: 在创建控件底层句柄的线程上异步执行指定的委托。 基本上它会将这段代码拖到创建控件的线程。 在这种情况下,主线程。 这是你将如何使用它的方式: //writes to te ...
  • 我假设每当数据进入时都会设置“GPSlastdatatime”? 因此,您的“时间跨度”值将为负值 。 切换减法行的顺序: TimeSpan span = timenow - GPSlastdatatime; 顺便说一句,你可以像这样在一行中完成所有这些: timespan = (DateTime.Now - GPSlastdatatime).TotalSeconds; I assume "GPSlastdatatime" is set whenever data comes in? As is, yo ...
  • 看这里,有如何读取和配置波特率,握手等示例: http://msmvps.com/blogs/coad/archive/2005/03/23/SerialPort-_2800_RS_2D00_232-Serial-COM-Port_2900_-in-C_2300_-.NET.aspx look here, has examples of how to read and configure the baud rate, handshaking etc: http://msmvps.com/blogs/coad ...
  • 如果timer2是一个实例变量,那么问题是你正在创建一个名为timer2的局部变量并启动它。 然后,您将停止成员变量timer2,而不是本地作用域timer2。 本地范围timer2将继续触发,直到垃圾收集器绕过它来处理它。 我很确定timer2是一个实例变量,否则对它的其他引用将无法编译。 还要注意,因为你在一个循环中创建了timer2,你可能正在创建它们的船载,并且所有这些都快乐地开火,直到垃圾收集器让它们摆脱它们的痛苦。 编辑:这是一个在表单中使用的相当简单的示例。 http://www.java2s ...
  • while循环不一定按字符读取,但根据串行端口设备和传输速率,每次读取可能会一次返回一个字符。 我做了一些修改来修复你的while循环中的一些错误: while(1) { char buffer[100]; ssize_t length = read(fd, &buffer, sizeof(buffer)); if (length == -1) { printf("Error reading from serial port\n"); brea ...
  • 我试图找出为什么当有重量时它不会扫描,请注意,如果我扫描7次,它可能会抓住它一次10次中的一次 您需要调试代码,设置断点和/或Debug.Print(数据)语句,以查看为什么只有十分之一符合第一个if条件: if (comport.BytesToRead > 0) { if (data.StartsWith("S08")) { textBox1.Text = data.Substring(4).Trim(); timer3.Stop(); scan( ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)