Showing posts with label grid. Show all posts
Showing posts with label grid. Show all posts

Thursday, March 22, 2012

The grid as a reportwriter

Hi,

I've planned an app where there's a lot of columns in a table and because of
that I'd like to split up the columns when presenting them in a datagrid.

I'll give you an example. It's always one year between every row

row _type descr amount remAmount rate interest accruedInterest
1 1 Claim1 100000 100000 10 10000 10000
2 1 Claim2 100000 200000 10 20000 30000
row _type descr amount remAmount myRemPart taxRemPart accrInt myAccPart
3 2 Paym1 -200000 30000 119000 51000 0
21000
row _type descr amount remAmount rate interest accruedInt
4 1 Claim3 100000 130000 10 13000 .....

As you can see both claims and payments are in the same table (grid) with
different headers. And in row 3 you can see that total amount is first taken
from accruedinterest and then from remainderamount columns.

I'd like to have both claims( demands ) and payments to show up in the same
grid, so to speak.

Any ideas?

TIA

Kenneth PHi Kenneth,

You can apply crystal reports to create and show
complicated report.

Elton Wang
elton_wang@.hotmail.com

>--Original Message--
>Hi,
>I've planned an app where there's a lot of columns in a
table and because of
>that I'd like to split up the columns when presenting
them in a datagrid.
>I'll give you an example. It's always one year between
every row
>row _type descr amount remAmount rate interest
accruedInterest
> 1 1 Claim1 100000 100000 10 10000
10000
> 2 1 Claim2 100000 200000 10 20000
30000
>row _type descr amount remAmount myRemPart
taxRemPart accrInt myAccPart
> 3 2 Paym1 -200000 30000 119000
51000 0
> 21000
>row _type descr amount remAmount rate interest
accruedInt
> 4 1 Claim3 100000 130000 10
13000 .....
>As you can see both claims and payments are in the same
table (grid) with
>different headers. And in row 3 you can see that total
amount is first taken
>from accruedinterest and then from remainderamount
columns.
>I'd like to have both claims( demands ) and payments to
show up in the same
>grid, so to speak.
>Any ideas?
>TIA
>Kenneth P
>.
Hi Elton,

I know about reports and CR.

They don't apply here in the first place. I need a report to the screen,
most preferable in a grid, perhaps as a drill down gridreport. When that's
ok, I'll go for the report on paper.

Any ideas?

Kenneth P

"Elton Wang" wrote:

> Hi Kenneth,
> You can apply crystal reports to create and show
> complicated report.
> Elton Wang
> elton_wang@.hotmail.com
> >--Original Message--
> >Hi,
> >I've planned an app where there's a lot of columns in a
> table and because of
> >that I'd like to split up the columns when presenting
> them in a datagrid.
> >I'll give you an example. It's always one year between
> every row
> >row _type descr amount remAmount rate interest
> accruedInterest
> > 1 1 Claim1 100000 100000 10 10000
> 10000
> > 2 1 Claim2 100000 200000 10 20000
> 30000
> >row _type descr amount remAmount myRemPart
> taxRemPart accrInt myAccPart
> > 3 2 Paym1 -200000 30000 119000
> 51000 0
> > 21000
> >row _type descr amount remAmount rate interest
> accruedInt
> > 4 1 Claim3 100000 130000 10
> 13000 .....
> >As you can see both claims and payments are in the same
> table (grid) with
> >different headers. And in row 3 you can see that total
> amount is first taken
> >from accruedinterest and then from remainderamount
> columns.
> >I'd like to have both claims( demands ) and payments to
> show up in the same
> >grid, so to speak.
> >Any ideas?
> >TIA
> >Kenneth P
> >.
I'm not really clear on exactly what you want to do but here's a couple of
ideas...

First, look at how an ASP.NET DataGrid is actually rendered. It's nothing
more than an HTML table where each <TR> contains data from one row in the
DataGrid's data source and each individual item in that row is rendered as a
<TD> within a given <TR>. You can dress that up quite a bit by using item
templates but that rendering scheme still locks you into a set of <TR> tags,
one for each row of data.

DataLists and DataRepeaters both provide more flexibility. Yet, things work
very
similarly in the sense that they are multiple-value databound controls...so
whatever is rendered is rendered n times, depending on how many row of data
are present in the data source.

The example you gave suggests a Data List. In a DataList, you can put item
values into separate <TR>s, even when they are in the same row of data. This
is because the <TR> and <TD> tags are explicitly coded in the .aspx file;
they are not impied as in the case of a DataGrid. Things are, by default,
still rendered in a <TABLE>.

A DataRepeater is even more chaotic. No tabluar form is implied, it just
pretty much just spits out the .aspx code as is, except that repitition
is still impled and data binding still occurs. Your mention of a drilldown
grid
makes me think you might need a repeater that has one or more of user
controls embedded in it. As the user clicks various options within the user
controls, the display is changed - possibly by client-side scripts that open
new windows, make things visible or not visible...or whatever you need it to
do.

MSDN has more information but honestly, you may want to look elsewhere. I
never found the MSDN info. on DataGrids, DataLiasts, and DataRepeaters to be
especially helpful.

Good Luck.

"Kenneth P" wrote:

> Hi Elton,
> I know about reports and CR.
> They don't apply here in the first place. I need a report to the screen,
> most preferable in a grid, perhaps as a drill down gridreport. When that's
> ok, I'll go for the report on paper.
> Any ideas?
> Kenneth P
> "Elton Wang" wrote:
> > Hi Kenneth,
> > You can apply crystal reports to create and show
> > complicated report.
> > Elton Wang
> > elton_wang@.hotmail.com
> > >--Original Message--
> > >Hi,
> > > >I've planned an app where there's a lot of columns in a
> > table and because of
> > >that I'd like to split up the columns when presenting
> > them in a datagrid.
> > > >I'll give you an example. It's always one year between
> > every row
> > > >row _type descr amount remAmount rate interest
> > accruedInterest
> > > 1 1 Claim1 100000 100000 10 10000
> > 10000
> > > 2 1 Claim2 100000 200000 10 20000
> > 30000
> > >row _type descr amount remAmount myRemPart
> > taxRemPart accrInt myAccPart
> > > 3 2 Paym1 -200000 30000 119000
> > 51000 0
> > > 21000
> > >row _type descr amount remAmount rate interest
> > accruedInt
> > > 4 1 Claim3 100000 130000 10
> > 13000 .....
> > > >As you can see both claims and payments are in the same
> > table (grid) with
> > >different headers. And in row 3 you can see that total
> > amount is first taken
> > >from accruedinterest and then from remainderamount
> > columns.
> > > >I'd like to have both claims( demands ) and payments to
> > show up in the same
> > >grid, so to speak.
> > > >Any ideas?
> > > >TIA
> > > >Kenneth P
> > >.
>

The grid as a reportwriter

Hi Kenneth,
You can apply crystal reports to create and show
complicated report.
Elton Wang
elton_wang@dotnet.itags.org.hotmail.com

>--Original Message--
>Hi,
>I've planned an app where there's a lot of columns in a
table and because of
>that I'd like to split up the columns when presenting
them in a datagrid.
>I'll give you an example. It's always one year between
every row
>row _type descr amount remAmount rate interest
accruedInterest
> 1 1 Claim1 100000 100000 10 10000
10000
> 2 1 Claim2 100000 200000 10 20000
30000
>row _type descr amount remAmount myRemPart
taxRemPart accrInt myAccPart
> 3 2 Paym1 -200000 30000 119000
51000 0
> 21000
>row _type descr amount remAmount rate interest
accruedInt
> 4 1 Claim3 100000 130000 10
13000 .....
>As you can see both claims and payments are in the same
table (grid) with
>different headers. And in row 3 you can see that total
amount is first taken
>from accruedinterest and then from remainderamount
columns.
>I'd like to have both claims( demands ) and payments to
show up in the same
>grid, so to speak.
>Any ideas?
>TIA
>Kenneth P
>.
>Hi Elton,
I know about reports and CR.
They don't apply here in the first place. I need a report to the screen,
most preferable in a grid, perhaps as a drill down gridreport. When that's
ok, I'll go for the report on paper.
Any ideas?
Kenneth P
"Elton Wang" wrote:

> Hi Kenneth,
> You can apply crystal reports to create and show
> complicated report.
> Elton Wang
> elton_wang@.hotmail.com
>
> table and because of
> them in a datagrid.
> every row
> accruedInterest
> 10000
> 30000
> taxRemPart accrInt myAccPart
> 51000 0
> accruedInt
> 13000 .....
> table (grid) with
> amount is first taken
> columns.
> show up in the same
>
I'm not really clear on exactly what you want to do but here's a couple of
ideas...
First, look at how an ASP.NET DataGrid is actually rendered. It's nothing
more than an HTML table where each <TR> contains data from one row in the
DataGrid's data source and each individual item in that row is rendered as a
<TD> within a given <TR>. You can dress that up quite a bit by using item
templates but that rendering scheme still locks you into a set of <TR> tags,
one for each row of data.
DataLists and DataRepeaters both provide more flexibility. Yet, things work
very
similarly in the sense that they are multiple-value databound controls...so
whatever is rendered is rendered n times, depending on how many row of data
are present in the data source.
The example you gave suggests a Data List. In a DataList, you can put item
values into separate <TR>s, even when they are in the same row of data. Thi
s
is because the <TR> and <TD> tags are explicitly coded in the .aspx file;
they are not impied as in the case of a DataGrid. Things are, by default,
still rendered in a <TABLE>.
A DataRepeater is even more chaotic. No tabluar form is implied, it just
pretty much just spits out the .aspx code as is, except that repitition
is still impled and data binding still occurs. Your mention of a drilldown
grid
makes me think you might need a repeater that has one or more of user
controls embedded in it. As the user clicks various options within the user
controls, the display is changed - possibly by client-side scripts that open
new windows, make things visible or not visible...or whatever you need it to
do.
MSDN has more information but honestly, you may want to look elsewhere. I
never found the MSDN info. on DataGrids, DataLiasts, and DataRepeaters to be
especially helpful.
Good Luck.
"Kenneth P" wrote:
> Hi Elton,
> I know about reports and CR.
> They don't apply here in the first place. I need a report to the screen,
> most preferable in a grid, perhaps as a drill down gridreport. When that's
> ok, I'll go for the report on paper.
> Any ideas?
> Kenneth P
> "Elton Wang" wrote:
>

Tuesday, March 13, 2012

The IListSource does not contain any data sources

After assigning a datasource to a grid, upon databind I get:

The IListSource does not contain any data sources

What in the world does that mean?IListSource is an interface that provides functionality to an object to return a list that can be bound to a datasource. A dataset for example implements this interface.

Did you databind your datagrid to a dataset obtained form a query to a database using ADO.NET ? Can you provide a snippet of code showing your commands to hook up the datasource and databind?
It was weird - I did the whole section again, code and controls and it worked. Thanks anyway!
I'm having this problem (The IListSource does not contain any data sources) and I don't know what could be wrong. If I test my SQL Query in SQL Analyzer, it does work fine. Now, when I run the query through my ASP.NET page, it sometimes work and others not, even though is the same query.

Dim connectionString As String = "Server='ServerName';User ID=username; Password=mypassword;database='databasename'"

Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)

'Set max num of rows
Dim strSQLMaxRecords as string
If intMaxRecords > 0 Then
strSQLMaxRecords = " TOP " & CStr(intMaxRecords) & " "
Else
strSQLMaxRecords = ""
End If

Dim queryString As String = _
"SELECT " & strSQLMaxRecords & _
" * " & _
" FROM dwidx.dbo.fsc_followup as TFUP" & _
" ,dwidx.dbo.patient_fsc_list as TPFL " & _
" ,dwidx.dbo.patient as TPAT " & _
" WHERE " & _
" (TPFL.id = TFUP.id)" & _
" AND (TFUP.id = TPAT.id)" & _
" AND (TPFL.fsc = TFUP.fsc)" & _
" AND (TPAT.oth_num IS NOT NULL)" & _
" AND (TPAT.del_dt IS NULL)" & _
" AND (TPAT.deact_dt IS NULL)" & _
" AND (TPAT.deceased_indicator IS NULL " & _
" OR TPAT.deceased_indicator = 'N') "

...
...
queryString = queryString & " " & m_strSql

Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection

'Add Parameters

Call AddSQLParameter("@.FSCNUM",intFscn,dbCommand)

'End Add Parameters

Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet

Try
lblQuery.Text = queryString
dataAdapter.Fill(dataSet)

'Catch SQLex As System.Data.SqlClient.SqlException
' lblFeedback.Text = "SQL Error: " & SQLex.Message & SQLex.Number & "<br />" & queryString
Catch ex as Exception
lblFeedback.Text = "Fatal error: " & ex.Message
End try

return dataSet

In the OnClick of my button...

DataGrid1.DataSource = GetFSCRecords(intFSCN _
, txtINNM.Text _
, txtINA1.Text _
, txtINA2.Text _
, txtINCTY.Text _
, txtINST.Text _
, txtINZIP.Text _
, txtEFF_DT.Text _
, txtEXP_DT.Text _
, intMaxRecords)

DataGrid1.DataBind() <<<< The error occurs here

Hi !

You can check thedataSet.Tables.Cout > 0 ThenreturndataSetelse return null;

I thinks the DataSet return have Count = 0 .Smile