Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ObjectDataSource SelectMethod
Message
From
05/07/2010 11:49:08
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01471404
Message ID:
01471415
Views:
26
>>>>Hi,
>>>>
>>>>I have a mmGridView which has a combobox in its edit template to allow the user to select an item from a list. This is the definition of the datasource that is supposed to give the combo the items that the user can select (or at least that's what I understand it is supposed to be doing, but could be completely wrong):
>>>>
>>>>
<asp:ObjectDataSource ID="odsRiders" runat="server" SelectMethod="GetRidersAndWaiversByPlan(this.oPolicy.Entity.PlanFK)"
>>>>                                    TypeName="SamaanSystems.IAS.Business.Plan"></asp:ObjectDataSource>
>>>>
>>>>
>>>>I get this error:
>>>>
>>>>ObjectDataSource 'odsRiders' could not find a non-generic method 'GetRidersAndWaiversByPlan(this.oPolicy.Entity.PlanFK)' that has no parameters.
>>>>
>>>>This method does exist, so I guess my problem is how I am passing the parameters. How do I do this?
>>>
>>>Remove () from the SelectMethod and use SelectParameters to specify parameters.
>>
>>Thanks Naomi,
>>
>>if I try this:
>>
>>
<asp:ObjectDataSource ID="odsRiders" runat="server" SelectMethod="GetRidersAndWaiversByPlan"  SelectParameters="this.oPolicy.Entity.PlanFK"
>>                                    TypeName="SamaanSystems.IAS.Business.Plan"></asp:ObjectDataSource>
>>
>>I get this error:
>>
>>The 'SelectParameters' property is read-only and cannot be set.
>
>Here is a sample I have in my code
>
>
>  <asp:ObjectDataSource ID="odsSelectUsers" runat="server" DeleteMethod="Delete" InsertMethod="Insert"
>                                                OldValuesParameterFormatString="original_{0}" SelectMethod="GetMembers" SortParameterName="SortData"
>                                                TypeName="MembershipUtilities.MembershipUserAndProfileODS">
>                                                <DeleteParameters>
>                                                    <asp:Parameter Name="UserName" Type="String" />
>                                                </DeleteParameters>
>                                                <UpdateParameters>
>                                                    <asp:Parameter Name="userName" Type="String" />
>                                                    <asp:Parameter Name="email" Type="String" />
>                                                    <asp:Parameter Name="isLockedOut" Type="Boolean" />
>                                                    <asp:Parameter Name="isApproved" Type="Boolean" />
>                                                    <asp:Parameter Name="comment" Type="String" />
>                                                    <asp:Parameter Name="lastActivityDate" Type="DateTime" />
>                                                    <asp:Parameter Name="lastLoginDate" Type="DateTime" />
>                                                    <asp:Parameter Name="fCID" Type="Int32" />
>                                                    <asp:Parameter Name="fCWebAdminID" Type="Int32" />
>                                                    <asp:Parameter Name="siteID" Type="Int32" />
>                                                    <asp:Parameter Name="firstName" Type="String" />
>                                                    <asp:Parameter Name="middleName" Type="String" />
>                                                    <asp:Parameter Name="lastName" Type="String" />
>                                                    <asp:Parameter Name="jobTitle" Type="String" />
>                                                    <asp:Parameter Name="telephoneNum" Type="String" />
>                                                </UpdateParameters>
>                                                <SelectParameters>
>                                                    <asp:ProfileParameter Name="sortData" PropertyName="SiteID" Type="String" />
>                                                    <asp:Parameter DefaultValue="MasterAdmin" Name="ExcludeRole" Type="String" />
>                                                    <asp:ProfileParameter Name="SiteID" PropertyName="SiteID" Type="Int32" />
>                                                </SelectParameters>
>                                                <InsertParameters>
>                                                    <asp:Parameter Name="userName" Type="String" />
>                                                    <asp:Parameter Name="isApproved" Type="Boolean" />
>                                                    <asp:Parameter Name="comment" Type="String" />
>                                                    <asp:Parameter Name="lastLockoutDate" Type="DateTime" />
>                                                    <asp:Parameter Name="creationDate" Type="DateTime" />
>                                                    <asp:Parameter Name="email" Type="String" />
>                                                    <asp:Parameter Name="lastActivityDate" Type="DateTime" />
>                                                    <asp:Parameter Name="providerName" Type="String" />
>                                                    <asp:Parameter Name="isLockedOut" Type="Boolean" />
>                                                    <asp:Parameter Name="lastLoginDate" Type="DateTime" />
>                                                    <asp:Parameter Name="isOnline" Type="Boolean" />
>                                                    <asp:Parameter Name="passwordQuestion" Type="String" />
>                                                    <asp:Parameter Name="lastPasswordChangedDate" Type="DateTime" />
>                                                    <asp:Parameter Name="password" Type="String" />
>                                                    <asp:Parameter Name="passwordAnswer" Type="String" />
>                                                    <asp:Parameter Name="fCID" Type="Int32" />
>                                                    <asp:Parameter Name="fCWebAdminID" Type="Int32" />
>                                                    <asp:Parameter Name="siteID" Type="Int32" />
>                                                    <asp:Parameter Name="firstName" Type="String" />
>                                                    <asp:Parameter Name="middleName" Type="String" />
>                                                    <asp:Parameter Name="lastName" Type="String" />
>                                                    <asp:Parameter Name="jobTitle" Type="String" />
>                                                    <asp:Parameter Name="telephoneNum" Type="String" />
>                                                </InsertParameters>
>                                            </asp:ObjectDataSource>
>
>I don't think you can set SelectParameter the way you did. Try adjusting your code based on this sample.

Thanks for the code. I see this is what I need:
                                                <SelectParameters>
                                                    <asp:ProfileParameter Name="sortData" PropertyName="SiteID" Type="String" />
                                                    <asp:Parameter DefaultValue="MasterAdmin" Name="ExcludeRole" Type="String" />
                                                    <asp:ProfileParameter Name="SiteID" PropertyName="SiteID" Type="Int32" />
                                                </SelectParameters>
So I'll have to change it like this, I think:
                                                <SelectParameters>
                                                    <asp:ProfileParameter Name="planPK" PropertyName="????" Type="Guid" />
                                                </SelectParameters>
But I don't know how to define the PropertyName. Where is that set/created?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform