This will help you to nest grdiviews inside ASP.NET. There may be many ways to do this, but this is my way( May not be the best, let me know if you have any other ).
1. First drop a gridview in to the page, also set its DataKeyNames to your primary key
2. Add a new template column to this gridview.
3. Place another gridview inside this template column.
the code for the termplate column may look like this
’ AutoGenerateColumns=”False” CellPadding=”4″ ForeColor=”Black” GridLines=”Vertical” BackColor=”White” BorderColor=”#DEDFDE” BorderStyle=”None” BorderWidth=”1px”>
This child gridview has to show the content based on the primary of the row thats binded to main gridview.
Here in my case “pId” is the primary key. The nesting happens here
’
what I have done is that, I have called function “GetTrasnl” and passed the primary key to that function. This function will return a datatable. So each time a row is bound to the main gridview, the child gridview is also bound with the corresponding values.
The functions is like this
Public Function GetTrasnl(ByVal prgId As Integer) As DataTable
……………………………….
End Function
Please post your comments if you have any
http://programmers.wordpress.com/2006/07/26/nested-gridview-to-show-masterdetails-relationship-in-aspnet-20/
1. First drop a gridview in to the page, also set its DataKeyNames to your primary key
2. Add a new template column to this gridview.
3. Place another gridview inside this template column.
the code for the termplate column may look like this
This child gridview has to show the content based on the primary of the row thats binded to main gridview.
Here in my case “pId” is the primary key. The nesting happens here
what I have done is that, I have called function “GetTrasnl” and passed the primary key to that function. This function will return a datatable. So each time a row is bound to the main gridview, the child gridview is also bound with the corresponding values.
The functions is like this
Public Function GetTrasnl(ByVal prgId As Integer) As DataTable
……………………………….
End Function
Please post your comments if you have any
http://programmers.wordpress.com/2006/07/26/nested-gridview-to-show-masterdetails-relationship-in-aspnet-20/
Nice......
ReplyDeleteI simply wanted to thank you so much again. I am not sure the things that I might have gone through without the type of hints revealed by you regarding that situation.
ReplyDeleteoracle training in chennai
oracle training in velachery
oracle dba training in chennai
oracle dba training in velachery
ccna training in chennai
ccna training in velachery
seo training in chennai
seo training in velachery