From: Shengqing Yang [MSFT] on 14 Jul 2010 05:38 Hi Gerry, Based on my understanding, you did a test on the ObjectDataSource you provided and was surprise to find it's update worked well as you expected it may have some problem since the properties is read-only. Actually, I am not quite understand the meaning of this test as although you used new key word to hide the base properties, the properties of the child class still return values from base class by the get statements. Since you did not provide the update method in your code, I simply write this code for a further test. public static void Update(immutableObj dat) { Objects[0] = dat; } And here is the code of the ASP.NET page. <asp:GridView ID="GridView1" runat="server" DataSourceID="objODS"> <Columns> <asp:CommandField ShowEditButton="True" /> <asp:CommandField ShowSelectButton="True" /> </Columns> </asp:GridView> <asp:ObjectDataSource ID="objODS" runat="server" TypeName="objManager" SelectMethod="Select" UpdateMethod="Update" DataObjectTypeName="immutableObj"></asp:ObjectDataSource> When we update the first record in the GridView, we can find the ID value has been changed. This is because parameter dat is set to Objects[0] as a completed package and it will not use set statement in this process. So it is no problem to change the value of the class although the properties are read-only. I hope the explanation above can solve your puzzle of how the update method works. And if I have misunderstood you, please feel free to let me know. -- Sincerely, Bravo Yang Microsoft Online Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications. MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 2 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. 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/en-us/subscriptions/aa948874.aspx ==================================================
|
Pages: 1 Prev: Logon user name is empty Next: Crystal Reports for VS Web Application doesn't work |