View Single Post
 
Old October 14th, 2009, 01:22 PM
carewithl carewithl is offline
Authorized User
 
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Lee Dumond View Post
You are technically correct that the Importance textbox could be set declaratively by doing this:

Code:
<InsertItemTemplate>
   <asp:TextBox ID="txtImportance" runat="server" Text="0" MaxLength="256" Width="100%"></asp:TextBox>
</InsertItemTemplate>
However, that wouldn't work if we want this field to participate in the update, because there're no databinding expression.

If you actually try this, the ObjectDataSource will throw an InvalidOperationException:

ObjectDataSource 'objCurrCategory' could not find a non-generic method 'InsertCategory' that has parameters: Title, ImageUrl, Description.

It is the Bind expression that let's a value participate in the two-way dayabinding process. If you try to set the Importance field declaratively, without a Bind expression, it cannot participate as a parameter in the two-way databinding. Therefore, it never gets sent as a parameter to the InsertCategory method.
Uh, I can’t believe I’ve missed that one. Sorry for taking you time and thank you