View Single Post
Old October 13th, 2009, 05:20 PM
Lee Dumond's Avatar
Lee Dumond Lee Dumond is offline
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts

You are technically correct that the Importance textbox could be set declaratively by doing this:

   <asp:TextBox ID="txtImportance" runat="server" Text="0" MaxLength="256" Width="100%"></asp:TextBox>
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.
Visit my blog at
Follow me on Twitter:

if (this.PostHelpedYou)
The Following User Says Thank You to Lee Dumond For This Useful Post:
carewithl (October 14th, 2009)