•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 427,460 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,595 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 3600 | Replies: 1
![]() |
•
•
Join Date: Sep 2006
Posts: 17
Reputation:
Rep Power: 3
Solved Threads: 0
Hello Everybody,
I want to know that how we can delete the record from the datagrid only, that data should not be deleted from the database.
i.e., It should not be seen in webpage,but it should remain in the database.
Please help me out soon.My existing code is:
I want to know that how we can delete the record from the datagrid only, that data should not be deleted from the database.
i.e., It should not be seen in webpage,but it should remain in the database.
Please help me out soon.My existing code is:
asp.net Syntax (Toggle Plain Text)
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="ShowJobs.aspx.vb" Inherits="COMPANY.ShowJobs"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>ShowJobs</title> <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 336px; POSITION: absolute; TOP: 184px" runat="server" GridLines="both" AutoGenerateColumns="False" CellSpacing="3" CellPadding="3"> <Columns> <asp:HyperLinkColumn NavigateUrl=".\UploadResume.aspx" DataTextField="JobHeading" HeaderText="Job Description"></asp:HyperLinkColumn> <asp:BoundColumn HeaderText="Area" DataField="JobArea"> </asp:BoundColumn> <asp:BoundColumn HeaderText="Location" DataField="Reqlocation"> </asp:BoundColumn> <asp:BoundColumn HeaderText="Experience" DataField="Experience"> </asp:BoundColumn> </Columns> </asp:datagrid></form> </body> </HTML>
vb.net Syntax (Toggle Plain Text)
Imports System.Data Imports System.Data.SqlClient Public Class ShowJobs Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here If Not IsPostBack Then Dim conn As SqlConnection Dim cmd As SqlDataAdapter Dim ds As New DataSet conn = New SqlConnection("Server=localhost;UID=sa;PWD=payal;database=onlinejob") cmd = New SqlDataAdapter("Select JobHeading,JobArea,Reqlocation,Experience from Recruitment_Mast,Recruitment_Trans where Recruitment_Mast.Recruitment_id = Recruitment_Trans.Recruitment_id", conn) cmd.Fill(ds, "Recruitment_Mast") DataGrid1.DataSource = ds.Tables("Recruitment_Mast").DefaultView DataGrid1.DataBind() End If End Sub End Class
•
•
Join Date: Mar 2006
Posts: 84
Reputation:
Rep Power: 3
Solved Threads: 1
man
i think to do that, you should after retrieving data from db, copy ur datasource to a session and then to datagrid.
then man if u want to delete from the datagrid only, you should delete from the session and rebind the datagrid to the session,
in this way, u didnt delete anything from db.
try it and tell us.
sam
i think to do that, you should after retrieving data from db, copy ur datasource to a session and then to datagrid.
then man if u want to delete from the datagrid only, you should delete from the session and rebind the datagrid to the session,
in this way, u didnt delete anything from db.
try it and tell us.
sam
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
.net .net framework 3.0 access ajax asp avatar backup breach code combo custom daniweb data data protection database design developer development dom dropdownlist feed government hacker ibm medicine microsoft module msdn net news normalization office reader reuse security server skin software sql survey theme vista weather web windows workflow xml xoap
- Inserting a new Access Database Record (VB.NET)
- delete a record and update the dataset (VB.NET)
- Connecting to a SQL Server Database using VB (VB.NET)
- datagrid delete function not auto update (ASP.NET)
- How do you do a simple POS in VB .net (VB.NET)
- need to update each records after record deleted (PHP)
Other Threads in the ASP.NET Forum
- Previous Thread: Datalist navigation
- Next Thread: Creating rss feeds


Linear Mode