[2005] Naming parameters in the BLL methods when using ObjectDataSource BLL strategy
Hi,
Let s say I have a typed dataset and the BLL (business logic layer ) class and methods that use that typed dataset.
In the BLL I have the select method which return all the rows of a list of products for exemple
like this:
GetProductById(byval id as long)
myTableAdapter.GetProductById(id)
and the Insert method like this:
Insert(p_name, p_category,...)
myTableAdapter.Insert(p_name, p_category,...)
Please notice that I didn t use the parameter names: name, category..etc, I want to use instead: p_name, p_category...etc
So because I use p_ prefix in my naming, therefore, in the DataSourceObject Insert parameters are gonna be like this:
<InsertParameters>
<asp:Parameter Name="p_name" Type="String" />
<asp:Parameter Name="p_category" Type="String" />
....etc
</InsertParameters>
1/ Is that right so far? or is there a way to use: name, category..etc in the InsertParameters although I declared my BLL methods with the p_ prffixes?
2/ Now, my major problem is when I come to the databinding inside my DetailsView
My DetailsView ItemTemplate which shows one product at time is like this:
<asp:DetailsView....>
<Fields>
<asp:TemplateField HeaderText="Nom :">
<ItemTemplate>
<asp:TextBox MaxLength="50" CausesValidation="True" ValidationGroup="rolesValidationGroup"
ID="nomTxtBox" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox> ...more controls here
</ItemTemplate>
</asp:TemplateField>
....etc
AS you can see I use the ItemTemplate for both Insert and Select item. That works well when I try to insert a product, but when I try to select a product, I get an error, saying that the datarowview doesnot contain a property with the name: p_name. I guess the itemtemplate tries to retrieve the column p_name from the returned DataTable, and does not find it. How do I fix this please, is there some way to tell the framework to match the p_name property in the ItemTemplate with the column Name from the underlying DataBase.
Thanks a lot for answering any of my 2 questions.