473,406 Members | 2,220 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,406 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 9769
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.