Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > object data source

Reply
Thread Tools

object data source

 
 
eagle
Guest
Posts: n/a
 
      07-09-2007
I have a grid with an object datasource; selecting and populating the grid
works fine. I want to delete an item in the grid. How can I find out the
value of the parameters that are getting passed to my method? Or how can I
populate these parameters with the correct values? When I debug the method,
there are no values getting passed to it. The datasource and grid are as
follows:

GRIDVIEW:

<asp:GridView ID="gvProducts" runat="server" AutoGenerateColumns="False"
DataSourceID="oDSProducts" EmptyDataText="No products found">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
EditImageUrl="~/Images/Edit.gif" DeleteImageUrl="~/Images/trash.gif"
CancelImageUrl="~/Images/undo.gif" SelectImageUrl="~/Images/arrow-right.gif"
UpdateImageUrl="~/Images/Update.gif" ButtonType="Image" SelectText=""
ShowSelectButton="True" />
<asp:TemplateField InsertVisible="False" SortExpression="ID">
<ItemTemplate>
<asp:Label ID="Label2" visible="false" runat="server" Text='<%#
Bind("ID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ItemNumber" HeaderText="Item Number"
SortExpression="ItemNumber" />
<asp:BoundField DataField="Productname" HeaderText="Product Name"
SortExpression="Productname" />
<asp:BoundField DataField="WholeSalePrice" HeaderText="Wholesale"
SortExpression="WholeSalePrice" DataFormatString="{0:c2}" >
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField DataField="Retailprice" HeaderText="Retail"
SortExpression="Retailprice" DataFormatString="{0:d2}" >
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
</Columns>
</asp:GridView>


DATASOURCE:
<asp:ObjectDataSource ID="oDSProducts" runat="server"
SelectMethod="GetProductList"
TypeName="cls.Product" DeleteMethod="DeleteProduct">
<SelectParameters>
<asp:ControlParameter ControlID="gvCategories"
Name="ProductCategoryID" PropertyName="SelectedValue" Type="Int32"
DefaultValue="1" />
<asparameter Name="SectionID" DefaultValue="1" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asparameter Name="ID" />
<asparameter Name="ItemNumber" />
</DeleteParameters>
</asp:ObjectDataSource>


DELETE METHOD:
Public Shared Sub DeleteProduct(ByVal ID as String)

Try
Dim _DL as New cls
Dim qry as String = "ProductDelete '" & ID & "'"
_DL.ExecuteNonQuery(qry)
Catch ex As Exception
Throw New Exception("Delete Product: " & ex.Message)
End Try


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object data source, setting parameter source to Page.Partner.Guid Allan Ebdrup ASP .Net Web Controls 2 10-06-2006 10:24 AM
Need some ideas to selectively fetch data via object data source or cache... Siva ASP .Net 1 04-24-2006 08:54 PM
Object Data Source and Custom Business Object =?Utf-8?B?S2h1emVtYQ==?= ASP .Net 0 06-27-2005 07:03 AM
Data Recovery SOURCE CODE ( SOURCE CODES of Professional Data Recovery Software ) Author Tarun Tyagi C Programming 0 12-29-2004 05:10 PM
Data Recovery SOURCE CODE ( SOURCE CODES of Professional Data Recovery Software ) Author Tarun Tyagi Cisco 0 12-29-2004 05:03 PM



Advertisments