Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 12th, 2006, 02:23 AM
Registered User
 
Join Date: Jun 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Customer Support - Can't delete anything

Is there an error in the Delete procedures for all of the items? I only get the Confirmation message when I click the delete button on the Products/Downloads/etc. pages in the Management folder. Here is the code I have in my installation on the Downloads page:

Protected Sub gvDownload_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs ) Handles gvDownload.RowCommand

    Dim selectedIndex As Integer
    Dim productId As Integer

    Select Case e.CommandName.ToLower()
      Case "edititem"
        selectedIndex = Convert.ToInt32(e.CommandArgument)
        productId = Convert.ToInt32(gvDownload.DataKeys(selectedIndex) .Value)
        Response.Redirect(String.Format("InsertUpdateDownl oad.aspx?Id={0}", productId.ToString()))
      Case "deleteitem"
        selectedIndex = Convert.ToInt32(e.CommandArgument)
        productId = Convert.ToInt32(gvDownload.DataKeys(selectedIndex) .Value)
        Download.Delete(productId)
        gvDownload.DataBind()
    End Select
  End Sub

  Protected Sub gvDownload_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvDownload.RowCreated
    ' Find a reference to the Delete button and add a confirmation message
    If e.Row.RowType = DataControlRowType.DataRow Then
      Dim myButton As Button = CType(e.Row.Cells(3).Controls(0), Button)
      myButton.OnClientClick = "return confirm('Are you sure you want to delete this download?');"
    End If
  End Sub
End Class
 
Old June 12th, 2006, 02:27 AM
Registered User
 
Join Date: Jun 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh and if I just delete the second procedure that adds the confirmation message, eveything deletes correctly.

 
Old June 12th, 2006, 01:59 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

How does the HTML for the Delete buttons look like when you open in the page in your browser?


AFAIK, there shouldn't be a problem with this code; all it does is add a confirmation box to each button. It shouldn't prevent you from actually deleting the item (unless you click Cancel of course ;) )

Do you get the confirmation dialog at all?

Imar


 
Old June 26th, 2006, 06:15 PM
Registered User
 
Join Date: Jun 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I do get the confirmation dialog.

This is the HTML generated for that whole page:
Quote:
quote:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
    Manage Products
</title><link href="../Css/Core.css" rel="stylesheet" type="text/css" /><link href="../Css/Styles.css" rel="stylesheet" type="text/css" /></head>
<body>
  <form name="aspnetForm" method="post" action="Products.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="LazxpNJpyA9FXaLJdPQp0XnvF9f+iObOiNMsGSPz8lA f+3FA8/mp6P0ZAEfpExcJ2zpdufoU7qNMuOzbTz1+HqtbLWta4kIM/lbZkfbrVOIlymPPef/02rzBNs5/ltk4KDpMtrY3/UH59/Mj5dgibdVSm5m4SXq7jEpep+kgOa8O9SOT1lyTZNcLUm56RbxZ pD2jEMUgxwJoo8vfnrBqNjKcJr8ZI8hpSxCTW+Q1kaawajqJ2q uew39pYoF7sHduTlk2Xf+RB358MCaVUFxNgZ2NPHVK0RJULq/rLuel64dJoBvwKJw0MipeBu/3YaQD1C5cxD6aFoFqvBw99Ou0Pfu2H1BBYRWc8JXs3Bg1znP+W A/DX4U27X+CBdovtbxOFmmg/pFCge2lg4Qiu25WbQKVNNgpdSrIgo1lBE2XR8a3iOk8Mk9D+z3 UZxmH8da2JqqMg8fli0h24CPBVHc15SKDt5U1WSYHJ34z3f3Sl H+mUx3tsgl/KA2SrtALJQNxY7eCT29AB/DIh88HtiI7omDML3SCzgFuM6K76lVCjLSoEbynuZtwnlcX3Hsd KOVzW8CTSS8NjO0LHalGeY4MQZRKtZXc0mF88MS9Q/t2H+JdUZeXiilYDC3fOfyWOVQqB9OPEIF/E+Esn1Js9ChyhSX1bVdXhgBQOR8pucDnbdM4oGc/zM7Q7G7k7wV6Rf+6RuooLc1HS3D3ayRurgM/+k5wSkDid+eeYsUDYK6J1pieR2dqY/WPH4BHH3z387JFh+wPr3qqIw19ABuaSiXCn1TGBkXVbt+t+oc+ fKhAiAy8zz5e8Th5bB5EnbD4Q6JP2TSaanWHLs+KliEtLtt+Xw ==" />
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
// -->
</script>

    <div id="PageWrapper">
      <div id="Header">
        <a id="ctl00_Header1_hyperHome" href="../"><img id="ctl00_Header1_imgLogo" src="../Images/WroxLogo.gif" style="border-width:0px;" /></a>
      </div>
      <div id="MainMenu">
[list]
<li><a href="../" id="ctl00_MainMenu1_A1">Home</a></li>
<li><a href="../ContentFiles/Products.aspx" id="ctl00_MainMenu1_A2">Products</a></li>

<li><a href="../ContentFiles/Downloads.aspx" id="ctl00_MainMenu1_A3">Downloads</a></li>
<li><a href="../ContentFiles/Faqs.aspx" id="ctl00_MainMenu1_A4">FAQ</a></li>
<li><a href="Default.aspx" id="ctl00_MainMenu1_A5">Management</a></li></ul>

      </div>
      <div id="MainContent">
        <table width="100%">
        <tr>
          <td id="LeftMenuManagement">

[list]
  <li><a href="Default.aspx" id="ctl00_ManagementMenu1_A1">Management home</a></li>
  <li><a href="Products.aspx" id="ctl00_ManagementMenu1_A2">Products</a></li>
  <li><a href="Downloads.aspx" id="ctl00_ManagementMenu1_A3">Downloads</a></li>
  <li><a href="Faqs.aspx" id="ctl00_ManagementMenu1_A4">FAQs</a></li>
  <li><a href="Categories.aspx" id="ctl00_ManagementMenu1_A5">Categories</a></li>

</ul>
          </td>
          <td id="MainContentManagement">

  <h1>Manage Products</h1>
  Below you find a list with all the products in the system. Click Edit or Delete to change existing products or click the Create New Product button to create a new product.
  <br />
  <br />
  <div>
    <table cellspacing="0" cellpadding="3" rules="all" border="1" id="ctl00_MainContentPlaceHolder_gvProduct" style="width:100%;border-collapse:collapse;">

        <tr class="GridHeaderStyle">
            <th align="left" scope="col"><a href="javascript:__doPostBack('ctl00$MainContentPl aceHolder$gvProduct','Sort$Id')">Id</a></th><th align="left" scope="col"><a href="javascript:__doPostBack('ctl00$MainContentPl aceHolder$gvProduct','Sort$Title')">Title</a></th><th align="left" scope="col">Edit</th><th align="left" scope="col">Delete</th>
        </tr><tr class="GridRowStyle">
            <td style="width:50px;">17</td><td style="width:300px;">Flatbed Scanner Exan 850 - With free Paper Tray</td><td style="width:75px;"><input type="button" value="Edit" onclick="javascript:__doPostBack('ctl00$MainConten tPlaceHolder$gvProduct','EditItem$0')" /></td><td style="width:75px;"><input type="button" value="Delete" onclick="return confirm('Are you sure you want to delete this product?');javascript:__doPostBack('ctl00$MainCont entPlaceHolder$gvProduct','DeleteItem$0')" /></td>
        </tr><tr class="GridAlterenatingRowStyle">
            <td style="width:50px;">20</td><td style="width:300px;">Flatbed Scanner Ipson 320 - With free Paper Tray</td><td style="width:75px;"><input type="button" value="Edit" onclick="javascript:__doPostBack('ctl00$MainConten tPlaceHolder$gvProduct','EditItem$1')" /></td><td style="width:75px;"><input type="button" value="Delete" onclick="return confirm('Are you sure you want to delete this product?');javascript:__doPostBack('ctl00$MainCont entPlaceHolder$gvProduct','DeleteItem$1')" /></td>

        </tr><tr class="GridRowStyle">
            <td style="width:50px;">21</td><td style="width:300px;">Handscanner Handyman 1</td><td style="width:75px;"><input type="button" value="Edit" onclick="javascript:__doPostBack('ctl00$MainConten tPlaceHolder$gvProduct','EditItem$2')" /></td><td style="width:75px;"><input type="button" value="Delete" onclick="return confirm('Are you sure you want to delete this product?');javascript:__doPostBack('ctl00$MainCont entPlaceHolder$gvProduct','DeleteItem$2')" /></td>
        </tr><tr class="GridAlterenatingRowStyle">
            <td style="width:50px;">22</td><td style="width:300px;">Handscanner Handyman Version 2.0</td><td style="width:75px;"><input type="button" value="Edit" onclick="javascript:__doPostBack('ctl00$MainConten tPlaceHolder$gvProduct','EditItem$3')" /></td><td style="width:75px;"><input type="button" value="Delete" onclick="return confirm('Are you sure you want to delete this product?');javascript:__doPostBack('ctl00$MainCont entPlaceHolder$gvProduct','DeleteItem$3')" /></td>
        </tr><tr class="GridRowStyle">
            <td style="width:50px;">19</td><td style="width:300px;">The Rocks Hardware 3D Printer 940</td><td style="width:75px;"><input type="button" value="Edit" onclick="javascript:__doPostBack('ctl00$MainConten tPlaceHolder$gvProduct','EditItem$4')" /></td><td style="width:75px;"><input type="button" value="Delete" onclick="return confirm('Are you sure you want to delete this product?');javascript:__doPostBack('ctl00$MainCont entPlaceHolder$gvProduct','DeleteItem$4')" /></td>

        </tr><tr class="GridAlterenatingRowStyle">
            <td style="width:50px;">18</td><td style="width:300px;">The Rocks Hardware Power Printer 850</td><td style="width:75px;"><input type="button" value="Edit" onclick="javascript:__doPostBack('ctl00$MainConten tPlaceHolder$gvProduct','EditItem$5')" /></td><td style="width:75px;"><input type="button" value="Delete" onclick="return confirm('Are you sure you want to delete this product?');javascript:__doPostBack('ctl00$MainCont entPlaceHolder$gvProduct','DeleteItem$5')" /></td>
        </tr>
    </table>
</div>
  <br />
  <br />
  <input type="submit" name="ctl00$MainContentPlaceHolder$btnNew" value="Create New Product" id="ctl00_MainContentPlaceHolder_btnNew" /><br />



          </td>
        </tr>
        </table>
      </div>
    </div>
    <div id="Footer">

<a href="http://p2p.wrox.com" target="_blank">&copy; 2005 Wrox - p2p.wrox.com</a>
    </div>


<div>

    <input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" />
    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="Tt6ZSyA4HZbfzfmjamsOh6VZv1rFs8zv/Dc/KL/V3HSSn3GaJFkyfm8cvM/aA9MO/rLQTUJYcqkX0j3erDalSoQyC2wMr3Pe9YOU+OW/hteHUPe6Y75Wb5lJPpAnR6usjPJmLAdzB0QRBFhVqk+gUg==" />
</div></form>
</body>
</html>
 
Old June 27th, 2006, 04:15 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi mfoof,

This is weird. I can't see anything wrong with this code. It should ask for confirmation and when you click OK, it should post back to the server and delete the item.

Do you have JavaScript enabled? Can you reproduce the problem on a different browser or machine?


Imar
 
Old July 3rd, 2006, 05:01 PM
Registered User
 
Join Date: Jun 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

JavaScript is enabled. I have reproduced it every time on two different machines, in IE 6.0 and Firefox 1.5, and Opera 9.0.

When I remove the sub to add the Confirmation Message, the deleteitem fires correctly.

I will take a closer look at how the "...OnClientClick = 'return confirm..." methods work. Really hope to figure this one out. Thanks.

 
Old July 5th, 2006, 04:38 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi mfoof,

Sorry for the delay. took me a while to figure this one out.

Anyway, here's what happened:

By default, a ButtonColumn renders as an <input type="button"> HTML element. Normally, this is fine, as some JavaScript is embedded to submit the form when the button is clicked. However, with the delete confirmation code, things get messed up. Take a look at this:

<input type="button" value="Delete" onclick="return confirm('Are you
sure you want to delete this product?');javascript:__doPostBack
('ctl00$MainContentPlaceHolder$gvProduct','DeleteI tem$0')" />

When you click OK, you effectively have this:

onclick="return true";

This blocks the following JavaScript code from being executed and the form is never executed.

The fix is reasonably easy though.

1. Open the Products page in Design View

2. Open the Smart Task and choose Edit Columns

3. Locate the Delete column and convert it to a template by clicking the blue link.

You should end up with something like this:

<asp:TemplateField HeaderText="Delete" ShowHeader="False">
  <ItemStyle Width="75px" />
  <HeaderStyle HorizontalAlign="Left" />
  <ItemTemplate>
    <asp:Button ID="Button1" runat="server"
      CausesValidation="false" CommandName="DeleteItem" Text="Delete"
    />
  </ItemTemplate>
</asp:TemplateField>

4. Modify the code so you end up with this:

<asp:TemplateField HeaderText="Delete" ShowHeader="False">
  <ItemStyle Width="75px" />
  <HeaderStyle HorizontalAlign="Left" />
  <ItemTemplate>
    <asp:Button ID="Button1" CommandArgument='<%# Eval("Id") %>'
      runat="server" CausesValidation="false"
      CommandName="DeleteItem" Text="Delete"
      OnClientClick="return confirm('Are you sure you want to delete
          this product?');"
           />
  </ItemTemplate>
</asp:TemplateField>

(I added the CommandArgument and the OnClientClick properties)

Because the command argument now contains the product ID, you need to change some code in the code behind as well.

5. Locate the gvProduct_RowCommand event handler and change the case for deleteitem to this:

      Case "deleteitem"
        productId = Convert.ToInt32(e.CommandArgument)
        Product.Delete(productId)
        gvProduct.DataBind()

6. Run the page. If everything worked out as planned (it's a million degrees out here so maybe due to the heat I left something out) you should now be able to delete products.

If not, please let me know.

Next time when you post code here, can you please add a few line breaks? The page I am typing this message in is a about 3 feet wide... ;)

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old March 8th, 2007, 06:48 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This works.

If e.Row.RowType = DataControlRowType.DataRow Then
   Dim lb As LinkButton
   lb = e.Row.Cells(0).Controls(0)
   lb.Attributes.Add("onclick", "if(!confirm('Are you sure you want to delete this row?') return false;")
End If

You can use the field template as others have suggested but this is much more simple and will fire the correct event.

 
Old November 22nd, 2007, 02:12 PM
Authorized User
 
Join Date: Nov 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Imar
 Hi mfoof,

Sorry for the delay. took me a while to figure this one out.

Anyway, here's what happened:

By default, a ButtonColumn renders as an <input type="button"> HTML element. Normally, this is fine, as some JavaScript is embedded to submit the form when the button is clicked. However, with the delete confirmation code, things get messed up. Take a look at this:

<input type="button" value="Delete" onclick="return confirm('Are you
sure you want to delete this product?');javascript:__doPostBack
('ctl00$MainContentPlaceHolder$gvProduct','DeleteI tem$0')" />

When you click OK, you effectively have this:

onclick="return true";

This blocks the following JavaScript code from being executed and the form is never executed.

The fix is reasonably easy though.

1. Open the Products page in Design View

2. Open the Smart Task and choose Edit Columns

3. Locate the Delete column and convert it to a template by clicking the blue link.

You should end up with something like this:

<asp:TemplateField HeaderText="Delete" ShowHeader="False">
<ItemStyle Width="75px" />
<HeaderStyle HorizontalAlign="Left" />
<ItemTemplate>
    <asp:Button ID="Button1" runat="server"
     CausesValidation="false" CommandName="DeleteItem" Text="Delete"
    />
</ItemTemplate>
</asp:TemplateField>

4. Modify the code so you end up with this:

<asp:TemplateField HeaderText="Delete" ShowHeader="False">
<ItemStyle Width="75px" />
<HeaderStyle HorizontalAlign="Left" />
<ItemTemplate>
    <asp:Button ID="Button1" CommandArgument='<%# Eval("Id") %>'
     runat="server" CausesValidation="false"
     CommandName="DeleteItem" Text="Delete"
     OnClientClick="return confirm('Are you sure you want to delete
         this product?');"
         />
</ItemTemplate>
</asp:TemplateField>

(I added the CommandArgument and the OnClientClick properties)

Because the command argument now contains the product ID, you need to change some code in the code behind as well.

5. Locate the gvProduct_RowCommand event handler and change the case for deleteitem to this:

     Case "deleteitem"
        productId = Convert.ToInt32(e.CommandArgument)
        Product.Delete(productId)
        gvProduct.DataBind()

6. Run the page. If everything worked out as planned (it's a million degrees out here so maybe due to the heat I left something out) you should now be able to delete products.

If not, please let me know.

Next time when you post code here, can you please add a few line breaks? The page I am typing this message in is a about 3 feet wide... ;)

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old November 22nd, 2007, 02:20 PM
Authorized User
 
Join Date: Nov 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Still can't delete products in Customer Support

I've implemented your fix, but get following error:

  "Unable to cast object of type 'System.Web.UI.LiteralControl' to
   type 'System.Web.UI.WebControls.Button'."

Error occurs in this line of gvProduct_RowCreated Event:

  Dim myButton As Button = CType(e.Row.Cells(3).Controls(0), Button)

Products.aspx changes in Delete as follows:

      <asp:ButtonField ButtonType="Button" CommandName="EditItem" Text="Edit" HeaderText="Edit">
        <ItemStyle Width="75px" />
        <HeaderStyle HorizontalAlign="Left" />
      </asp:ButtonField>
      <asp:TemplateField HeaderText="Delete" ShowHeader="False">
        <ItemStyle Width="75px" />
        <HeaderStyle HorizontalAlign="Left" />
        <ItemTemplate>
        <asp:Button ID="Button1" CommandArgument='<%# Eval("Id") %>'
            runat="server" CausesValidation="false"
            CommandName="DeleteItem" Text="Delete"
            OnClientClick="return confirm('Are you sure you want to delete
        this product?');" />
        </ItemTemplate>
      </asp:TemplateField>
    </Columns>

Changes in code behind as follows:

Protected Sub gvProduct_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs ) Handles gvProduct.RowCommand
    Dim selectedIndex As Integer
    Dim productId As Integer
    Select Case e.CommandName.ToLower()
      Case "edititem"
        selectedIndex = Convert.ToInt32(e.CommandArgument)
        productId = Convert.ToInt32(gvProduct.DataKeys(selectedIndex). Value)
        Response.Redirect(String.Format("InsertUpdateProdu ct.aspx?Id={0}", productId.ToString()))
      Case "deleteitem"
                productId = Convert.ToInt32(e.CommandArgument)
                Product.Delete(productId)
                gvProduct.DataBind()
                'selectedIndex = Convert.ToInt32(e.CommandArgument)
                ' productId = Convert.ToInt32(gvProduct.DataKeys(selectedIndex). Value)
                ' Product.Delete(productId)
                ' gvProduct.DataBind()
        End Select
  End Sub

Very much appreciate your help to get this working.

All the best

John








Quote:
quote:Originally posted by Imar
 Hi mfoof,

Sorry for the delay. took me a while to figure this one out.

Anyway, here's what happened:

By default, a ButtonColumn renders as an <input type="button"> HTML element. Normally, this is fine, as some JavaScript is embedded to submit the form when the button is clicked. However, with the delete confirmation code, things get messed up. Take a look at this:

<input type="button" value="Delete" onclick="return confirm('Are you
sure you want to delete this product?');javascript:__doPostBack
('ctl00$MainContentPlaceHolder$gvProduct','DeleteI tem$0')" />

When you click OK, you effectively have this:

onclick="return true";

This blocks the following JavaScript code from being executed and the form is never executed.

The fix is reasonably easy though.

1. Open the Products page in Design View

2. Open the Smart Task and choose Edit Columns

3. Locate the Delete column and convert it to a template by clicking the blue link.

You should end up with something like this:

<asp:TemplateField HeaderText="Delete" ShowHeader="False">
<ItemStyle Width="75px" />
<HeaderStyle HorizontalAlign="Left" />
<ItemTemplate>
    <asp:Button ID="Button1" runat="server"
     CausesValidation="false" CommandName="DeleteItem" Text="Delete"
    />
</ItemTemplate>
</asp:TemplateField>

4. Modify the code so you end up with this:

<asp:TemplateField HeaderText="Delete" ShowHeader="False">
<ItemStyle Width="75px" />
<HeaderStyle HorizontalAlign="Left" />
<ItemTemplate>
    <asp:Button ID="Button1" CommandArgument='<%# Eval("Id") %>'
     runat="server" CausesValidation="false"
     CommandName="DeleteItem" Text="Delete"
     OnClientClick="return confirm('Are you sure you want to delete
         this product?');"
         />
</ItemTemplate>
</asp:TemplateField>

(I added the CommandArgument and the OnClientClick properties)

Because the command argument now contains the product ID, you need to change some code in the code behind as well.

5. Locate the gvProduct_RowCommand event handler and change the case for deleteitem to this:

     Case "deleteitem"
        productId = Convert.ToInt32(e.CommandArgument)
        Product.Delete(productId)
        gvProduct.DataBind()

6. Run the page. If everything worked out as planned (it's a million degrees out here so maybe due to the heat I left something out) you should now be able to delete products.

If not, please let me know.

Next time when you post code here, can you please add a few line breaks? The page I am typing this message in is a about 3 feet wide... ;)

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error-Object does not support doesn't support this bootsy Classic ASP Basics 1 May 25th, 2008 07:14 PM
Customer Support Site Master Pg. Meta Tags taggiese BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 February 26th, 2007 11:35 PM
Customer Support overdos2 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 November 30th, 2006 04:54 PM
Customer Support - Adding Second Level Category mfoof BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 July 4th, 2006 12:22 AM
Customer table missing? doanhvu BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 June 27th, 2006 12:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.