DataViewManager not filtering with Sort property set.

K

ken busse

The code below is used to bind dataview with a filter and
sort but the full datatable without the sort or filter
being applied is being displayed.
What am I doing wrong below in my code?
Also, how do I see what is the actual dataview in my
debugger?
The table in the DVM is the underlying datatable before
the filter and sort is applied I am assuming because this
is what I am seeing. I don't see a dataview object in the
DVM while debugging.


Private dvm As DataViewManager
Private dv As DataView

Thanks,
Ken

Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If IsPostBack = False Then
MySqlDataAdapter1.Fill(DataSet11)
dvm = New DataViewManager
dvm.DataSet = DataSet11
dvm.DataViewSettings("ROLES").Sort = "RoleName"
dvm.DataViewSettings("ROLES").RowFilter
= "RoleName='Teacher'"
UltraWebGrid1.DataSource = dvm
UltraWebGrid1.DataMember = "ROLES"
UltraWebGrid1.DataBind()
'Storing grid and DataViewManager in session
state.
Session("ultrawebgrid1") = UltraWebGrid1
Session("dvm") = dvm
Else
dvm = Session("dvm")
UltraWebGrid1 = Session("ultrawebgrid1")
UltraWebGrid1.DataBind()
End If
End Sub
 
M

MSFT

Hi Ken,

Will you get correct result if you use a dataview instead?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
K

ken busse

No I don't get the correct results.
I'll speak to UltraWebGrid folks about this.

The documentation is pretty bad here for using a
DataViewManager!
I do get the datatable being filtered by the view as seen
in my debugger but I must use dv=dvm.CreateDataView
(DataSet11.Roles) or create the dv without the dvm.

What is the proper way of getting at the dv?

Also, can I have more than one DataViewSettings object per
table?
There doesn't seem to be much point to the dvm other than
for databinding purposes since I can do what I need just
with a DataView.
 
K

Kevin Yu [MSFT]

Hi Ken,

Based on my understanding, you need to maintain several DataViews of one
table. I think you can achieve this by creating several DataViews, and sort
and filter the DataViews.

You can directly create a DataView from a DataTable and set the sort and
filter property by calling the DataView's constructor: public
DataView(DataTable, string, string, DataViewRowState); When the DataView is
created, you can bind the the DataView to the UltraWebGrid as a data
source. UltraWebGrid1.DataSource = dataView; If you need to maintain more
than one views, just create another DataView.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| Content-Class: urn:content-classes:message
| From: "ken busse" <[email protected]>
| Sender: "ken busse" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: DataViewManager not filtering with Sort property set.
| Date: Mon, 3 Nov 2003 07:38:46 -0800
| Lines: 32
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOiIJGad8pxwb8mSwe15oXTBiMPvw==
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:65217
| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| No I don't get the correct results.
| I'll speak to UltraWebGrid folks about this.
|
| The documentation is pretty bad here for using a
| DataViewManager!
| I do get the datatable being filtered by the view as seen
| in my debugger but I must use dv=dvm.CreateDataView
| (DataSet11.Roles) or create the dv without the dvm.
|
| What is the proper way of getting at the dv?
|
| Also, can I have more than one DataViewSettings object per
| table?
| There doesn't seem to be much point to the dvm other than
| for databinding purposes since I can do what I need just
| with a DataView.
|
| >-----Original Message-----
| >Hi Ken,
| >
| >Will you get correct result if you use a dataview instead?
| >
| >Luke
| >Microsoft Online Support
| >
| >Get Secure! www.microsoft.com/security
| >(This posting is provided "AS IS", with no warranties,
| and confers no
| >rights.)
| >
| >.
| >
|
 
K

ken busse

Can I set the DataSource property of Microsoft's webgrid
to the DataViewManager and have it support a view on a
parent table and a view on its child table while having
the grid display hierarchically?
For example, I would like to have the Students table with
their names for all classes of a teacher (parent table) be
viewed for one class while the StudentsNClasses table
(child table) be viewed for that same class. The
StudentsNClasses table has all of the teacher's classes
too with student information related to a particular class.
 
K

Kevin Yu [MSFT]

Hi Ken,

I'm not quite sure what you need to do. But as far as I know, we can set a
DataViewManager object as the data source of a webgrid.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

--------------------
| Content-Class: urn:content-classes:message
| From: "ken busse" <[email protected]>
| Sender: "ken busse" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: RE: DataViewManager not filtering with Sort property set.
| Date: Tue, 4 Nov 2003 17:57:28 -0800
| Lines: 108
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOjQCpW8Adi0bWqRyWL9+jFhtWWrw==
| Newsgroups: microsoft.public.dotnet.framework.adonet
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:65431
| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Can I set the DataSource property of Microsoft's webgrid
| to the DataViewManager and have it support a view on a
| parent table and a view on its child table while having
| the grid display hierarchically?
| For example, I would like to have the Students table with
| their names for all classes of a teacher (parent table) be
| viewed for one class while the StudentsNClasses table
| (child table) be viewed for that same class. The
| StudentsNClasses table has all of the teacher's classes
| too with student information related to a particular class.
|
| >-----Original Message-----
| >Hi Ken,
| >
| >Based on my understanding, you need to maintain several
| DataViews of one
| >table. I think you can achieve this by creating several
| DataViews, and sort
| >and filter the DataViews.
| >
| >You can directly create a DataView from a DataTable and
| set the sort and
| >filter property by calling the DataView's constructor:
| public
| >DataView(DataTable, string, string, DataViewRowState);
| When the DataView is
| >created, you can bind the the DataView to the
| UltraWebGrid as a data
| >source. UltraWebGrid1.DataSource = dataView; If you need
| to maintain more
| >than one views, just create another DataView.
| >
| >If anything is unclear, please feel free to reply to the
| post.
| >
| >Kevin Yu
| >=======
| >"This posting is provided "AS IS" with no warranties, and
| confers no
| >rights."
| >
| >--------------------
| >| Content-Class: urn:content-classes:message
| >| From: "ken busse" <[email protected]>
| >| Sender: "ken busse"
| <[email protected]>
| >| References: <[email protected]>
| ><[email protected]>
| >| Subject: RE: DataViewManager not filtering with Sort
| property set.
| >| Date: Mon, 3 Nov 2003 07:38:46 -0800
| >| Lines: 32
| >| Message-ID: <[email protected]>
| >| MIME-Version: 1.0
| >| Content-Type: text/plain;
| >| charset="iso-8859-1"
| >| Content-Transfer-Encoding: 7bit
| >| X-Newsreader: Microsoft CDO for Windows 2000
| >| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| >| Thread-Index: AcOiIJGad8pxwb8mSwe15oXTBiMPvw==
| >| Newsgroups: microsoft.public.dotnet.framework.adonet
| >| Path: cpmsftngxa06.phx.gbl
| >| Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.adonet:65217
| >| NNTP-Posting-Host: TK2MSFTNGXA14 10.40.1.166
| >| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| >|
| >| No I don't get the correct results.
| >| I'll speak to UltraWebGrid folks about this.
| >|
| >| The documentation is pretty bad here for using a
| >| DataViewManager!
| >| I do get the datatable being filtered by the view as
| seen
| >| in my debugger but I must use dv=dvm.CreateDataView
| >| (DataSet11.Roles) or create the dv without the dvm.
| >|
| >| What is the proper way of getting at the dv?
| >|
| >| Also, can I have more than one DataViewSettings object
| per
| >| table?
| >| There doesn't seem to be much point to the dvm other
| than
| >| for databinding purposes since I can do what I need
| just
| >| with a DataView.
| >|
| >| >-----Original Message-----
| >| >Hi Ken,
| >| >
| >| >Will you get correct result if you use a dataview
| instead?
| >| >
| >| >Luke
| >| >Microsoft Online Support
| >| >
| >| >Get Secure! www.microsoft.com/security
| >| >(This posting is provided "AS IS", with no warranties,
| >| and confers no
| >| >rights.)
| >| >
| >| >.
| >| >
| >|
| >
| >.
| >
|
 

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

Top