在任何地方点击停止gridview回复 [英] stop gridview posting back on clicking anywhere

查看:58
本文介绍了在任何地方点击停止gridview回复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个绑定到某些sql数据的gridview,我有一些文本框可以让我搜索这些数据。问题是当客户输入搜索词时,他们可以点击页面上的任意位置并进行搜索。但他们只希望在搜索时发生这种情况。按下按钮。 (我很惊讶这是一个问题但我能做些什么?)


我可以以某种方式阻止回发发生直到我打电话给它吗?我在gridview周围尝试了一个更新面板,但它似乎没有任何效果。


更新:

让我澄清一点点...当在文本框中输入搜索词并且发生任何点击事件时,gridview会执行此操作并仅返回相关项(在SQL存储过程中完成)。我不希望这种情况发生,直到按下按钮。


谢谢,


Alea

解决方案

听起来好像您的搜索文本框中有AutoPostback = True。将此属性设置为False。


听起来您正在调用搜索。页面加载事件中的功能...但你真正想做的只是在搜索按钮点击事件中调用此功能。


-Frinny


< BLOCKQUOTE>谢谢!我将文本框上的自动回复设置为false,它解决了问题。


I have a gridview bound to some sql data and I have some textboxes that let me search this data. The problem is that when the client enters a search term, they can click anywhere on the page and the search happens. But they only want it to happen when the "search" button is pressed. (I am surprised this is a ''problem'' but what can I do?)

Can I somehow stop the postback from happening until I call it? I tried an Update panel around the gridview, but it doesn''t appear to have any effect.

Update:
Let me clarify just a little bit... when the search term is entered in the text box and any click event occurs, the gridview does it''s thing and returns only the relevant items (done in a SQL stored procedure). I don''t want this to happen until a button is pressed.


Thanks,

Alea

解决方案

It sounds as if your search textbox has "AutoPostback=True". Set this property to False.


It sounds like you are calling the "search" functionality in the Page Load event...but what you really want to do is only call this functionality in Search Button Click event.

-Frinny


Thanks! I set the autopostback on the textboxes to false, and it solved the problem.


这篇关于在任何地方点击停止gridview回复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆