473,396 Members | 1,846 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,396 software developers and data experts.

Gridview Delete?

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.Provider Name %>"
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>

Mar 27 '07 #1
0 1225

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

Similar topics

3
by: | last post by:
Hello, I have created an ASP.NET 2.0 application that utilized a Gridview Control to display and update/delete data. The problem I am having is that the gridview control is displaying the data...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
1
by: Mike P | last post by:
When you use a SqlDataSource to hook up data to a GridView it seems to be to be very inflexible. For example, I want to create my own Delete button with my own code and I also want to create a...
0
by: Steve | last post by:
I have a gridview which uses an objectdatasource for its select and delete. The delete command uses the function below. The delete itself works but the extra logic which requires parameters...
2
by: needin4mation | last post by:
In a GridView, take for example a delete button. When I click the delete button in my GridView the GridView row is deleted and the GridView rebinds and refreshes the records to show accurately. ...
4
by: Wannabe | last post by:
I am using ASP.Net 2.0 and have a gridview on my page. I have everything working except the delete command. The page reloads except the row I am trying to delete is still there. I believe it is...
7
by: =?Utf-8?B?cGF0cmlja2RyZA==?= | last post by:
Hi all! I have a gridview inside a datagrid (nested) for which (gridview) the rowcommand is not raised in order to delete a row from the grid! I also tried OnRowCommand="method", didn't work...
11
by: Ed Dror | last post by:
Hi there, I'm using ASP.NET 2.0 and SQL Server 2005 with VS 2005 Pro. I have a Price page (my website require login) with GridView with the following columns PriceID, Amount, Approved,...
2
by: Michael | last post by:
It seems that a gridview allows us to delete only a single row at a time. How to extend this functionality to select multiple rows and delete all of the selected rows in a single stroke? just like...
4
by: Jonathan Wood | last post by:
Greetings, I have a GridView control. For a couple of reasons, I ended up with a TemplateField to contain my Edit and Delete links, something like this: <asp:TemplateField ShowHeader="False">...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.