473,807 Members | 2,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ObjectDataSourc e: Value of session variable never passed to defined SelectMethod

Hi all

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

<asp:Repeater ID="VideoListNe westRepeater" runat="server"
DataSourceID="V ideoListNewestD ataSource">

The code for ObjectDataSourc e looks like this:

<asp:ObjectData Source ID="VideoListNe westDataSource" runat="server"
EnablePaging="T rue"
SelectCountMeth od="GetCountRow sTotal"
SelectMethod="G etFunVideoListN ewest" TypeName="BLL.F unVideo">
<SelectParamete rs>
<asp:SessionPar ameter DefaultValue="0 " Name="startRowI ndex"
SessionField="S tartRowIndex"
Type="Int32" />
<asp:SessionPar ameter DefaultValue="4 " Name="maximumRo ws"
SessionField="M aximumRows"
Type="Int32" />
</SelectParameter s>
</asp:ObjectDataS ource>

SelectMethod GetFunVideoList Newest 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 ObjectDataSourc e gets invoked.

LinkButtonNewes tRight_Click:
int newestStartRowI ndex = 0;
if (Session["StartRowIn dex"] != null)
{
newestStartRowI ndex = (int)Session["StartRowIn dex"];
}
newestStartRowI ndex += 4;
Session["StartRowIn dex"] = newestStartRowI ndex;
Session["MaximumRow s"] = 4;
this.VideoListN ewestDataSource .Select();
this.VideoListN ewestRepeater.D ataBind();

But there is the problem that for both parameters of function
GetFunVideoList Newest 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<FunVideoGe tFunVideoListNe west(int startRowIndex,
int maximumRows)

Any clue?

Thanks,
Roger

Jan 7 '07 #1
1 9816
I found out what was the problem:
<asp:ObjectData Source ID="VideoListNe westDataSource" runat="server"
EnablePaging="T rue" ...

EnablePaging of ObjectDataSourc e 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 ObjectDataSourc e
(same page):

<asp:Repeater ID="VideoListNe westRepeater" runat="server"
DataSourceID="V ideoListNewestD ataSource">

The code for ObjectDataSourc e looks like this:

<asp:ObjectData Source ID="VideoListNe westDataSource" runat="server"
EnablePaging="T rue"
SelectCountMeth od="GetCountRow sTotal"
SelectMethod="G etFunVideoListN ewest" TypeName="BLL.F unVideo">
<SelectParamete rs>
<asp:SessionPar ameter DefaultValue="0 " Name="startRowI ndex"
SessionField="S tartRowIndex"
Type="Int32" />
<asp:SessionPar ameter DefaultValue="4 " Name="maximumRo ws"
SessionField="M aximumRows"
Type="Int32" />
</SelectParameter s>
</asp:ObjectDataS ource>

SelectMethod GetFunVideoList Newest 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 ObjectDataSourc e gets invoked.

LinkButtonNewes tRight_Click:
int newestStartRowI ndex = 0;
if (Session["StartRowIn dex"] != null)
{
newestStartRowI ndex = (int)Session["StartRowIn dex"];
}
newestStartRowI ndex += 4;
Session["StartRowIn dex"] = newestStartRowI ndex;
Session["MaximumRow s"] = 4;
this.VideoListN ewestDataSource .Select();
this.VideoListN ewestRepeater.D ataBind();

But there is the problem that for both parameters of function
GetFunVideoList Newest 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<FunVideoGe tFunVideoListNe west(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
1992
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 parameter. When the Update-method is invoked by the ObjectDataSource, the object referenced is not the same object returned by the Select-method, but a new object with only the values from the Edit-template. So basically I get a reference to a useless...
4
8508
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 reading): <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" DataKeyNames="Id" OnRowUpdated="GridView1_RowUpdated">
3
1879
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 'ObjectDataSource1' could not find a non-generic method 'UpdateProduct' that has parameters: ProductName, UnitPrice, ProductId. I have been unable to work through this. Any ideas? I’m using code pasted directly from this page:
2
3826
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 DataKeyNames parameter of "UserCompany, BillableCompany". The DetailsView has control parameters for its select method pointing to these two keys on the GridView. But the select method function receives two copies of the UserCompany field! The...
1
1936
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 (PersonFactory) with static methods (Select, Update, Delete, see below). The factory methods work with instances of a simple class (Person, see below). Select and Update works, but the Person object passed to the Delete method is always empty (Id == 0;...
2
5644
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 defined, however when the page intitially loads, that DefaultValue is not passed to my SelectMethod. I have sorting enabled, so when I do subsequent sorts on the GridView, the pSortExpression value is passed and sorting works, but for some reason,...
1
1707
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 collections of textboxes prompting for entry into a fairly monolithic database. I decided to create a business object (called Employee) and use the ObjectDataSource to broker data being transmitted between the UI and my Employee object (and...
0
1516
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 want any SQL code in my presentation layer, and I want all my SQL operations accessable through methods I've developed in vb.net of a class I will conviently call MyDAL.
0
2148
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 ControlParameter that has a ControlID that points to "lb_dates". The PropertyName of the ControlParameter is "SelectedValue". The user selects two dates from the ListBox. I am trying to pass BOTH selected values of the ListBox to a SelectMethod of
0
9720
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10626
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10372
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9193
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3854
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.