When client enters it he has a filter to set. Then push the button get the
data and display in GridView.
Grid uses ObjectDataSource and allows paging and sorting (using custom
stored proc returning only data needed on current page).
But seems that ObjectDataSource is refreshing data on every postback. It's
not ok because dropdowns in
filter also postback thus I hit the database and display data before
filter is set and before client
pushes the button. Plus it hits the database on first PageLoad.
Is there any way to prevent such a behaviour of ObjectDataSource? Or is
there a way to do it w/o ObjectDatasource?
Other then inheriting from GridView and overriding InitializePager (or sth
like that). I cannot find a way to tell
the grid how many records there is so it can generate the Pager.
I thought I found the solution by handling the Selecting event and
canceling it until user pushes the button. But when
there is data in grid and I cancel Selecting event the data in grid is
cleared :/
If it is not possible with ObjectDataSource, then I really don't know what
this control is for. Then it's totally unusable
for other then maybe one or two simplest solutions.
3P
What are you talking about here? You don't want to go back to the database?
Only when client pushes GetMeData button. Not on every postback.
Well, you need to change the binding source to do the binding in the
codebhind file on page_load it seems for the code.
If (!IsPostBack)
(
go get the data and bind it to the control, using a binding method
-- a first time load only -- if it's postback, then you don't do it.
}
This is not the control you're using a binding method of using a dataset
to bind to the control. But the principle is the same for any control
you're trying to bind the results of the SQL query to the control.
You have two choices of using a dataset to bind to the control or using
a collection to bind to a control by using a SQL datareader and
populating the collection of objects to bind to the collection to the
control.
http://demos.telerik.com/aspnet-ajax/treeview/examples/programming/databinding/defaultcs.aspx
You look at the example code for C# or VB and see how to do the binding
programmically. It may be easiest to use the dataset example.
Then in the button_click_event, you go read the data and bind it to the
control.
You have the control.
Yeah this code works when I want to do it on button click. LOL.
I feel that You think that I don't anything about programming. But still
give me responses that have nothing to do with my problem.
That IsPostback is good for binding at the PageLoad not the button click.
And the question was if I can stop ObjectDatasource refresh data on every
postback.
I know I can do it in my button.click eventhandler on my own. But then I
have to write
code for paging, sorting etc.
Read the question before You asnwer please.
I see that you have blinders on and can only see black or white. There
are no other colors that you see, huh?
>
> I feel that You think that I don't anything about programming. But still
> give me responses that have nothing to do with my problem.
>
> That IsPostback is good for binding at the PageLoad not the button click.
You are wrong. It's a one time bind of data to the control on the page
load, and it doesn't bind anymore on the postback. Or don't you
understand that? Don't you understand to load the control at page_Load
on postback and first time load of the control with data.
And if you tell me that the control can only be loaded on user clicking
a button at application start, then it's ridiculous and totally unuser
friendly.
>
> And the question was if I can stop ObjectDatasource refresh data on
> every postback.
How are you going to tell a OBJECTDATASOURCE that you bound at the
ASP.aspx to NOT go back to the database on a POSTBACK? YOU CAN'T DO IT!
You had better come-up with something else, flip the script, as there is
no magic bullet in sight for you.
> I know I can do it in my button.click eventhandler on my own. But then I
> have to write
> code for paging, sorting etc.
>
> Read the question before You asnwer please.
You find that magic bullet you're not going to find, please.
Your compression to think outside the box and take another path is
suspect, and you need to flip the script if you can.
<snipped>
One other thing, there is a magic bullet for you where you take complete
control of the datasource and how it gets data.
But that would require you to 'think outside the box' and figure out
this. How can I tell the datasource to not give me back the data, since
I am the one programming it and give it back when I tell it to give it
back. Can I pass a parm to it?
<copied>
Note that these methods are completely customizable and provides the
platform for adding custom business logic,
which was always missing earlier while binding the UI Layer directly
using SQL DataSource, LINQ DataSource etc.
<end copy>
This applies to VS 2008 too.
<http://geekswithblogs.net/ranganh/archive/2009/12/14/using-wcf-ria-services-without-silverlight-in-visual-studio-2010.aspx>
<http://msdn.microsoft.com/en-us/library/ee707344(VS.91).aspx>
You don't need physical n-tier separation to do it, but rater logical
n-tier separation on the same Web server.
I know what you're talking about. But do you know what I am talking about?
And where do You do one time bind of data if not in PageLoad?
How if (!IsPostback) is used in Button.Click? Please show.
> And if you tell me that the control can only be loaded on user clicking
> a button at application start, then it's ridiculous and totally unuser
> friendly.
>
What? That was very simple. Setup filter then presh show me the data.
Then setup new filter and press show me the data again.
What is "unuser friendly"? (whatever that means).
>> And the question was if I can stop ObjectDatasource refresh data on
>> every postback.
>
> How are you going to tell a OBJECTDATASOURCE that you bound at the
> ASP.aspx to NOT go back to the database on a POSTBACK? YOU CAN'T DO IT!
I can handle Selecting event and set e.Cancel = true; and it doesn't hit
the database
Nevermind now. The only way to do it is inherit from GridView control and
override
InitializePager. Then I can do
btn_Click(...)
{
grid.NumberOfRows = sth;
grid.Datasource = ds;
grid.DataBind();
}
grid doesn't provide "NumberOfRows" property so You have to inherit from
it to add it.
The !IsPostback is about loading the control the very first time the
page is loaded with the control loaded and page rendered. You could have
passed some kind of initial filter to the dataload and loaded the
control out the gate.
There is nothing worst than a page coming up the first time the page is
loaded and a control such as a gridview is blank. And then I the user
must set a filter and load it the first time with a button?
The ispostback has NOTHING to do with your button-click. But it's a way
of making the page more user friendly so the user doesn't have to do
some ridiculous button-click to initially load the control. It should
already be loaded initially.
>
>> And if you tell me that the control can only be loaded on user
>> clicking a button at application start, then it's ridiculous and
>> totally unuser friendly.
>>
> What? That was very simple. Setup filter then presh show me the data.
> Then setup new filter and press show me the data again.
> What is "unuser friendly"? (whatever that means).
It's ridiculous, and if I were the end-user or quality tester, it would
certainly hit the trash can as unnecessary functionality. The control
should have been initially loaded with data.
>
>
>>> And the question was if I can stop ObjectDatasource refresh data on
>>> every postback.
>>
>> How are you going to tell a OBJECTDATASOURCE that you bound at the
>> ASP.aspx to NOT go back to the database on a POSTBACK? YOU CAN'T DO IT!
>
> I can handle Selecting event and set e.Cancel = true; and it doesn't hit
> the database
Why would you be selecting a row, and the selection of the row causes it
to go back to the database? It seems to me that event needs to be disabled.
>
> Nevermind now. The only way to do it is inherit from GridView control
> and override
> InitializePager. Then I can do
>
> btn_Click(...)
> {
> grid.NumberOfRows = sth;
> grid.Datasource = ds;
> grid.DataBind();
> }
>
> grid doesn't provide "NumberOfRows" property so You have to inherit from
> it to add it.
Not to be smart here, I wouldn't waste my time on it, and I would take
control of the paging myself using a algorithm and using
PageIndexedChanged event to control paging. Or on NeededDataSource and
control paging there. I don't know if .Net controls have the event, like
RadCcontrols.
And I said about loding it at the button click not at the PageLoad right?
>
> There is nothing worst than a page coming up the first time the page is
> loaded and a control such as a gridview is blank. And then I the user
> must set a filter and load it the first time with a button?
Total nonsense. Database contains hundreds of tousands or records. Why
waste
users time, hit the database, and show him the data that he doesn't want?
And did You think for a second that this may be what user required?
Showing data after button click?
>
> The ispostback has NOTHING to do with your button-click. But it's a way
> of making the page more user friendly so the user doesn't have to do
> some ridiculous button-click to initially load the control. It should
> already be loaded initially.
Yeah run some SQL on 1 mil records and display without any filter. User
has to wait
for page to load and then still has to set the filter to se the data that
he's interested in.
>
>>
>>> And if you tell me that the control can only be loaded on user
>>> clicking a button at application start, then it's ridiculous and
>>> totally unuser friendly.
What application start? Do You understand english at all? Have You seen
any form
containing filter on top of it and then grid showing data filtered with
this filter?
>>>
>> What? That was very simple. Setup filter then presh show me the data.
>> Then setup new filter and press show me the data again.
>> What is "unuser friendly"? (whatever that means).
>
> It's ridiculous, and if I were the end-user or quality tester, it would
> certainly hit the trash can as unnecessary functionality. The control
> should have been initially loaded with data.
And if I were I would ask why this page loads so slow and why does it show
me data
I dont give a f... about. And I would ask why the hell did You make it
show data
when I told you to do it on button click.
>
>>
>>>> And the question was if I can stop ObjectDatasource refresh data on
>>>> every postback.
>>>
>>> How are you going to tell a OBJECTDATASOURCE that you bound at the
>>> ASP.aspx to NOT go back to the database on a POSTBACK? YOU CAN'T DO IT!
>> I can handle Selecting event and set e.Cancel = true; and it doesn't
>> hit the database
>
> Why would you be selecting a row, and the selection of the row causes it
> to go back to the database? It seems to me that event needs to be
> disabled.
Who is talking about selecting a row!? And where? You clearly have no idea
what You talking about.
>> Nevermind now. The only way to do it is inherit from GridView control
>> and override
>> InitializePager. Then I can do
>> btn_Click(...)
>> {
>> grid.NumberOfRows = sth;
>> grid.Datasource = ds;
>> grid.DataBind();
>> }
>> grid doesn't provide "NumberOfRows" property so You have to inherit
>> from it to add it.
>
> Not to be smart here, I wouldn't waste my time on it, and I would take
> control of the paging myself using a algorithm and using
> PageIndexedChanged event to control paging. Or on NeededDataSource and
> control paging there. I don't know if .Net controls have the event, like
> RadCcontrols.
Yeah and write Your custom grid from scratch and pager control. There is
no way
to tell the grid how many pages to display in pager other then using
ObjectDataSource
or by inheriting from GridView.
Again not user friendly missing initial pageload and loading that control
>>
>> There is nothing worst than a page coming up the first time the page
>> is loaded and a control such as a gridview is blank. And then I the
>> user must set a filter and load it the first time with a button?
>
> Total nonsense. Database contains hundreds of tousands or records. Why
> waste
> users time,
I guess you never heard of a Select Where or Like statement.
hit the database, and show him the data that he doesn't want?
You never ask the user if the first page loads that there can be a
staring point on limited data shown? Who said anything about pulling 100
of thousand of records?
> And did You think for a second that this may be what user required?
> Showing data after button click?
You think it's ridiculous to give the user a starting point? What's with
your filter and limiting what gets shown first? It's better than a
double button-clicking. And you asked the users or the one power user of
the application or anybody in quality assurance about functionality?
>
>>
>> The ispostback has NOTHING to do with your button-click. But it's a
>> way of making the page more user friendly so the user doesn't have to
>> do some ridiculous button-click to initially load the control. It
>> should already be loaded initially.
> Yeah run some SQL on 1 mil records and display without any filter. User
> has to wait
> for page to load and then still has to set the filter to se the data that
> he's interested in.
>
>>
>>>
>>>> And if you tell me that the control can only be loaded on user
>>>> clicking a button at application start, then it's ridiculous and
>>>> totally unuser friendly.
> What application start? Do You understand english at all? Have You seen
> any form
> containing filter on top of it and then grid showing data filtered with
> this filter?
At one point, there was something on a response.redirect or
server.transfer that initially started that page initial application
start. Do you understand anything period is the question?
>
>>>>
>>> What? That was very simple. Setup filter then presh show me the data.
>>> Then setup new filter and press show me the data again.
>>> What is "unuser friendly"? (whatever that means).
>>
>> It's ridiculous, and if I were the end-user or quality tester, it
>> would certainly hit the trash can as unnecessary functionality. The
>> control should have been initially loaded with data.
> And if I were I would ask why this page loads so slow and why does it
> show me data
> I dont give a f... about. And I would ask why the hell did You make it
> show data
> when I told you to do it on button click.
LOL, this is one of you can't think out side the box, and give the
illusion of speed.
>
>>
>>>
>>>>> And the question was if I can stop ObjectDatasource refresh data
>>>>> on every postback.
>>>>
>>>> How are you going to tell a OBJECTDATASOURCE that you bound at the
>>>> ASP.aspx to NOT go back to the database on a POSTBACK? YOU CAN'T DO IT!
>>> I can handle Selecting event and set e.Cancel = true; and it doesn't
>>> hit the database
>>
>> Why would you be selecting a row, and the selection of the row causes
>> it to go back to the database? It seems to me that event needs to be
>> disabled.
>
> Who is talking about selecting a row!? And where? You clearly have no idea
> what You talking about.
What? You're talking about the SelectedIndexChanged? There are not that
many events on the controls. And most of them are about the same. Don't
think that you're some of expert on controls now.
And even at that, based on any type of event fired, why is it attempting
to go back to the database, period, and you have to cancel up out of it.
:) There is something wrong there. You got AutoPostBack on the control
enabled? Maybe, you need to disable that too. :)
Like the health care bill, maybe you need to start over. :)
I have forgotten more in my approaching some 40 years in professional
programming in CICS, TSO, Windows desktop and Web controls than I care
to mention, but I am not expert.
>
>>> Nevermind now. The only way to do it is inherit from GridView
>>> control and override
>>> InitializePager. Then I can do
>>> btn_Click(...)
>>> {
>>> grid.NumberOfRows = sth;
>>> grid.Datasource = ds;
>>> grid.DataBind();
>>> }
>>> grid doesn't provide "NumberOfRows" property so You have to inherit
>>> from it to add it.
>>
>> Not to be smart here, I wouldn't waste my time on it, and I would take
>> control of the paging myself using a algorithm and using
>> PageIndexedChanged event to control paging. Or on NeededDataSource and
>> control paging there. I don't know if .Net controls have the event,
>> like RadCcontrols.
>
> Yeah and write Your custom grid from scratch and pager control. There is
> no way
> to tell the grid how many pages to display in pager other then using
> ObjectDataSource
> or by inheriting from GridView.
LOL, you have no clue as to what I am talking about, and you have not
been down the path I have walked.
A simple algorithm in the PageIndexed change event to compute how many
pages and items per page which are properties of the control preset in
the aspx HTML control is no big deal when you using Linq and Entity
Framework over a WCF Web service with 'objects' in a collection :)
Or you can use a WCF RIA service -- wink. :)
About this, you run some SQL that selects 1m records. It seems like
something you might do, based on our conversation to this point.
In the meantime, I'll use ADO.NET Entity Framework, Linq-2-Objects and
query on selection criteria to get a subset out of the 1m records.
Maybe, I only comeback 20 records out of the 1m, an illusion of speed --
wink.
> 3P wrote:
>>>> And where do You do one time bind of data if not in PageLoad?
>>>> How if (!IsPostback) is used in Button.Click? Please show.
>>>
>>> The !IsPostback is about loading the control the very first time the
>>> page is loaded with the control loaded and page rendered. You could
>>> have passed some kind of initial filter to the dataload and loaded the
>>> control out the gate.
>> And I said about loding it at the button click not at the PageLoad
>> right?
>
> Again not user friendly missing initial pageload and loading that control
Customer says I don't want initiali data. Do You understand it? Or do You
tell customer
to get the f... out and that You won't do any software for them?
Poor You. The only software You create is for your fun.
>>>
>>> There is nothing worst than a page coming up the first time the page
>>> is loaded and a control such as a gridview is blank. And then I the
>>> user must set a filter and load it the first time with a button?
>> Total nonsense. Database contains hundreds of tousands or records. Why
>> waste
>> users time,
>
> I guess you never heard of a Select Where or Like statement.
And what where clause You build if there is no filter specified? And so
what that
there is where and like if You still run it when client didn't specify
what he wants.
Yeah run LIKE on 1 mil records when nobody wants it. LOL.
>
> hit the database, and show him the data that he doesn't want?
> You never ask the user if the first page loads that there can be a
> staring point on limited data shown? Who said anything about pulling 100
> of thousand of records?
>
>> And did You think for a second that this may be what user required?
>> Showing data after button click?
>
> You think it's ridiculous to give the user a starting point? What's with
> your filter and limiting what gets shown first? It's better than a
> double button-clicking. And you asked the users or the one power user of
> the application or anybody in quality assurance about functionality?
Reread this sentence. Or learn english!
>>
>>>>>> The ispostback has NOTHING to do with your button-click. But it's a
>>> way of making the page more user friendly so the user doesn't have to
>>> do some ridiculous button-click to initially load the control. It
>>> should already be loaded initially.
>> Yeah run some SQL on 1 mil records and display without any filter. User
>> has to wait
>> for page to load and then still has to set the filter to se the data
>> that
>> he's interested in.
>>
>>>
>>>>
>>>>> And if you tell me that the control can only be loaded on user
>>>>> clicking a button at application start, then it's ridiculous and
>>>>> totally unuser friendly.
>> What application start? Do You understand english at all? Have You seen
>> any form
>> containing filter on top of it and then grid showing data filtered with
>> this filter?
>
> At one point, there was something on a response.redirect or
> server.transfer that initially started that page initial application
> start. Do you understand anything period is the question?
No I don't understand Your english. And I don't understand what
response.redirect
or server.transfer You talk about.
>>
>>>>>
>>>> What? That was very simple. Setup filter then presh show me the data.
>>>> Then setup new filter and press show me the data again.
>>>> What is "unuser friendly"? (whatever that means).
>>>
>>> It's ridiculous, and if I were the end-user or quality tester, it
>>> would certainly hit the trash can as unnecessary functionality. The
>>> control should have been initially loaded with data.
>
>> And if I were I would ask why this page loads so slow and why does it
>> show me data
>> I dont give a f... about. And I would ask why the hell did You make it
>> show data
>> when I told you to do it on button click.
>
> LOL, this is one of you can't think out side the box, and give the
> illusion of speed.
No it's give what client asks for. Keep doing software for fun.
>>
>>>
>>>>
>>>>>> And the question was if I can stop ObjectDatasource refresh data
>>>>>> on every postback.
>>>>>
>>>>> How are you going to tell a OBJECTDATASOURCE that you bound at the
>>>>> ASP.aspx to NOT go back to the database on a POSTBACK? YOU CAN'T DO
>>>>> IT!
>>>> I can handle Selecting event and set e.Cancel = true; and it doesn't
>>>> hit the database
>>>
>>> Why would you be selecting a row, and the selection of the row causes
>>> it to go back to the database? It seems to me that event needs to be
>>> disabled.
>
>> Who is talking about selecting a row!? And where? You clearly have no
>> idea
>> what You talking about.
>
> What? You're talking about the SelectedIndexChanged? There are not that
> many events on the controls. And most of them are about the same. Don't
> think that you're some of expert on controls now.
Now You made me laugh. You really don't know what were talking about here.
What selectedIndexChanged? Can You read? Why would I hit the database on
SelectedIndexChanged?
I'll help You. We were talking about ObjectDataSource. Now get it?
> And even at that, based on any type of event fired, why is it attempting
> to go back to the database, period, and you have to cancel up out of it.
> :) There is something wrong there. You got AutoPostBack on the control
> enabled? Maybe, you need to disable that too. :)
Because ObjectDataSource does it. RTFM!
And there are many AutoPostback controls in filter, because gues what?
They have
to postback to populate dome dropdowns in filter.
And if your not using EF, WCF or WCR RIA it is hard to calculate it!?
LOL. I see You know some technology terms. LOL. OK I will rebuild my app
use
EF, and WCF services to enable paging. Now I'm wondering if Your kidding
or ...
You can't set properties of a grid's pager! Understand? And that's
interesting if You calculate
how many items per page there is.
<snipped>
<yawn>
You with the cuss words see ya later.
Stick a parameter on your objectdatasource.
You can connect that up to whatever control you use to define the filter.
Make the initial selection something won't return anything.
OK it "hits your database" first time off but returns nuthin.
Or have your objectdatasource set up like this but only connect it to your
grid on first postback.
Objectdatasource has Selecting method, which carries the parameters as a dictionary. One can either Cancel the select or mess with the parameter values.
Ps. much is lost when you give a monkey a [C]# spoon. Lose-th the monkey... lose-th the spoon.
> On Thursday, March 18, 2010 5:01 PM 3P wrote:
> I would like to create a very simple form.
>
> When client enters it he has a filter to set. Then push the button get the
> data and display in GridView.
> Grid uses ObjectDataSource and allows paging and sorting (using custom
> stored proc returning only data needed on current page).
> But seems that ObjectDataSource is refreshing data on every postback. it is
> not ok because dropdowns in
> filter also postback thus I hit the database and display data before
> filter is set and before client
> pushes the button. Plus it hits the database on first PageLoad.
>
> Is there any way to prevent such a behaviour of ObjectDataSource? Or is
> there a way to do it w/o ObjectDatasource?
> Other then inheriting from GridView and overriding InitializePager (or sth
> like that). I cannot find a way to tell
> the grid how many records there is so it can generate the Pager.
>
> I thought I found the solution by handling the Selecting event and
> canceling it until user pushes the button. But when
> there is data in grid and I cancel Selecting event the data in grid is
> cleared :/
>
> If it is not possible with ObjectDataSource, then I really do not know what
> this control is for. Then it is totally unusable
> for other then maybe one or two simplest solutions.
>
>
> 3P
>> On Thursday, March 18, 2010 6:09 PM Mr. Arnold wrote:
>> 3P wrote:
>>
>> What are you talking about here? You do not want to go back to the database?
>>> On Thursday, March 18, 2010 6:32 PM 3P wrote:
>>> Only when client pushes GetMeData button. Not on every postback.
>>>> On Thursday, March 18, 2010 8:51 PM Mr. Arnold wrote:
>>>> 3P wrote:
>>>>
>>>> Well, you need to change the binding source to do the binding in the
>>>> codebhind file on page_load it seems for the code.
>>>>
>>>> If (!IsPostBack)
>>>> (
>>>> go get the data and bind it to the control, using a binding method
>>>> -- a first time load only -- if it is postback, then you do not do it.
>>>> }
>>>>
>>>> This is not the control you are using a binding method of using a dataset
>>>> to bind to the control. But the principle is the same for any control
>>>> you are trying to bind the results of the SQL query to the control.
>>>>
>>>> You have two choices of using a dataset to bind to the control or using
>>>> a collection to bind to a control by using a SQL datareader and
>>>> populating the collection of objects to bind to the collection to the
>>>> control.
>>>>
>>>> http://demos.telerik.com/aspnet-ajax/treeview/examples/programming/databinding/defaultcs.aspx
>>>>
>>>> You look at the example code for C# or VB and see how to do the binding
>>>> programmically. It may be easiest to use the dataset example.
>>>>
>>>> Then in the button_click_event, you go read the data and bind it to the
>>>> control.
>>>>
>>>> You have the control.
>>>>> On Friday, March 19, 2010 1:40 PM 3P wrote:
>>>>> Yeah this code works when I want to do it on button click. LOL.
>>>>>
>>>>> I feel that You think that I do not anything about programming. But still
>>>>> give me responses that have nothing to do with my problem.
>>>>>
>>>>> That IsPostback is good for binding at the PageLoad not the button click.
>>>>>
>>>>> And the question was if I can stop ObjectDatasource refresh data on every
>>>>> postback.
>>>>> I know I can do it in my button.click eventhandler on my own. But then I
>>>>> have to write
>>>>> code for paging, sorting etc.
>>>>>
>>>>> Read the question before You asnwer please.
>>>>>> On Friday, March 19, 2010 2:32 PM Mr. Arnold wrote:
>>>>>> 3P wrote:
>>>>>>
>>>>>> I see that you have blinders on and can only see black or white. There
>>>>>> are no other colors that you see, huh?
>>>>>>
>>>>>>
>>>>>> You are wrong. it is a one time bind of data to the control on the page
>>>>>> load, and it does not bind anymore on the postback. Or do not you
>>>>>> understand that? Don't you understand to load the control at page_Load
>>>>>> on postback and first time load of the control with data.
>>>>>>
>>>>>> And if you tell me that the control can only be loaded on user clicking
>>>>>> a button at application start, then it is ridiculous and totally unuser
>>>>>> friendly.
>>>>>>
>>>>>>
>>>>>> How are you going to tell a OBJECTDATASOURCE that you bound at the
>>>>>> ASP.aspx to NOT go back to the database on a POSTBACK? YOU CAN'T DO IT!
>>>>>>
>>>>>> You had better come-up with something else, flip the script, as there is
>>>>>> no magic bullet in sight for you.
>>>>>>
>>>>>>
>>>>>> You find that magic bullet you are not going to find, please.
>>>>>>
>>>>>> Your compression to think outside the box and take another path is
>>>>>> suspect, and you need to flip the script if you can.
>>>>>>> On Friday, March 19, 2010 3:12 PM Mr. Arnold wrote:
>>>>>>> 3P wrote:
>>>>>>>
>>>>>>> <snipped>
>>>>>>>
>>>>>>> One other thing, there is a magic bullet for you where you take complete
>>>>>>> control of the datasource and how it gets data.
>>>>>>>
>>>>>>> But that would require you to 'think outside the box' and figure out
>>>>>>> this. How can I tell the datasource to not give me back the data, since
>>>>>>> I am the one programming it and give it back when I tell it to give it
>>>>>>> back. Can I pass a parm to it?
>>>>>>>
>>>>>>> <copied>
>>>>>>>
>>>>>>> Note that these methods are completely customizable and provides the
>>>>>>> platform for adding custom business logic,
>>>>>>> which was always missing earlier while binding the UI Layer directly
>>>>>>> using SQL DataSource, LINQ DataSource etc.
>>>>>>>
>>>>>>> <end copy>
>>>>>>>
>>>>>>> This applies to VS 2008 too.
>>>>>>>
>>>>>>> <http://geekswithblogs.net/ranganh/archive/2009/12/14/using-wcf-ria-services-without-silverlight-in-visual-studio-2010.aspx>
>>>>>>> <http://msdn.microsoft.com/en-us/library/ee707344(VS.91).aspx>
>>>>>>>
>>>>>>> You do not need physical n-tier separation to do it, but rater logical
>>>>>>> n-tier separation on the same Web server.
>>>>>>>
>>>>>>> I know what you are talking about. But do you know what I am talking about?
>>>>>>>> On Friday, March 19, 2010 3:41 PM 3P wrote:
>>>>>>>> And where do You do one time bind of data if not in PageLoad?
>>>>>>>>
>>>>>>>> How if (!IsPostback) is used in Button.Click? Please show.
>>>>>>>>
>>>>>>>> What? That was very simple. Setup filter then presh show me the data.
>>>>>>>> Then setup new filter and press show me the data again.
>>>>>>>> What is "unuser friendly"? (whatever that means).
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> I can handle Selecting event and set e.Cancel = true; and it does not hit
>>>>>>>> the database
>>>>>>>>
>>>>>>>> Nevermind now. The only way to do it is inherit from GridView control and
>>>>>>>> override
>>>>>>>> InitializePager. Then I can do
>>>>>>>>
>>>>>>>> btn_Click(...)
>>>>>>>> {
>>>>>>>> grid.NumberOfRows = sth;
>>>>>>>> grid.Datasource = ds;
>>>>>>>> grid.DataBind();
>>>>>>>> }
>>>>>>>>
>>>>>>>> grid does not provide "NumberOfRows" property so You have to inherit from
>>>>>>>> it to add it.
>>>>>>>>> On Friday, March 19, 2010 4:39 PM Mr. Arnold wrote:
>>>>>>>>> 3P wrote:
>>>>>>>>>
>>>>>>>>> The !IsPostback is about loading the control the very first time the
>>>>>>>>> page is loaded with the control loaded and page rendered. You could have
>>>>>>>>> passed some kind of initial filter to the dataload and loaded the
>>>>>>>>> control out the gate.
>>>>>>>>>
>>>>>>>>> There is nothing worst than a page coming up the first time the page is
>>>>>>>>> loaded and a control such as a gridview is blank. And then I the user
>>>>>>>>> must set a filter and load it the first time with a button?
>>>>>>>>>
>>>>>>>>> The ispostback has NOTHING to do with your button-click. But it is a way
>>>>>>>>> of making the page more user friendly so the user does not have to do
>>>>>>>>> some ridiculous button-click to initially load the control. It should
>>>>>>>>> already be loaded initially.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> it is ridiculous, and if I were the end-user or quality tester, it would
>>>>>>>>> certainly hit the trash can as unnecessary functionality. The control
>>>>>>>>> should have been initially loaded with data.
>>>>>>>>>> On Friday, March 19, 2010 6:02 PM 3P wrote:
>>>>>>>>>> And I said about loding it at the button click not at the PageLoad right?
>>>>>>>>>>
>>>>>>>>>> Total nonsense. Database contains hundreds of tousands or records. Why
>>>>>>>>>> waste
>>>>>>>>>> users time, hit the database, and show him the data that he does not want?
>>>>>>>>>> And did You think for a second that this may be what user required?
>>>>>>>>>> Showing data after button click?
>>>>>>>>>>
>>>>>>>>>> Yeah run some SQL on 1 mil records and display without any filter. User
>>>>>>>>>> has to wait
>>>>>>>>>> for page to load and then still has to set the filter to se the data that
>>>>>>>>>> he is interested in.
>>>>>>>>>>
>>>>>>>>>> What application start? Do You understand english at all? Have You seen
>>>>>>>>>> any form
>>>>>>>>>> containing filter on top of it and then grid showing data filtered with
>>>>>>>>>> this filter?
>>>>>>>>>>
>>>>>>>>>> And if I were I would ask why this page loads so slow and why does it show
>>>>>>>>>> me data
>>>>>>>>>> I dont give a f... about. And I would ask why the hell did You make it
>>>>>>>>>> show data
>>>>>>>>>> when I told you to do it on button click.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Who is talking about selecting a row!? And where? You clearly have no idea
>>>>>>>>>> what You talking about.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Yeah and write Your custom grid from scratch and pager control. There is
>>>>>>>>>> no way
>>>>>>>>>> to tell the grid how many pages to display in pager other then using
>>>>>>>>>> ObjectDataSource
>>>>>>>>>> or by inheriting from GridView.
>>>>>>>>>>> On Friday, March 19, 2010 7:17 PM Mr. Arnold wrote:
>>>>>>>>>>> 3P wrote:
>>>>>>>>>>>
>>>>>>>>>>> Again not user friendly missing initial pageload and loading that control
>>>>>>>>>>>
>>>>>>>>>>> I guess you never heard of a Select Where or Like statement.
>>>>>>>>>>>
>>>>>>>>>>> hit the database, and show him the data that he does not want?
>>>>>>>>>>> You never ask the user if the first page loads that there can be a
>>>>>>>>>>> staring point on limited data shown? Who said anything about pulling 100
>>>>>>>>>>> of thousand of records?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> You think it is ridiculous to give the user a starting point? What's with
>>>>>>>>>>> your filter and limiting what gets shown first? it is better than a
>>>>>>>>>>> double button-clicking. And you asked the users or the one power user of
>>>>>>>>>>> the application or anybody in quality assurance about functionality?
>>>>>>>>>>>
>>>>>>>>>>> At one point, there was something on a response.redirect or
>>>>>>>>>>> server.transfer that initially started that page initial application
>>>>>>>>>>> start. Do you understand anything period is the question?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> LOL, this is one of you cannot think out side the box, and give the
>>>>>>>>>>> illusion of speed.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> What? You're talking about the SelectedIndexChanged? There are not that
>>>>>>>>>>> many events on the controls. And most of them are about the same. Don't
>>>>>>>>>>> think that you are some of expert on controls now.
>>>>>>>>>>>> On Friday, March 19, 2010 7:32 PM Mr. Arnold wrote:
>>>>>>>>>>>> 3P wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> About this, you run some SQL that selects 1m records. It seems like
>>>>>>>>>>>> something you might do, based on our conversation to this point.
>>>>>>>>>>>>
>>>>>>>>>>>> In the meantime, I will use ADO.NET Entity Framework, Linq-2-Objects and
>>>>>>>>>>>> query on selection criteria to get a subset out of the 1m records.
>>>>>>>>>>>> Maybe, I only comeback 20 records out of the 1m, an illusion of speed --
>>>>>>>>>>>> wink.
>>>>>>>>>>>>> On Friday, March 19, 2010 8:40 PM 3P wrote:
>>>>>>>>>>>>> Customer says I do not want initiali data. Do You understand it? Or do You
>>>>>>>>>>>>> tell customer
>>>>>>>>>>>>> to get the f... out and that You will not do any software for them?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Poor You. The only software You create is for your fun.
>>>>>>>>>>>>>
>>>>>>>>>>>>> And what where clause You build if there is no filter specified? And so
>>>>>>>>>>>>> what that
>>>>>>>>>>>>> there is where and like if You still run it when client did not specify
>>>>>>>>>>>>> what he wants.
>>>>>>>>>>>>> Yeah run LIKE on 1 mil records when nobody wants it. LOL.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Reread this sentence. Or learn english!
>>>>>>>>>>>>>
>>>>>>>>>>>>> No I do not understand Your english. And I do not understand what
>>>>>>>>>>>>> response.redirect
>>>>>>>>>>>>> or server.transfer You talk about.
>>>>>>>>>>>>> No it is give what client asks for. Keep doing software for fun.
>>>>>>>>>>>>>>> On Sunday, March 21, 2010 12:22 PM Andy O'Neill wrote:
>>>>>>>>>>>>>>> Stick a parameter on your objectdatasource.
>>>>>>>>>>>>>>> You can connect that up to whatever control you use to define the filter.
>>>>>>>>>>>>>>> Make the initial selection something will not return anything.
>>>>>>>>>>>>>>> OK it "hits your database" first time off but returns nuthin.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Or have your objectdatasource set up like this but only connect it to your
>>>>>>>>>>>>>>> grid on first postback.
>>>>>>>>>>>>>>>> On Monday, March 22, 2010 5:16 AM Andy B. wrote:
>>>>>>>>>>>>>>>> There is also the ObjectDataSource.DataBinding event that fires just before
>>>>>>>>>>>>>>>> the datasource is bound to a control. You can do any checks, canceling or
>>>>>>>>>>>>>>>> filtering here if you want.
>>>>>>>>>>>>>>>> Submitted via EggHeadCafe - Software Developer Portal of Choice
>>>>>>>>>>>>>>>> ASP.NET Caching Concepts
>>>>>>>>>>>>>>>> http://www.eggheadcafe.com/tutorials/aspnet/78de4d09-b013-48c0-8d4a-bedd68f675f5/aspnet-caching-concepts.aspx
Objectdatasource has Selecting method, which carries the parameters as a dictionary. One can either Cancel the select or mess with the parameter values.
Ps. much is lost when you give a monkey a [C]# spoon. Lose-th the monkey... lose-th the spoon.
> On Thursday, March 18, 2010 5:01 PM 3P wrote:
> I would like to create a very simple form.
>
> When client enters it he has a filter to set. Then push the button get the
> data and display in GridView.
>>>>>>>>>>>>>>> Stick a parameter on your objectdatasource.
>>>>>>>>>>>>>>> You can connect that up to whatever control you use to define the filter.
>>>>>>>>>>>>>>> Make the initial selection something will not return anything.
>>>>>>>>>>>>>>> OK it "hits your database" first time off but returns nuthin.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Or have your objectdatasource set up like this but only connect it to your
>>>>>>>>>>>>>>> grid on first postback.
>>>>>>>>>>>>>>>> On Monday, March 22, 2010 5:16 AM Andy B. wrote:
>>>>>>>>>>>>>>>> There is also the ObjectDataSource.DataBinding event that fires just before
>>>>>>>>>>>>>>>> the datasource is bound to a control. You can do any checks, canceling or
>>>>>>>>>>>>>>>> filtering here if you want.
>>>>>>>>>>>>>>>>> On Friday, October 29, 2010 4:37 AM Deon Claassens wrote:
>>>>>>>>>>>>>>>>> I found a nice amongst the nasty. Nice in no way being an indicator of elegance...
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Objectdatasource has Selecting method, which carries the parameters as a dictionary. One can either Cancel the select or mess with the parameter values.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Ps. much is lost when you give a monkey a [C]# spoon. Lose-th the monkey... lose-th the spoon.
>>>>>>>>>>>>>>>>> Submitted via EggHeadCafe - Software Developer Portal of Choice
>>>>>>>>>>>>>>>>> SharePoint WorkFlow Basics
>>>>>>>>>>>>>>>>> http://www.eggheadcafe.com/tutorials/aspnet/1fa263fb-d7a6-40f5-8875-356f75d9fca9/sharepoint-workflow-basics.aspx