Thank you Peter, that does work, however, I was under the impression
that I could do something like this in my .aspx page and achieve the
same effect as the code you posted in your reply:
<InsertParameters>
<asp:ControlParameter Name="roleName" ControlID="roleNameTextBox"
PropertyName="Text" />
</InsertParameters>
The above doesn't work and generates the error message I described in
my original post. Why am I unable to accomplish the same task using a
ControlParameter?
- Harry
PeterKellner wrote:
On 7 Jun 2006 08:34:14 -0700, si**********@gmail.com wrote:
Hello,
I'm having trouble using the insert method of an ObjectDataSource that
uses a custom DataObjectType. If I'm using a custom DataObjectType does
my insert method have to take that object, i.e.
myInsertMethod(MyCustomObjectType foobar) or can I actually specify
parameters to the insert method via the InsertParameters collection
associated with the ObjectDataSource, i.e. myInsertMethod(string name,
int age). Doing the latter I keep getting the error message
ObjectDataSource has no values to insert. Check that the 'values'
dictionary contains values,
- Harry
Hi Harry,
I've been asked this a bunch so I thought I write a blog about it. The
short answer is:
ObjectDataSource1.InsertParameters["roleName"].DefaultValue =
TextBoxRole.Text;
ObjectDataSource1.Insert();
The Long answer is here: http://peterkellner.net/?p=37
Good Luck.
Peter Kellner
http://peterkellner.net