473,396 Members | 2,129 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,396 software developers and data experts.

ObjectDataSource (ODS) SelectParameter DefaultValue not being passed

SJL
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, the
default value is never used.

I can explicitly set it in the page load calling the GridView.Sort method,
but I don't see why I should have to. Any ideas why the DefaultValue of my
SelectParameters don't work?

Thanks,
SJL
Jul 14 '06 #1
2 5623
Ok, great, I'm not going insane. I too am experiencing this issue.

I have an ODS that is working wonderfully with my SelectMethod and the
SelectParameters I've set. However, the DefaultValue for my sort
parameter (orderBy in my case) is ignored when the page is first
loaded.

I am able to sort after the pages loads, but the initial sort I
expected (based on the orderBy DefaultValue) does not occur. While
stepping through the code, I verified the parameter is not set when my
SelectMethod is called.

Anyone experience this issue and workaround it in any way?

Thanks,
LG

SJL wrote:
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, the
default value is never used.

I can explicitly set it in the page load calling the GridView.Sort method,
but I don't see why I should have to. Any ideas why the DefaultValue of my
SelectParameters don't work?

Thanks,
SJL
Jul 14 '06 #2
SJL,

I answered this on my blog:

http://www.manuelabadia.com/blog/Per...a039fb63e.aspx

The answer is this:

When the GridView needs data, a select operation is performed in the
underlying data source control. Before this operation is performed, a
method called CreateDataSourceSelectArguments is called on the
GridView. This method creates the arguments that will be passed to the
Select method of the ObjectDataSource, which in turns calls the method
specified by the property SelectMethod. In the
CreateDataSourceSelectArguments method, the SortExpression is set based
on the GridView's state and the ObjectDataSource just assign that
value to the sort parameter. So, as you can see, the DefaultValue is
never used for the sort parameter.

I hope it helps,
Manuel Abadia

SJL ha escrito:
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, the
default value is never used.

I can explicitly set it in the page load calling the GridView.Sort method,
but I don't see why I should have to. Any ideas why the DefaultValue of my
SelectParameters don't work?

Thanks,
SJL
Jul 16 '06 #3

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

Similar topics

2
by: nunya5200-bidness | last post by:
I hope someone may have some insight to this issue... I would like to know how to properly implement exception handling using the ObjectDataSource control. Specfically, I am doing an insert...
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...
0
by: Dabbler | last post by:
I generated ObjectDataSource parameters using the VSWD wizard. It generated the code as <asp:Parameter Name="firstName" Type="String" /> with lowercase Name attribute value. My getters and...
1
by: syl | last post by:
Hello I am trying to create a "easy to use" gridview with filters (dropdownlist in headers), sorting...and much more.... In order to do that, i prefer to use a objectdatasource (ODS) beacause...
1
by: Roger | last post by:
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">...
0
by: m.bagattini | last post by:
Hello folks, I'll try to be as much clear as I can. This is my issue: Asp.NET 2.0 page w/ FormView (later: FW), an ObjectDataSource (ODS). It works with my Business logic layer, where I have...
0
by: msch-prv | last post by:
(Re-post) I have a datalist tied to an ObjectDataSource (ods) that selects data via a custom function located in my BLL. The function retrieves data either directly from the db or the cache using...
0
by: trini32 | last post by:
and another problem which just wont work as I planned.. I created an aspx site (report) as follows: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Report.aspx.cs"...
1
by: MAQ | last post by:
Hi, I have 2 ObjectDataSource on my page "OderDetailDataSource" and "CustomerDataSource". The first datasource returns only one record, out of which there one column called "CustomerID". The...
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
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
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.