Click here to Skip to main content
13,045,790 members (47,252 online)
Rate this:
Please Sign up or sign in to vote.
Hi all:

I write this code :
<asp:UpdatePanel ID="UpdatePanel2" runat="server" Visible="False" ChildrenAsTriggers="true" UpdateMode="Conditional">
                            <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2" DataSourceID="SqlDataSource2" ForeColor="Black" GridLines="None" Height="50px" Width="350px" EmptyDataText="There is no data in your profile..." AutoGenerateRows="False" DataKeyNames="product_id" AutoGenerateDeleteButton="True">
                                <AlternatingRowStyle BackColor="PaleGoldenrod" />
                                <EditRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                                    <asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
                                    <asp:BoundField DataField="category" HeaderText="category" SortExpression="category" />
                                    <asp:BoundField DataField="product_id" HeaderText="product_id" InsertVisible="False" ReadOnly="True" SortExpression="product_id" />
                                    <asp:HyperLinkField DataNavigateUrlFields="product_id" DataNavigateUrlFormatString="~/ProductDetailes.aspx?product_id={0}" DataTextField="product_id" DataTextFormatString="Click to see product detailes.." />
                                <FooterStyle BackColor="Tan" />
                                <HeaderStyle BackColor="Tan" Font-Bold="True" />
                                <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
                            <br />

but when i hit delete it doesn't work , it requires a trigger but i don't know it ..

any help please for the Insert,Update,Delete triggers will be appreciated
Posted 18-Apr-13 13:21pm
Updated 18-Apr-13 13:22pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
       UpdateCommand="Update Products SET name=@name,category=@category WHERE product_id=@product_id"
       InsertCommand="INSERT INTO Products(name,category,product_id) VALUES (@name,@category,@product_id)"
       DeleteCommand="DELETE FROM [Products] WHERE product_id=@product_id;" SelectCommand="SELECT * FROM [Products]">
           <asp:Parameter Name="name" />
           <asp:Parameter Name="category" />
           <asp:Parameter Name="product_id" />
Al-Najjar Ali Moh'd 19-Apr-13 14:02pm
Thank you very much :) , now it works ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 19 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100