Main Page | Report this Page
.NET DotNet Forum Index  »  ASP.NET Forum  »  Clone a gridview's template styles...
Page 1 of 1    

Clone a gridview's template styles...

Author Message
deostroll...
Posted: Thu Oct 29, 2009 2:26 am
Guest
I was trying to email the gridview's content, but while trying to render the
control's html using the textwriter I got an error. The workaround I found to
this was instantiate another (2nd) gridview, and bind that separately. I
don't need to start explicit database connections to fetch the data; I can
use the 1st gridview as my source (iterating thru its rows and populating a
datatable)...Now is there a possibility where I can clone its look and feel
so that when my 2nd gridview renders it renders will the styles I see off my
web page?

--deostroll
 
Alexey Smirnov...
Posted: Thu Oct 29, 2009 2:26 am
Guest
On Oct 29, 9:26 am, deostroll <deostr... at (no spam) discussions.microsoft.com>
wrote:
Quote:
I was trying to email the gridview's content, but while trying to render the
control's html using the textwriter I got an error. The workaround I found to
this was instantiate another (2nd) gridview, and bind that separately. I
don't need to start explicit database connections to fetch the data; I can
use the 1st gridview as my source (iterating thru its rows and populating a
datatable)...Now is there a possibility where I can clone its look and feel
so that when my 2nd gridview renders it renders will the styles I see off my
web page?

--deostroll

I think the easiest way is to use css and apply the same cssclass to
both grids

GridView2.CssClass = GridView1.CssClass

otherwise you would probably need to set each property

GridView2.GridLines = GridView1.GridLines
GridView2.BorderStyle = GridView1.GridLines
GridView2.BorderColor = GridView1.BorderStyle
 
deostroll...
Posted: Thu Oct 29, 2009 5:52 am
Guest
Quote:
GridView2.CssClass = GridView1.CssClass

We don't assign CssClass to anything initially. Moreover for GridView1 we do
not manually code for looks. We use the Auto Format feature from the
gridview's design-time menu...
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Sat Dec 12, 2009 2:15 am