In the code below I’m providing a simple example of the statement that I used to clean up a temporary table called #my Test: -- Delete the IDs of duplicated records but leave out the first duplicate record DELETE FROM #my Test WHERE ID IN( SELECT Id FROM #my Test tbl Main WHERE tbl Main. Within the main select statement, the second nested query restricts the results of returned IDs to only show duplicate records.Id NOT IN ( SELECT TOP 1 tbl FROM #my Test tbl Nested WHERE tbl Nested. Then the first nested query ties everything together by removing from the list of duplicates the first record of each duplicate.The order of these nested queries is not really important. In the end this query allows us to remove duplicate records, but to keep all information from the first of each of the duplicate records, exactly what we want!
May be you may think why am I using link buttons as we are provided with some command field buttons by Grid View.Suppose if we are trying to hide primary key of our table, there is actually no need to hide. In the above Snippet you are seeing a label in Item Template that means whenever we are showing Grid View to the user Label will be visible to the user. We will use Template Field, whenever we want to define some custom control in the data bound controls like Grid View, Data Grid or Data Repeater.The basic idea behind this article is to workout with ASP. Though I had faced lot of difficulties in this but still I can say it is far better then ASP. Grid View control gives you Edit, Update, Delete, Sorting, Selection and Paging facility built in.Net 2.0's Grid View Control than the Data Grid Control in ASP. As I had worked with Data Grid Control so I knew how difficult to work with it in same project. The main difference between Data Grid and Grid View control is that the first one has central event handling which means any event raised by control inside the Data Grid's template column will be handled by Item Command event of datagrid.It is up to the user to take advantage of this feature. Here I have one Master Table which is bind to the Master Grid using Master Data Souce and one Child Table which is bind to Gridview inside template column of Mastergird.To bind the Child Grid to Child Data Source we have to use Row Data Bound event which is called every time when each row from database is bind to the Grid View's row.Above code will be used when user hits on Master Grid Edit button.So In the Template Column child grid with edit and delete option will get visible.This article is very useful to all the users who are working with ASP. Here I am explaining how to work with Grid View control in ASP.Net 2.0 which is very easier then Data Grid Control in ASP. I will also explain what are the differences in Grid View and Datagrid Control in ASP. I want to explain how to work with template column having datagrid inside. Net 2.0 Grid View control is too good, easy and very user friendly.