473,237 Members | 1,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

ObjectDataSource: Value of session variable never passed to defined SelectMethod

Hi all

On a page I am using a repeater which is linked to an ObjectDataSource
(same page):

<asp:Repeater ID="VideoListNewestRepeater" runat="server"
DataSourceID="VideoListNewestDataSource">

The code for ObjectDataSource looks like this:

<asp:ObjectDataSource ID="VideoListNewestDataSource" runat="server"
EnablePaging="True"
SelectCountMethod="GetCountRowsTotal"
SelectMethod="GetFunVideoListNewest" TypeName="BLL.FunVideo">
<SelectParameters>
<asp:SessionParameter DefaultValue="0" Name="startRowIndex"
SessionField="StartRowIndex"
Type="Int32" />
<asp:SessionParameter DefaultValue="4" Name="maximumRows"
SessionField="MaximumRows"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>

SelectMethod GetFunVideoListNewest is a static function of object
BLL.FunVideo (business layer, different project). This function has two
parameters: int startRowIndex, int maximumRows. As you can see, for
both parameters session variables are defined.

In a separate function which is triggered by click event of a
LinkButton (same page) the session variables are set and/or updated and
the select command of ObjectDataSource gets invoked.

LinkButtonNewestRight_Click:
int newestStartRowIndex = 0;
if (Session["StartRowIndex"] != null)
{
newestStartRowIndex = (int)Session["StartRowIndex"];
}
newestStartRowIndex += 4;
Session["StartRowIndex"] = newestStartRowIndex;
Session["MaximumRows"] = 4;
this.VideoListNewestDataSource.Select();
this.VideoListNewestRepeater.DataBind();

But there is the problem that for both parameters of function
GetFunVideoListNewest always only value 0 gets passed!!! The values of
session variables and the default values are not taken into account!

The signature of the invoked function looks like this:
public static List<FunVideoGetFunVideoListNewest(int startRowIndex,
int maximumRows)

Any clue?

Thanks,
Roger

Jan 7 '07 #1
1 9761
I found out what was the problem:
<asp:ObjectDataSource ID="VideoListNewestDataSource" runat="server"
EnablePaging="True" ...

EnablePaging of ObjectDataSource should not be set to true when using
custom paging! I have just removed this attribute and it works!

Regards,
Roger
Roger schrieb:
Hi all

On a page I am using a repeater which is linked to an ObjectDataSource
(same page):

<asp:Repeater ID="VideoListNewestRepeater" runat="server"
DataSourceID="VideoListNewestDataSource">

The code for ObjectDataSource looks like this:

<asp:ObjectDataSource ID="VideoListNewestDataSource" runat="server"
EnablePaging="True"
SelectCountMethod="GetCountRowsTotal"
SelectMethod="GetFunVideoListNewest" TypeName="BLL.FunVideo">
<SelectParameters>
<asp:SessionParameter DefaultValue="0" Name="startRowIndex"
SessionField="StartRowIndex"
Type="Int32" />
<asp:SessionParameter DefaultValue="4" Name="maximumRows"
SessionField="MaximumRows"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>

SelectMethod GetFunVideoListNewest is a static function of object
BLL.FunVideo (business layer, different project). This function has two
parameters: int startRowIndex, int maximumRows. As you can see, for
both parameters session variables are defined.

In a separate function which is triggered by click event of a
LinkButton (same page) the session variables are set and/or updated and
the select command of ObjectDataSource gets invoked.

LinkButtonNewestRight_Click:
int newestStartRowIndex = 0;
if (Session["StartRowIndex"] != null)
{
newestStartRowIndex = (int)Session["StartRowIndex"];
}
newestStartRowIndex += 4;
Session["StartRowIndex"] = newestStartRowIndex;
Session["MaximumRows"] = 4;
this.VideoListNewestDataSource.Select();
this.VideoListNewestRepeater.DataBind();

But there is the problem that for both parameters of function
GetFunVideoListNewest always only value 0 gets passed!!! The values of
session variables and the default values are not taken into account!

The signature of the invoked function looks like this:
public static List<FunVideoGetFunVideoListNewest(int startRowIndex,
int maximumRows)

Any clue?

Thanks,
Roger
Jan 11 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ole M | last post by:
I'm having some trouble using the ObjectDataSource in ASP.NET 2.0. I have a wrapper that contains the static methods for Select and Update. The Update-method takes the business object as...
4
by: Anne Catterick | last post by:
Hi, I have an british ASP.Net 2.0 application which is doing what (should) be very simple. But I am having issues. On my page I have a GridView as follows (some tags excluded for easy...
3
by: mthomason | last post by:
I keep getting this error when trying to update records using an ObjectDataSource. I have seen others post similar errors...but I haven't found any solutions. ObjectDataSource...
2
by: Damon | last post by:
Help! Need this fixed ASAP. I have a GridView/DetailsView master/details form set up, with both bound to separate ObjectDataSource objects. Both the GridView and the DetailsView have a...
1
by: Jürgen Bayer | last post by:
Hi, I just tried out the ObjectDataSource of ASP.NET 2.0. A simple application works with a GridView bound to an ObjectDataSource. The ObjectDataSource is set to a (factory) class...
2
by: SJL | last post by:
I have a GridView (ASP.NET 2.0 + SQL Sever 2005) control that is bound to an Object Data Source (ODS). The ODS has a SelectParameter for the sort expression. The SelectParameter has a DefaultValue...
1
by: =?Utf-8?B?cm9zczYxMw==?= | last post by:
I really hope this is not a case of "this silly thing will never work".....lots of time invested in troubleshooting this already. I have created a standard ASP.NET web form (.aspx) with several...
0
by: jobs | last post by:
re: ObjectDataSource SelectMethod TypeName returning a Dataset? is this really a DAL? Pardon my misguided email on the subject... I'm working in asp.net 2.0 and vb.net 2005. Say I don't...
0
by: =?Utf-8?B?UGF1bA==?= | last post by:
I have a ListBox server control named "lb_dates" with a SelectionMode of "Multiple". The user can select multiple dates from the listbox. I have ObjectDataSource named "ods_rfq" with a...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.