Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > objectdatasource custom paging SelectCount method

Reply
Thread Tools

objectdatasource custom paging SelectCount method

 
 
Dav
Guest
Posts: n/a
 
      01-10-2006
I'm trying to implement custom paging in a VS 2005 readonly GridView binding
to an ObjectDataSource control. I added the extra maximumRows and
startRowIndex parameters to my Select method. The Select method had 3
parameters before I added the paging parameters. I added another method
called "GetCounter" to the same class containing the Select method to also
implement the SelectCount attribute. I keep getting an exception because it
is looking for the two original parameters to the Select method even though
the SelectCount method is not supposed to have any parameters at all. This
is the message:

"ObjectDataSource 'ObjectDataSource1' could not find a non-generic method
'GetCounter' that has parameters: selectedStates, sort"

Please help - thanks!
 
Reply With Quote
 
 
 
 
Yuan Ren[MSFT]
Guest
Posts: n/a
 
      01-10-2006
Hi,

Welcome to MSDN newsgroup!

From your description, I have performed the test but can not reproduce your
issue. So I suggest you post some snippets of the code which include the
method definition in the c sharp file and the select parameter definition
in the HTML source.

This will help me to repro your current problem. Thanks for your
understanding! Im looking forward your reply!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support

 
Reply With Quote
 
 
 
 
Dav
Guest
Posts: n/a
 
      01-11-2006
Thanks for your speedy response! Here's some code from the aspx file and
code-behind (just the relevant snippets):

ASPX page:



<asp:ObjectDataSource runat=server ID="ObjectDataSource1"
TypeName="BusinessClass" SelectMethod="GetProducts"
SelectCountMethod="GetCounter" SortParameterName="sort"
DataObjectTypeName="Product" EnablePaging="true" >
<SelectParameters>
<asp:ControlParameter ControlID="ddlStates"
Name="selectedStates" PropertyName="SelectedValue"
Type="String" />
<asparameter Name="sort" Type="String" />

</SelectParameters>

</asp:ObjectDataSource>

<asp:GridView runat=server ID="grdProducts"
AllowPaging=true PagerSettings-Mode=Numeric AllowSorting=True
DataSourceID="ObjectDataSource1" AutoGenerateColumns="False"
OnRowDataBound ="grdProducts_RowDataBound">

<Columns>
 
Reply With Quote
 
Yuan Ren[MSFT]
Guest
Posts: n/a
 
      01-12-2006
Hi,

Thanks for your reply!

With the information you supplied, I have performed the test with the
Northwind database in my project. However, I cant reproduce the current
issue since I have used the SelectCountMethod and also hard code the value.

Therefore, I suggest you provide a simple demo which uses the Northwind
database to me. So that, I can debug the current project and find out why
the Exception is thrown. You can send the demo to me as a zip format. My
alias is http://www.velocityreviews.com/forums/(E-Mail Removed) (remove .online).

I appreciate your understanding, if you have any concerns please let me
know. Its my pleasure to be of assistance.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support

 
Reply With Quote
 
Dav
Guest
Posts: n/a
 
      01-17-2006
Hi Yuan,

Sorry for the delay in replying. I had shut down VS 2005 several times and
restarted the machine, but the problem persisted. After I powered off the
machine and restarted, the problem went away and the SelectCount method is
working. However, it is requiring me to use the same parameters in the
SelectCount method that I use for the Select method, which isn't a big
problem, but is not the way it is documented to be coded in my understanding.

Thank you.

""Yuan Ren[MSFT]"" wrote:

> Hi,
>
> Thanks for your reply!
>
> With the information you supplied, I have performed the test with the
> Northwind database in my project. However, I can¡¯t reproduce the current
> issue since I have used the SelectCountMethod and also hard code the value.
>
> Therefore, I suggest you provide a simple demo which uses the Northwind
> database to me. So that, I can debug the current project and find out why
> the Exception is thrown. You can send the demo to me as a zip format. My
> alias is (E-Mail Removed) (remove .online).
>
> I appreciate your understanding, if you have any concerns please let me
> know. It¡¯s my pleasure to be of assistance.
>
> Regards,
>
> Yuan Ren [MSFT]
> Microsoft Online Support
>
>

 
Reply With Quote
 
Yuan Ren[MSFT]
Guest
Posts: n/a
 
      01-18-2006
Hi,

Thanks for posting!

From your description, I can not understand the issue clearly. Do you mean
the problem can not repro all the time? If this is true, I think maybe the
problem is caused by the data which you use.

Otherwise, I find an article which shows how to use the ObjectDataSource
control and paging:
http://fredrik.nsquared2.com/viewpost.aspx?PostID=229

I hope it will be helpful.

Regards,

Yuan Ren [MSFT]
Microsoft Online Support

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ObjectDataSource & FormView adding two extra paramaters to Update method giving error non-generic method ... Fred Dag ASP .Net 0 09-18-2006 10:36 PM
gridview + custom paging WITHOUT objectdatasource Kovan A ASP .Net Web Controls 0 07-14-2006 01:32 PM
Gridview + Custom Paging WITHOUT ObjectDataSource Kovan A ASP .Net Web Controls 1 07-11-2006 10:03 AM
ObjectDataSource method as another ObjectDataSource David Thielen ASP .Net Web Controls 3 03-23-2006 01:50 AM
Objectdatasource Paging Control =?Utf-8?B?Y3NvY2t3ZWxs?= ASP .Net 0 10-17-2005 04:28 PM



Advertisments