分页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
最满意答案
我假设每当数据进入时都会设置“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 ...
-
串口挂起close()(Serial port hangs on close())[2022-02-11]
您的实现从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 ... -
串行端口的读取线锁定(Readline from Serial Port locks up)[2022-02-07]
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 ...
-
如何将通过串口发送的数据输出到文本框?(How to output data sent through serial port onto a textBox? C# Visual Studio)[2022-02-13]
事件DataReceived在与创建控件textBox1不同的线程上使用DataReceivedHandler方法处理。 所以在运行你的程序时你应该得到一个System.InvalidOperationException 。 其中恰恰说明了我刚刚描述的内容。 要摆脱这种困境,您可以使用Control.BeginInvoke方法,该方法将: 在创建控件底层句柄的线程上异步执行指定的委托。 基本上它会将这段代码拖到创建控件的线程。 在这种情况下,主线程。 这是你将如何使用它的方式: //writes to te ... -
当串行端口停止输出数据时,使用计时器将文本框变为红色(Turning Textbox Red with a timer when serial port stops outputting data)[2022-04-24]
我假设每当数据进入时都会设置“GPSlastdatatime”? 因此,您的“时间跨度”值将为负值 。 切换减法行的顺序: TimeSpan span = timenow - GPSlastdatatime; 顺便说一句,你可以像这样在一行中完成所有这些: timespan = (DateTime.Now - GPSlastdatatime).TotalSeconds; I assume "GPSlastdatatime" is set whenever data comes in? As is, yo ... -
连续串行端口读取(Continual Serial Port Reads)[2022-02-02]
看这里,有如何读取和配置波特率,握手等示例: 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 ...
-
从串口读取(read from serial port)[2023-07-07]
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 ... -
读取串口(Reading the Serial Port)[2022-09-12]
我试图找出为什么当有重量时它不会扫描,请注意,如果我扫描7次,它可能会抓住它一次10次中的一次 您需要调试代码,设置断点和/或Debug.Print(数据)语句,以查看为什么只有十分之一符合第一个if条件: if (comport.BytesToRead > 0) { if (data.StartsWith("S08")) { textBox1.Text = data.Substring(4).Trim(); timer3.Stop(); scan( ...