Object data source, setting parameter source to Page.Partner.Guid

A

Allan Ebdrup

I'm trying to databind using an object data source to a dropdownlist in
asp.net 2.0, The method I'm databinding to takes a parameter. My page is a
page I've implemented by inheriting from the normal page object, and it has
a property called Partner that in turn has a property called Guid. I would
like to pass the Page.Partner.Guid as a parameter to the method that I'm
databinding to. How can I do this, I can choose parameter source to None,
Cookie, Control, Form, Profile, Querystring, Session.
But I cant find my Page.Partner.Guid in any of those options, the page
control is not listed in Control.
What is Profile? Could I add my Partner object to the profile?

How do I get this to work?

Kind Regards,
Allan Ebdrup
 
W

Walter Wang [MSFT]

Hi Allan,

You can just select "None" for the parameter type and pass the parameter
value in ObjectDataSource's Selecting event:

protected void ObjectDataSource1_Selecting(object sender,
ObjectDataSourceSelectingEventArgs e)
{
e.InputParameters["guid"] = this.Partner.Guid;
}

You can add a custom type as a Profile property by:

<system.web>
<profile>
<properties>
<add name="Partner" type="mynamespace.Partner"/>
</properties>

However, since your ObjectDataSource's using the Partner.Guid as parameter,
you cannot directly use Profile.Partner as its parameter.

Please reply to let me know whether or not you need further information.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

Allan Ebdrup

I found a workaround:
I simply save the property in a hidden field, in Page_Load, that is not
visible and let teh object data source get its parameter from there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top