Problem: Usercontrol + Objectdatasource not updating parameters
I was writing a usercontrol in ASP.NET that contained an
objectdatasource, a gridview, and some other form controls (textboxes
and dropdown lists). For the insertcommand parameters I associated
them with the form controls by assigning the ID of each control. The
button event simply called the DataBind method on the Gridview.
If I then typed values into the form fields and clicked the button,
the insertparameter collection never updated itself based on the
values I just entered.
If I take this same code and paste it onto an aspx it works
perfectly. Each button click correctly checks the controls and takes
whatever value is present.
Thinking I may have done something elsewhere that was causing the
problem I created an entirely new project, recreated everything, used
only one form control (a single textbox named TextBox1) and the exact
same behavior was repeated.
Any thoughts? I know I must be doing something incorrectly here, but
I'm not sure what. When I was assigning a form control to the
associated FormParameter I was just entering the control name (ex.
TextBox1). The behavior displayed was almost like the datasource
couldn't find the form field.
Has anyone else encountered this problem, and if so, how did you fix
Re: Problem: Usercontrol + Objectdatasource not updating parameters
After a good nights sleep I realized my mistake. I should have been
using ControlParameter instead of FormParameter. Changing that fixed
the problem quite nicely.
|All times are GMT. The time now is 01:09 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.