views:

35

answers:

2

I am using a SqlDataSource that returns a table of raw counts. One of these columns is the "total". I would like to give the user the ability to show these counts as a percentage of total using some sort of toggle switch.

My initial idea was to have two CSS classes and somehow put <span class="raw"> and <span class="perc"> around each value and then make one or the other invisible using Javascript. I'm not sure how I would go about doing this though.

I would appreciate any suggestions as to how I could approach this.

A: 

Have you tried changing the column visibility based on a button press event?

ShaunLMason
I don't have the percentages in a column. All I have right now is raw counts.
Joe Philllips
Sorry, I misunderstood your question.The first step you need to take, IMO, is to calculate the percentage information and include it in the data source. Once you bind this to the grid, you can do as I suggested initially.
ShaunLMason
I would rather not modify the output of the stored procedure if I can help it.
Joe Philllips
+2  A: 

My suggestion would be to add a handler to the RowDataBound event of the GridView control and change what the column displays based on the toggle value.

ichiban