Clone a gridview's template styles

D

deostroll

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
 
G

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

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
 
D

deostroll

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top