473,386 Members | 1,726 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,386 software developers and data experts.

Setting SelectParameter value for ObjectDataSource

MAQ
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 value on this column should be passed as
SelectParamter "CustomerID" for CustomerDataSource.

Could anybody help me figuring out how to do this? It might be something
very simple, but i'm still quite new to .NET.

Thanks in advance

/MAQ
Dec 1 '07 #1
1 3474
MAQ wrote:
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 value on this column should be passed as
SelectParamter "CustomerID" for CustomerDataSource.

Could anybody help me figuring out how to do this? It might be something
very simple, but i'm still quite new to .NET.

Thanks in advance

/MAQ

I don't know where could you need get value of "customerId" ? So i
assume that you store customerId in a HiddenField, so here your code :

[Code design]
<asp:ObjectDataSource ID="CustomerDataSource" TypeName="CustomerSource"
SelectMethod="GetCustomer" runat="server">
<SelectParameters>
<asp:ControlParameter ControlID="hiddenFieldCustomerId"
Name="customerId" PropertyName="Value" Type="int32" />
</SelectParameters></asp:ObjectDataSource>
[App_Code]
public class CustomerDataSource {
// ...
public IList<CustomerGetCustomer(int customerId) {
// your code in here to get one customer with id is "customerId"
// ...
}
// ...
}

--
Duy Lam Phuong
Dec 1 '07 #2

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

Similar topics

2
by: J055 | last post by:
Hi I've implemented caching for my ObjectDataSource. <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnableCaching="True" CacheDuration="10" CacheExpirationPolicy="Sliding" ...
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...
2
by: Charlie | last post by:
Hi: I'm using the ObjectDataSource control to databind a Repeater. The method on business object that ObjectDataSource control point to takes as a parameter an instance of the...
1
by: tparks69 | last post by:
Can anyone tell me is there an easy way to get a value into an objectdatasource select parameter from Application Variables? Obviously its easy from cookies, session etc... but what about...
0
by: Steve B. | last post by:
Hi, On a page, I've a dropdownlist box that is bound to an object datasource (which is a proxy to a web service). I also have a gridview that is bound to another object datasource (a ws too)....
0
by: =?Utf-8?B?cGI2NDgxNzQ=?= | last post by:
We have been having this problem for months and always assumed it was because of our somewhat complicated setup. I have just spent almost all of today making this into a simple example that can be...
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">...
5
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I have the following AccessDataSource control on my page.. <asp:AccessDataSource ID="adsAllStories" runat="server" DataFile="~/App_Data/Stories.mdb" SelectCommand="SELECT StoryID,...
2
by: JJ | last post by:
How can I set an ObjectDataSource's Parameter programmatically? The slight complication here is that I want to set this NOT in the 'Selecting' method of the ObjectDataSource, but elsewhere. I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.