CslaDataSource SelectParameter

CslaDataSource SelectParameter

Old forum URL: forums.lhotka.net/forums/t/2076.aspx


kids_pro posted on Wednesday, January 03, 2007

Dear Rocky,

Is it possible to have CslaDataSource support Parameter?
I am not sure that the solution to my problem or not.

I want to bind my BLB to CslaDataSource but only selected item only (active records/ disable records one at a time) I know I can add select parameter with objectdatasource but not sure how to do it with CslaDataSource.

Thanks,

RockfordLhotka replied on Thursday, January 04, 2007

So you have two collections, and based on the selection in CollectionA you want to filter the contents of CollectionB?

To do this, in the SelectObject event handler for the CslaDataSource for CollectionB, you use the selected value from the control displaying CollectionA.

kids_pro replied on Friday, January 05, 2007

Dear Rocky,
From your suggestion I come up with start the following code:

    protected void TSODataSource_SelectObject(object sender, Csla.Web.SelectObjectArgs e) {
        int iProvGis;
        int.TryParse(ddlProvince.SelectedValue, out iProvGis);

        e.BusinessObject = MyBO.Lists.ReadOnly.TSOList.GetTSOList(iProvGis,true);
       //GetTSOList(int gis, bool isactive) this method allow me to select active record or disabled records
    }

then I bind my gridview1.DataSourceID = "TSODataSource"
It works only the first time page load.
When I tried to select different item from ddlProvince (dropdownlist) the record not update in the gridview1 at all.

May be I miss something.

Jurjen replied on Friday, January 05, 2007

Kids,

I think you should call GridView1.DataBind from the SelectedIndexChanged event of the ddlProvince to make sure that the SelectObject event fires.

Jurjen.

kids_pro replied on Friday, January 05, 2007

That was o'som Big Smile [:D] many thank Jurjen.

Copyright (c) Marimer LLC