.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> ASP.NET >> Post New Resource Bookmark and Share   

 Subscribe to Articles

All in one grid view in easy way

Posted By:Gowthammanju       Posted Date: June 15, 2011    Points: 200    Category: ASP.NET    URL: http://www.dotnetspark.com  

This article explains you about the selection, updation and deletion of row which take place inside the grid view
 

 

Hi,

This article explains you about the selection, updation and deletion of row which take place inside the grid view

Techniques:

1)      Stored procedures

2)      Asp.net with c#

These are the easy way to perform the every operation inside the grid view.

Just follow the steps below steps u will achieve it finally

Just open sql server and click on the new query tab and place the below coding as follows

1)      Creation of sql database:

a)      Create database as

    use master
go
create database dbgrid
go

b)      Create table as

      use dbgrid
go
create table tbl_Student(Stud_ID varchar(10) notnull,Stud_Name varchar(20) null,Stud_Addr varchar(100) null, primary key(Stud_ID))
go


//insert values as this or by normal insertion

insert into tbl_Student values('ss1','xxx','xxxxxxxxx')
go

c)       Create procedure for select command as

     set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

CREATE PROC [dbo].[sp_Select]
AS
SELECT * FROM tbl_Student

d)      Create procedure for update command as

   set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

CREATE PROC [dbo].[sp_Update]
@Stud_ID VARCHAR(20),
@Stud_Name Varchar(50),
@Stud_Addr VARCHAR(500)
AS
UPDATE tbl_Student SET Stud_Name=@Stud_Name,Stud_Addr=@Stud_Addr WHERE 

Stud_ID=@Stud_ID

e)      Create procedure for delete command as

   set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

CREATE PROC [dbo].[sp_Delete]
@Stud_ID VARCHAR(20)
AS
DELETE FROM tbl_Student WHERE Stud_ID=@Stud_ID

Note:

1)       For Stored procedures select programmatically tab in the select stored procedures and right click and choose new stored procedures.

2)      Delete all the template copy and paste the above code

 

2) Coding for aspx page as

        a) Open a new website and name as you like

        b) Select the Grid view and place it on your pages

        c) Alter the grid view properties as below screen shots

        

         d) Choose the data sources normally to grid view

        e) At between steps follow the below screen shots


      

Finally hit f5 and run the program .

U will get output as below

Hence u found the way

 

Try it.!


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend