I'm using SQLDataSource, which generates some kind of dataset, and then I
attach that datasource to various data display controls such as DataList and
repeater which loop through to the end of the data that was retrieved by the
query.
At times I may want the display control only to render some items in the set
of data returned by SqlDataSource. There would be several scenarios:
* render the second data item or third item in to the end
* render the second data item through the second-to-the-last or
third-to-the-last data item
* render the first data item through N and then stop rendering.
I recognize that it would be possible to accomplish the same thing by
manipulating what gets pulled out of the database, but I'd like to have
alternatives to that. Using ASP/ADO I could have managed this by playing
with the cursor and MoveNext and the like.
Ultimately I want to be able to specify parameters to user controls at
runtime and tell an embedded repeater to, say, render items 2-5 in a list of
data items. This will serve various layout and content management needs.
Can someone suggest code to accomplish the three bulleted scenarios
described above?
-KF 6 2028
A simple way of doing this would be to bind the whole dataset to the
repeater and than handle the repeater's PreRender event to set Visible=false
for some items according to your rules.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin
"Ken Fine" <ke*****@u.washington.eduwrote in message
news:em**********@gnus01.u.washington.edu...
I'm using SQLDataSource, which generates some kind of dataset, and then I
attach that datasource to various data display controls such as DataList
and repeater which loop through to the end of the data that was retrieved
by the query.
At times I may want the display control only to render some items in the
set of data returned by SqlDataSource. There would be several scenarios:
* render the second data item or third item in to the end
* render the second data item through the second-to-the-last or
third-to-the-last data item
* render the first data item through N and then stop rendering.
I recognize that it would be possible to accomplish the same thing by
manipulating what gets pulled out of the database, but I'd like to have
alternatives to that. Using ASP/ADO I could have managed this by playing
with the cursor and MoveNext and the like.
Ultimately I want to be able to specify parameters to user controls at
runtime and tell an embedded repeater to, say, render items 2-5 in a list
of data items. This will serve various layout and content management
needs.
Can someone suggest code to accomplish the three bulleted scenarios
described above?
-KF
Thank you. Can anyone suggest if there other approaches that might also
solve the problem? Using the equivalent of a cursor? Copying SqlDataSource
and removing elements from the copy? Applying the equivalent of ".Filter"?
Thanks again for your help,
-KF
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:u7**************@TK2MSFTNGP06.phx.gbl...
>A simple way of doing this would be to bind the whole dataset to the repeater and than handle the repeater's PreRender event to set Visible=false for some items according to your rules.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin
"Ken Fine" <ke*****@u.washington.eduwrote in message
news:em**********@gnus01.u.washington.edu...
>I'm using SQLDataSource, which generates some kind of dataset, and then I attach that datasource to various data display controls such as DataList and repeater which loop through to the end of the data that was retrieved by the query.
At times I may want the display control only to render some items in the set of data returned by SqlDataSource. There would be several scenarios:
* render the second data item or third item in to the end * render the second data item through the second-to-the-last or third-to-the-last data item * render the first data item through N and then stop rendering.
I recognize that it would be possible to accomplish the same thing by manipulating what gets pulled out of the database, but I'd like to have alternatives to that. Using ASP/ADO I could have managed this by playing with the cursor and MoveNext and the like.
Ultimately I want to be able to specify parameters to user controls at runtime and tell an embedded repeater to, say, render items 2-5 in a list of data items. This will serve various layout and content management needs.
Can someone suggest code to accomplish the three bulleted scenarios described above?
-KF
Sure. You can use DataTable.Select method for filtering records. You will
need a field telling you the item number that you could filter based on the
number.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin
"Ken Fine" <ke*****@u.washington.eduwrote in message
news:em**********@gnus01.u.washington.edu...
Thank you. Can anyone suggest if there other approaches that might also
solve the problem? Using the equivalent of a cursor? Copying SqlDataSource
and removing elements from the copy? Applying the equivalent of ".Filter"?
Thanks again for your help,
-KF
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:u7**************@TK2MSFTNGP06.phx.gbl...
>>A simple way of doing this would be to bind the whole dataset to the repeater and than handle the repeater's PreRender event to set Visible=false for some items according to your rules.
-- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin
"Ken Fine" <ke*****@u.washington.eduwrote in message news:em**********@gnus01.u.washington.edu...
>>I'm using SQLDataSource, which generates some kind of dataset, and then I attach that datasource to various data display controls such as DataList and repeater which loop through to the end of the data that was retrieved by the query.
At times I may want the display control only to render some items in the set of data returned by SqlDataSource. There would be several scenarios:
* render the second data item or third item in to the end * render the second data item through the second-to-the-last or third-to-the-last data item * render the first data item through N and then stop rendering.
I recognize that it would be possible to accomplish the same thing by manipulating what gets pulled out of the database, but I'd like to have alternatives to that. Using ASP/ADO I could have managed this by playing with the cursor and MoveNext and the like.
Ultimately I want to be able to specify parameters to user controls at runtime and tell an embedded repeater to, say, render items 2-5 in a list of data items. This will serve various layout and content management needs.
Can someone suggest code to accomplish the three bulleted scenarios described above?
-KF
Does SqlDataSource expose a DataTable that is programmatically accessible
using DataTable.Select? (Apologies in advance for twenty questions, but I am
vaguely vaguely recalling something about SqlDtaSource internally using a
structure that could not be programmatically manipulated in the way you'd
think you could based on its name.)
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:eh**************@TK2MSFTNGP03.phx.gbl...
Sure. You can use DataTable.Select method for filtering records. You will
need a field telling you the item number that you could filter based on
the number.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin
"Ken Fine" <ke*****@u.washington.eduwrote in message
news:em**********@gnus01.u.washington.edu...
>Thank you. Can anyone suggest if there other approaches that might also solve the problem? Using the equivalent of a cursor? Copying SqlDataSource and removing elements from the copy? Applying the equivalent of ".Filter"?
Thanks again for your help, -KF
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in message news:u7**************@TK2MSFTNGP06.phx.gbl...
>>>A simple way of doing this would be to bind the whole dataset to the repeater and than handle the repeater's PreRender event to set Visible=false for some items according to your rules.
-- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin
"Ken Fine" <ke*****@u.washington.eduwrote in message news:em**********@gnus01.u.washington.edu... I'm using SQLDataSource, which generates some kind of dataset, and then I attach that datasource to various data display controls such as DataList and repeater which loop through to the end of the data that was retrieved by the query.
At times I may want the display control only to render some items in the set of data returned by SqlDataSource. There would be several scenarios:
* render the second data item or third item in to the end * render the second data item through the second-to-the-last or third-to-the-last data item * render the first data item through N and then stop rendering.
I recognize that it would be possible to accomplish the same thing by manipulating what gets pulled out of the database, but I'd like to have alternatives to that. Using ASP/ADO I could have managed this by playing with the cursor and MoveNext and the like.
Ultimately I want to be able to specify parameters to user controls at runtime and tell an embedded repeater to, say, render items 2-5 in a list of data items. This will serve various layout and content management needs.
Can someone suggest code to accomplish the three bulleted scenarios described above?
-KF
Hmm... Actually with SqlDataSource it is more complicated. You can set
DataSourceMode property to DataSet and the data will be loaded into a
DataSet object. The object will be cashed. The Select method in this case
returns just a list of data rows. You can set the FilterExpression property
prior to calling Select.
I would definitely recommend using the PreRender event. Or switching from
SqlDataSource to the old good DataSource way of databinding where you can
bind to a dataset in a straightforward manner.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin
<ke*****@nospam.nospamwrote in message
news:Oe**************@TK2MSFTNGP06.phx.gbl...
Does SqlDataSource expose a DataTable that is programmatically accessible
using DataTable.Select? (Apologies in advance for twenty questions, but I
am vaguely vaguely recalling something about SqlDtaSource internally using
a structure that could not be programmatically manipulated in the way
you'd think you could based on its name.)
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:eh**************@TK2MSFTNGP03.phx.gbl...
>Sure. You can use DataTable.Select method for filtering records. You will need a field telling you the item number that you could filter based on the number.
-- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin
"Ken Fine" <ke*****@u.washington.eduwrote in message news:em**********@gnus01.u.washington.edu...
>>Thank you. Can anyone suggest if there other approaches that might also solve the problem? Using the equivalent of a cursor? Copying SqlDataSource and removing elements from the copy? Applying the equivalent of ".Filter"?
Thanks again for your help, -KF
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in message news:u7**************@TK2MSFTNGP06.phx.gbl... A simple way of doing this would be to bind the whole dataset to the repeater and than handle the repeater's PreRender event to set Visible=false for some items according to your rules.
-- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin
"Ken Fine" <ke*****@u.washington.eduwrote in message news:em**********@gnus01.u.washington.edu... I'm using SQLDataSource, which generates some kind of dataset, and then I attach that datasource to various data display controls such as DataList and repeater which loop through to the end of the data that was retrieved by the query. > At times I may want the display control only to render some items in the set of data returned by SqlDataSource. There would be several scenarios: > * render the second data item or third item in to the end * render the second data item through the second-to-the-last or third-to-the-last data item * render the first data item through N and then stop rendering. > I recognize that it would be possible to accomplish the same thing by manipulating what gets pulled out of the database, but I'd like to have alternatives to that. Using ASP/ADO I could have managed this by playing with the cursor and MoveNext and the like. > Ultimately I want to be able to specify parameters to user controls at runtime and tell an embedded repeater to, say, render items 2-5 in a list of data items. This will serve various layout and content management needs. > Can someone suggest code to accomplish the three bulleted scenarios described above? > -KF > > >
Thanks for the help and clarification. If anyone has a pointer to code, I
would benefit from seeing it.
-KF
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:uh**************@TK2MSFTNGP04.phx.gbl...
Hmm... Actually with SqlDataSource it is more complicated. You can set
DataSourceMode property to DataSet and the data will be loaded into a
DataSet object. The object will be cashed. The Select method in this case
returns just a list of data rows. You can set the FilterExpression
property prior to calling Select.
I would definitely recommend using the PreRender event. Or switching from
SqlDataSource to the old good DataSource way of databinding where you can
bind to a dataset in a straightforward manner.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin
<ke*****@nospam.nospamwrote in message
news:Oe**************@TK2MSFTNGP06.phx.gbl...
>Does SqlDataSource expose a DataTable that is programmatically accessible using DataTable.Select? (Apologies in advance for twenty questions, but I am vaguely vaguely recalling something about SqlDtaSource internally using a structure that could not be programmatically manipulated in the way you'd think you could based on its name.)
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in message news:eh**************@TK2MSFTNGP03.phx.gbl...
>>Sure. You can use DataTable.Select method for filtering records. You will need a field telling you the item number that you could filter based on the number.
-- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin
"Ken Fine" <ke*****@u.washington.eduwrote in message news:em**********@gnus01.u.washington.edu... Thank you. Can anyone suggest if there other approaches that might also solve the problem? Using the equivalent of a cursor? Copying SqlDataSource and removing elements from the copy? Applying the equivalent of ".Filter"?
Thanks again for your help, -KF
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in message news:u7**************@TK2MSFTNGP06.phx.gbl... >A simple way of doing this would be to bind the whole dataset to the >repeater and than handle the repeater's PreRender event to set >Visible=false for some items according to your rules. > -- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin > > "Ken Fine" <ke*****@u.washington.eduwrote in message news:em**********@gnus01.u.washington.edu... >I'm using SQLDataSource, which generates some kind of dataset, and >then I attach that datasource to various data display controls such >as DataList and repeater which loop through to the end of the data >that was retrieved by the query. >> >At times I may want the display control only to render some items in >the set of data returned by SqlDataSource. There would be several >scenarios: >> >* render the second data item or third item in to the end >* render the second data item through the second-to-the-last or >third-to-the-last data item >* render the first data item through N and then stop rendering. >> >I recognize that it would be possible to accomplish the same thing by >manipulating what gets pulled out of the database, but I'd like to >have alternatives to that. Using ASP/ADO I could have managed this by >playing with the cursor and MoveNext and the like. >> >Ultimately I want to be able to specify parameters to user controls >at runtime and tell an embedded repeater to, say, render items 2-5 in >a list of data items. This will serve various layout and content >management needs. >> >Can someone suggest code to accomplish the three bulleted scenarios >described above? >> >-KF >> >> >> > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Martin Bischoff |
last post by:
Hi,
is it possible to modify the values of a SqlDataSource's select parameters
in the code behind before the select command is executed?
Example:
I have an SqlDataSource with a...
|
by: Mike Kelly |
last post by:
I've chosen to implement the "optimistic concurrency" model in my
application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to
my main tables. I read the value of the column in my...
|
by: Radx |
last post by:
Here in my web application, I have a data entry page with serval controls.
Some of the controls have autopostback is set true.
But the problem is when two or more people are entering data at the...
|
by: Mike P |
last post by:
When you use a SqlDataSource to hook up data to a GridView it seems to
be to be very inflexible. For example, I want to create my own Delete
button with my own code and I also want to create a...
|
by: |
last post by:
I'm using ASP.NET 2.0, C#, SQL Server 2005, and databound controls like the
DataList and the GridView. Right now I'm using SqlDataSource as part of very
quick and dirty site; I'm not looking to...
|
by: Mike |
last post by:
Is there any difference in performance between a SqlDataSource and an
ObjectDataSource - assuming they are being deployed to perform the same task
against a SQL Server database?
Mike
|
by: Chris |
last post by:
Hi,
I want to limit the amount of data shown in a page coming from a database.
Everything works except that I get the error:
"Unable to cast object of type...
|
by: mohaaron |
last post by:
This seems like it should be simple to do but for some reason I have
been unable to make it work.
I would like to databind a SqlDataSource to a GridView during the
click event of a button. This...
|
by: =?Utf-8?B?UEs5?= |
last post by:
I have a very simple setup that should work fine per documentation. However,
my gridview control will not properly update using the updatecommand of the
sqldatasource. I've simplified everything...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |