DataPager在动态更改objectDataSource select方法后停止工作 [英] DataPager stops working after changing objectDataSource select method dynamically

查看:76
本文介绍了DataPager在动态更改objectDataSource select方法后停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用DataPager,ListView和DataPager来显示我的数据,所有内容(强调分页)都没问题。我也改变了objectDataSource的select方法:



I used DataPager , ListView and DataPager to display my data , everything(emphatically paging) was OK .I also changed the select method of objectDataSource this way:

ObjectDataSource1.SelectMethod= "GetPruductByCondition";        
ObjectDataSource1.SelectParameters.Clear();
ObjectDataSource1.SelectParameters.Add("dropDownListValue", condition);
ObjectDataSource1.SelectParameters.Add("searchItem", searchItem);



也没关系。但是当我点击DataPager的另一页时,会显示以下错误:



ObjectDataSource'ObjectDataSource1'找不到非泛型方法


it was OK too. But when i click on another page of DataPager , error below is displayed:

"ObjectDataSource 'ObjectDataSource1' could not find a non-generic method

'GetProductList'

有参数:dropDownListValue,searchItem。



如何解决?

(这里是objectDatasource:

that has parameters: dropDownListValue, searchItem."

how can I solve it?
(here is objectDatasource :

<asp:ObjectDataSource ID="ObjectDataSource1" OldValuesParameterFormatString="original_{0}" SelectMethod="GetProductList" ...>





事实上我需要实现搜索,当点击SearchButton时,应该更改ObjectDataSource1的默认SelectMethod;这是第一次单击按钮我的实现工作但我无法使用DataPager查看其他搜索结果。

)

as a matter of fact I need to implement searching, and when the SearchButton is clicked the default SelectMethod of ObjectDataSource1 should be changed;for the first time the button is clicked my implementation works but I can not use DataPager to see other search results .

推荐答案

这通常发生在方法名称或参数名称不匹配时。



这是由于ObjectDataSource检查了在Rebind / Postback时Markup中设置的Method。通常,当PageIndexChanged事件由于DataPager控件的分页或甚至DropdownSelectedchange发生时触发时会发生这种情况。尝试调试并检查调用哪个Select方法?(GetPruductByCondition或GetProductList)并根据select方法提供这些参数。
This usually occurs when there is a Method Name or Parameter Name mismatch .

Here its due to the ObjectDataSource checks for the Method which is set in the Markup when there is a Rebind/Postback. Usually this happens when PageIndexChanged event fires due to the Pagination of the DataPager Control or even when the DropdownSelectedchange happens. Try to Debug and check which Select Method is getting called there?( GetPruductByCondition or GetProductList) and supply those parameters according to the select methods.


这篇关于DataPager在动态更改objectDataSource select方法后停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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