Asp.net GridView Control - asp.net

I want to display the grid view like this -(fig 1)
Sr.no Class ----Division------ Total
A B C
-----------------------------------
1. 1st 10 20 30 60
2. 2nd 20 10 40 70
-----------------------------------
Total 30 30 70 130
values shown are total_no_students in Division A,B,C..
and from table i get data like this-(fig-2)
Class A B C
1st 10 20 30
2nd 20 10 40
i created the gridview..but if i directly bind the data i get same as fig-2
how should i customize gridview so that it displays the data as fig-1
Apart from gridview if there is any other control that i can use please do suggest me
thank you

The bottom row will require a GridView footer.
Footer Example
For the column total the following example will solve your problem (check Rahul's answer)
Row Total Example

Related

Filter columns based on radio button selection in Shiny R

Hi I've been working on a small project on English premier league. I want to create a reactive table based on radio button selection. My sample table is of the form (data is fictional),
Team G_Played H_goals A_goals H_wins A_wins H_loss A_loss
Arsenal 200 120 87 35 20 45 30
Aston Villa 200 118 74 26 14 98 75
Chelsea 200 147 98 48 30 25 28
Bolton 200 108 84 26 14 57 60
If I select "Home" on my radio button, I want records only from Team, G_played, H_goals, H_wins, H_loss. Similarly if I select "Away" I should be able to get Team, G_played, A_goals, A_wins, A_loss.
I've tried the solution from this example, R shiny radio button. But I don't know how to call multiple columns for given radio button selection.
Can someone please suggest a code or suggest what I can start with.
Build an if condition to transform your dataset. You can make this in a reactive function like it is recommanded to do in a shiny app, or directly in your output function.
if(input$radiobutton == 'Home'){ df <- df %>% select(G_played, H_goals, ....) }
Same if 'Away'

How to calculate mean and sample vector containing strings

I need to calculate the mean of this jar variable that contains both red and blue marbles. so I created two objects red and blue, 50 each, created a vector and inserted it into a object called Jar. So my jar contains 50 blue and 50 red.
I have to sample 10 marbles, determine how many are red and then calculate the percentage. For the sample, I used the following code:
sample(length(jar), 10, replace = TRUE)
[1] 43 48 77 98 34 21 29 64 95 54
I am not sure if I am using the right code. And second, how does it show which one is red and which one is blue? Sorry I am new to R and stats. Any help is appreciated.

Looping within a loop in R

I'm trying to build quite a complex loop in R.
I have a set of data set as an object called p_int (p_int is peak intensity).
For this example the structure of p_int i.e. str(p_int) is:
num [1:1599]
The size of p_int can vary i.e. [1:688], [1:1200] etc.
What I'm trying to do with p_int is to construct a complex loop to extract the monoisotopic peaks, these are peaks with certain characteristics which will be extracted into a second object: mono_iso:
search for the first eight sets of data results in p_int. Of these eight, find the set of data with the greatest score (this score also needs to be above 50).
Once this result has been found, record it into mono_iso.
The loop will then fix on to this position of where this result is located within the large dataset. From this position it will then skip the next result along the dataset before doing the same for the next set of 8 results.
So something similar to this:
16 Results: 100 120 90 66 220 90 70 30 70 100 54 85 310 200 33 41
** So, to begin with, the loop would take the first 8 results:
100 120 90 66 220 90 70 30
**It would then decide which peak is the greatest:
220
**It would determine whether 220 was greater than 50
IF YES: It would record 220 into "mono_iso"
IF NO: It would move on to the next set of 8 results
**220 is greater than 50... so records into mono_iso
The loop would then place it's position at 220 it would then skip the "90" and begin the same thing again for the next set of 8 results beginning at the next data result in line: in this case at the 70:
70 30 70 100 54 85 310 200
It would then record the "310" value (highest value) and do the same thing again etc etc until the end of the set of data.
Hope this makes perfect sense. If anyone could possibly help me out into making such a loop work with R-script, I'd very much appreciate it.
Use this:
mono_iso <- aggregate(p_int, by=list(group=((seq_along(p_int)-1)%/%8)+1), function(x)ifelse(max(x)>50,max(x),NA))$x
This will put NA for groups such that max(...)<=50. If you want to filter those out, use this:
mono_iso <- mono_iso[!is.na(mono_iso)]

ASP.NET - Data Grid and Drop Down list

I am working on a web page that has a data grid and have a need to do
the following:
Have a column that is a drop down when the grid loads (no need to click edit)
This column is bound to a column from the data query (everything up
to this point works fine)
I know need to add more values to this drop down from another
dataset (so the user can change the value if required)
These values come from a query to another table in the database. The
values will be same for all the rows in the table, these values are
based on a master key for the complete webpage.
As an example:
table 1 has:
Mangoes $12
Apricots $13
Peaches $14
This is on the grid.
The other table has:
Prices
12
13
14
15
16
I want these values from the prices table to appear in the drop down
for table 1 in the data grid, with the current values as the selected
item.
Any ideas will help. Thanks for the help.
As far as I know,
U should better change ur table design.
If ur fruit table is concern with price id, then u can easily select the item from dropdown with current value in fruit table.
Fruit
PriceId
PriceId
Price
------------------------ --------------------
Mangoes
1
<--------------------->
1
12
Apricots
2
<--------------------->
2
13
Peaches
3
<--------------------->
3
14
then it is easier to list all price in dropdown list
and also easier to choose selected price based on PriceId from Fruit table.
Sound like little confuse? let me know, if anything u want?
Hope it works!

how to repeat the direction in listview control

i using datalist control where i am displaying images under it. that is( 6 columns * 5 rows)
for thati have property repeat direction is "horiztonal" .
like the above design i need perform in listview Control (i.e )
display like this( here 1,2 are data after 6 data is displayed 7th data start from second row)
1 2 3 4 5 6
7 8 10 11 12 13
any help would be great thank you
A ListView is better suited for this.
EDIT
You can insert basic HTML in the ItemTemplate and use the binding syntax described here:
https://web.archive.org/web/20211020150712/https://www.4guysfromrolla.com/articles/010208-1.aspx
Try RepeatColumns to specify the item count in a row like this :
DataList1.RepeatColumns = 6;
DataList1.RepeatDirection = RepeatDirection.Horizontal;

Resources