"There's a second ObjectDataSource used to handle the data retrieval, inserts, and updates from the bottom DetailsView. All parameters for the insert and update are automatically inferred from the DetailsView's fields."
How is this possible? Is it because the params for the actual "UpdateCategory" and "InsertCategory" methods in the Category class are spelled the same way as the string params for the "Bind" and "Eval" methods (managecategories.aspx)?
If so, then this "matching" process is case-insensitive, correct?
I will be more specific. For example, that ObjectDataSource's chosen insert method looks like this:
public static int InsertCategory(string title, int importance, string description, string imageUrl)
If ASP.NET passes values from the input TextBoxes to that method, how does ASP.NET automatically know exactly which input value must go to which parameter, in the above method? What will happen if I change the order or spelling of the parameters in the above
method?
Well, it seems so. Besides this, I cannot give a more logical explanation.
Here is the difference between eval and bind:
Data-binding expressions are contained within
<%#
and
%>
delimiters and use the Eval and Bind functions. The Eval function is used to define one-way (read-only) binding. The Bind function is used for two-way (updatable) binding. In addition to calling Eval and Bind methods to perform data binding in a data-binding expression, you can call any publicly scoped code within the
<%#
and
%>
delimiters to execute that code and return a value during page processing.
....and I have done an experiment: instead of
<%# Bind("Description") %> I have written <%# Bind("aaaaa") %>, and is not working. So.....this is the only explanation :)
oooshola
Member
36 Points
24 Posts
Automatically inferred parameters?
May 29, 2007 08:36 PM|LINK
In chapter 5, on page 244, it says:
"There's a second ObjectDataSource used to handle the data retrieval, inserts, and updates from the bottom DetailsView. All parameters for the insert and update are automatically inferred from the DetailsView's fields."
How is this possible? Is it because the params for the actual "UpdateCategory" and "InsertCategory" methods in the Category class are spelled the same way as the string params for the "Bind" and "Eval" methods (managecategories.aspx)?
If so, then this "matching" process is case-insensitive, correct?
I will be more specific. For example, that ObjectDataSource's chosen insert method looks like this:
public static int InsertCategory(string title, int importance, string description, string imageUrl)
If ASP.NET passes values from the input TextBoxes to that method, how does ASP.NET automatically know exactly which input value must go to which parameter, in the above method? What will happen if I change the order or spelling of the parameters in the above method?
tarjoadi
Member
27 Points
93 Posts
Re: Automatically inferred parameters?
Jun 21, 2007 07:48 PM|LINK
Well, it seems so. Besides this, I cannot give a more logical explanation.
Here is the difference between eval and bind:
Data-binding expressions are contained within
and delimiters and use the Eval and Bind functions. The Eval function is used to define one-way (read-only) binding. The Bind function is used for two-way (updatable) binding. In addition to calling Eval and Bind methods to perform data binding in a data-binding expression, you can call any publicly scoped code within the and delimiters to execute that code and return a value during page processing.....and I have done an experiment: instead of <%# Bind("Description") %> I have written <%# Bind("aaaaa") %>, and is not working. So.....this is the only explanation :)