Last post Jan 13, 2011 09:30 AM by Prnda1976
Jul 14, 2006 03:39 PM|Shaggiddi|LINK
I have an Update method for my ObjectDataSource with the following signature Update(Landmarl oLandmark);
The object is a little complicated and contains a number of custom objects itself. So I'm handling the ObjectDataSource control's Updating method. However when I try to set the parameter using the following code:
The code throws the following exception:
The OrderedDictionary is readonly and cannot be modified
Is there anyway to set custom parameter values for an ObjectDataSource control? The .NET documentation suggested setting it in this way, however its not working.
Jul 19, 2006 04:04 AM|Iori_Jay|LINK
Mar 23, 2007 12:18 AM|digioz|LINK
I am not sure if you have solved your problem by now or not. But I was having a similar problem, and the way I solved it was by using:
ObjectDataSource1.SelectParameters["ParameterName"].DefaultValue = "value to set";
I hope this helps. [:)]
Jul 27, 2007 05:42 AM|balleindia|LINK
Try doing this for custom objects in the ObjectDataSource1_Updating(object sender, ObjectDataSourceMethodEventArgs e) event. This works:
NewsDTO newsDTO = (NewsDTO)e.InputParameters["newsDTO"];
newsDTO.NewsID = Convert.ToInt32(Request.QueryString["id"]);
newsDTO.NewsHeadline = headlines;
newsDTO.NewsDate = newsDate;
newsDTO.NewsDetail = editednews;
Jan 13, 2011 09:30 AM|Prnda1976|LINK
Ok this actually worked for me but I don't understand how?
Can you explain me how is it that altering a separate instance of an object changes the values of the e.InputParameter(0)? Is this some built in behavior of objectdataSource's Updating event?