i am using a gridview in Asp.net to show data in a table
i want to show data like this -
Sr.No ClassStandard Division Total
---------------------------------------------
A B
---------------------------------------------
1. First 10 20 30
2. Second 15 15 30
if i direclty attach the source then the data comes like this-
ClassStandard A B Total
------------------------------------------
First 10 20 30
Second 15 15 30
Here is the code:
if (!IsPostBack)
{
try
{
IApplicationContext ctx = ContextRegistry.GetContext();
IServices reg = (IServices)ctx.GetObject("Services");
DataSet ds = reg.getInstituteStatusByDistrict();
int Count = ds.Tables[0].Rows.Count;
gridviewdistrictReport.DataSource = ds;
gridviewdistrictReport.DataBind();
}
}
Note:I am using Spring .net for database connectivity
inside Aspx file
<asp:GridView ID="gridviewdistrictReport" runat="server">
how should i display the upper row with division spanning to both columns..
Please help me..
These links should help you add multiple headers to a gridview
Example 1
Example 2
Related
It looks like things are going wrong on line 9 for me. Here I wish to push a new copy of the TagsTable into a dictionary. I'm aware that once a namedtuple field is recorded, it can not be changed. However, results baffle me as it looks like the values do change - when this code exits all entries of mp3_tags[ any of the three dictionary keys ].date are set to the last date of "1999_03_21"
So, two questions:
Is there a way to get a new TagsTable pushed into the dictionary ?
Why doesnt the code fail and not allow the second (and even third) date to be written to the TagsTable.date field (since it seems to be references to the same namedtuple) ? I thought you could not write a second value ?
from collections import namedtuple
2 TagsTable = namedtuple('TagsTable',['title','date','subtitle','artist','summary','length','duration','pub_date'])
3 mp3files = ['42-001.mp3','42-002.mp3','42-003.mp3']
4 dates = ['1999_01_07', '1999_02_14', '1999_03_21']
5
6 mp3_tags = {}
7
8 for mp3file in mp3files:
9 mp3_tags[mp3file] = TagsTable
10
11 for mp3file,date_string in zip(mp3files,dates):
12 mp3_tags[mp3file].date = date_string
13
14 for mp3file in mp3files:
15 print( mp3_tags[mp3file].date )
looks like this is the fix I was looking for:
from collections import namedtuple
mp3files = ['42-001.mp3','42-002.mp3','42-003.mp3']
dates = ['1999_01_07', '1999_02_14', '1999_03_21']
mp3_tags = {}
for mp3file in mp3files:
mp3_tags[mp3file] = namedtuple('TagsTable',['title','date','subtitle','artist','summary','length','duration','pub_date'])
for mp3file,date_string in zip(mp3files,dates):
mp3_tags[mp3file].date = date_string
for mp3file in mp3files:
print( mp3_tags[mp3file].date )
I have a report which has two groups. Group B always has only 2 values. I want to get the difference of total values of Item Type 01 and Item Type 02 to the Group B footer (Tot type01 - tot type02).
Help me to achieve this. I tried few formulas but non of them works for me
Month01 Month2
Group A
Group B
Item Type 01
ab 10 10
ac 20 30
ad 30 30
**Total** 60 70
Item Type 02
ab 10 20
ac 10 15
ad 20 5
**Total** 40 30
**Difference 20 40**
I want something like this
NumberVar sum01 := 0;
Numbervar sum02 := 0;
GroupName ({DataTable1.IncomeType}) = Type 01
Then
sum01 := Sum ({DataTable1.Month01}, {DataTable1.IncomeType})
if
GroupName ({DataTable1.IncomeType}) = Type 02
Then
sum02 := Sum ({DataTable1.Month01}, {DataTable1.IncomeType})
sum01 - sum02
I know this isn't correct. I used it to explain my question for you as much as possible.
Really appreciate your guidence
You can do this using arrays..
Take 2 arrays and store values for Month1 and Month2 and in group footer retrive and add those.
Create a formula #Month1Array and place in Item Type group footer after Month1 summary
Shared Numbervar array x;
x:=x+sum(Month1,Item GRoup);
1;
Create a formula #Month2Array and place in Item Type group footer after Month2 summary
Shared Numbervar array y;
y:=y+sum(Month2,Item GRoup);
1;
Now in the footer where you want to see the difference write below formula for
Create a formula #Month1
Shared Numbervar array x;
x[1]-x[2]
Create a formula #Month2
Shared Numbervar array y;
y[1]-y[2]
I need to print a test with 3 parts to a Word document. Part 1-question 1 to question 56. Part2-question 57 to question 66; Part3-question 67-question 100. Part 1 and Part 2 questions are required to be on two columns on paper. For example, questions appear on the first page are following.
1. 7.
2. 8.
3. 9.
4. 10.
5. 11.
6. 12.
I have created code behind and the report PT.rdlc. All questions are showed up nicely on the Word doc except some of the question numbers are dropped off. I can't figure out why. Here are some my codes:
int TRow = Dt.Rows.Count; //TRow = number of rows in Part1 or Part2
for (int RowCount = 0; RowCount < TRow; RowCount++)
{
TDt.Rows.Add(1);
if (RowCount < TRow)
TDt.Rows[TDt.Rows.Count - 1]["ID"] = Dt.Rows[RowCount]["qnum"]; //q1
if RowCount + 6 < TRow
TDt.Rows[TDt.Rows.Count - 1]["TID"] = Dt.Rows[RowCount + 6]["qnum"]; //q7
....
}
I do the same way above for all questions in Part 1 and 2. In the report, I use expressions as following for question numbers.
=iif(Fields!question.Value<>"",Fields!ID.Value & ". ","") and
=iif(Fields!Tquestion.Value<>"",Fields!TID.Value & ". ","")
Can you please help me to identify what is wrong with some question numbers are dropped off? Thank you in advance.
When using autoIt to get Window's Text and the WinGetText matches multiple controls (e.g. with the same Class SciCalc in this case), the WinGetText will concatenate the text of all the controls. How can I get the Text of the n-th (say 3rd 'MR') control?
e.g.
Local $output = WinGetText("[CLASS:SciCalc]", "")
print
output:666666.
MC
MR
MS
M+
7
4
1
0
8
5
2
+/-
9
6
3
.
/
*
-
+
=
Backspace
CE
C
1/x
sqt
%
Something like this
ControlGetText("[CLASS:SciCalc]","","[CLASS:Button; INSTANCE:3]")
Use AutoIt Window Info to find the Advanced mode details on the wanted control.
var d1 = Date.parse(date); // eg, 7th jan
var d2 = Date.today(); // eg, 2nd jan
I want to do:
(d2 - d1).days
which with the above data, should return 5.
Is this possible with datejs?
The optional TimeSpan module includes functionality to easily get various value differences between two date objects.
http://code.google.com/p/datejs/source/browse/trunk/src/time.js
Just include after your main date.js include, or combine.
In the "time.js" file, there's also a TimePeriod class. You might not require, so just crop what you need if weight is an issue.
The following sample demonstrates the full scenario.
Example
var d1 = Date.parse("jan 7"); // eg, 7th jan
var d2 = Date.parse("jan 2"); // eg, 2nd jan
console.log(new TimeSpan(d1 - d2).days); // 5
Hope this helps.