473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

object data source

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" />
<asp:Parameter Name="SectionID" DefaultValue="1" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="ID" />
<asp:Parameter 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
Jul 9 '07 #1
0 886

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Khuzema | last post by:
Dear All, I am using issue tracker architecture and developed business object for my application. Now, in VS Beta 2, I humbly want to know how i can have same feature as dataset, in my business...
0
by: Stuart Ferguson | last post by:
I currently have a Gridview component on a web form bound to an object datasource and require to use the sorting facility, this seems to be unavailable in my grid since I have defined my own...
1
by: Siva | last post by:
Hi, I have a 3 tier ASP.Net app for a handheld which needs to fetch orders from database via a DAL and populate it in a gridview using objectdatasource. In the search page I have a few parameters...
1
by: Ram | last post by:
Hi All, I am using Object Data Source to bind data in the gridview. I have set the property AllowSorting=true. While running the application, I could sort the data only in ascending order. Is...
0
by: Annie | last post by:
Hello guys, We are planning for a big project ... and in the warming up stages ... we are trying to develop the applicaiton in n-tier. One of the option is to use the ASP.net object...
2
by: Orit | last post by:
Hello . Please find below my questions - I hope some of the ASP.NET experts of this forum will answer to those beginner's questions : My Web site should be able to work with either SQL Server...
2
by: =?Utf-8?B?RGF2ZSBU?= | last post by:
I have a list box that is bound to an object data source. I added a column, say ColumnC, to my typed data set and for it's expression I entered ColumnA + ': ' + ColumnB When I preview the...
3
by: Fresno Bob | last post by:
When you bind to the object data source you can bind to the underlying dataset that is returned by the select statement but can you bind to the properties of the object? MSDN says the...
2
by: parez | last post by:
Hi I have business object data source. and its is bound to a 3rd party combo box which displays grids. I have a property SomeDate which i want to display in the header as "Some Date" or...
0
by: =?Utf-8?B?Sm9l?= | last post by:
I have a user control that is in a FormView using an ObjectDataSource. When the page renders the form correctly displays the data from the data source. When I then change data and hit update, my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.