|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Object data source, setting parameter source to Page.Partner.GuidI'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 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 (waw***@online.microsoft.com, 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. 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.
Confirm Message in gridview
NullReferenceException with dynamic DataGrid Newbie ASP.NET question for Webportal project Tree view with XML and Populateondemand User controls and LoadControl method Slow File Upload Speed IIS 6.0 ASP.net 2.0 How to use .Net controls in regular ASP RowCommand Event of a nested Gridview RegularExpressionValidator How to assign access key to MenuItem |
|||||||||||||||||||||||