Gridview Delete?

B

bdog4

I'm a bit new to asp.net and I'm trying to do very simple delete from
a grid view but everytime I click on the delete link for the row it
the page reloads and of course my row is still there. What am I
missing here?

<%@ Page Language="VB" MasterPageFile="~/XeroxScan.master"
AutoEventWireup="false" CodeFile="Files.aspx.vb" Inherits="Files"
title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server">
&nbsp;<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display."
Width="719px">
<Columns>
<asp:BoundField DataField="ClientCode"
HeaderText="ClientCode" SortExpression="ClientCode" />
<asp:BoundField DataField="Description"
HeaderText="Description" SortExpression="Description" />
<asp:HyperLinkField DataNavigateUrlFields="FileID"
DataNavigateUrlFormatString="EditEntry.aspx?FileID={0}"
HeaderText="Edit" Text="Edit" />
<asp:TemplateField ShowHeader="False" HeaderText="Delete">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server"
CausesValidation="False" CommandName="Delete"
OnClientClick='return confirm("Are you sure you
want to delete this entry?");'
Text="Delete" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:WCMWebConnectionString1 %>"
ProviderName="<%$
ConnectionStrings:WCMWebConnectionString1.ProviderName %>"
SelectCommand="SELECT [FileID], [ClientCode], [Description],
[Client] FROM [StandFiles] ORDER BY [ClientCode]"
DeleteCommand="DELETE FROM [StandFiles] WHERE [FileID] = @FileID"
InsertCommand="INSERT INTO [StandFiles] ([ClientCode], [Description],
[Client]) VALUES (@ClientCode, @Description, @Client)"
UpdateCommand="UPDATE [StandFiles] SET [ClientCode] = @ClientCode,
[Description] = @Description, [Client] = @Client WHERE [FileID] =
@FileID">
<DeleteParameters>
<asp:parameter Name="FileID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:parameter Name="ClientCode" Type="String" />
<asp:parameter Name="Description" Type="String" />
<asp:parameter Name="Client" Type="String" />
<asp:parameter Name="FileID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
</SelectParameters>
<InsertParameters>
<asp:parameter Name="ClientCode" Type="String" />
<asp:parameter Name="Description" Type="String" />
<asp:parameter Name="Client" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<br />
</asp:Content>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top