Databinding using <SelectParameters>

Posts   
 
    
Koolworld
User
Posts: 50
Joined: 10-Oct-2006
# Posted on: 16-Mar-2007 09:41:21   

Hi, i've got this working successfully using a dropdown and a datagrid, the DG datasource has this:

<asp:ControlParameter ControlID="ddlModels" Name="ModelId" PropertyName="SelectedValue" Type="String" />

and it works as expected.

What i also want to do is have two dropdowns, the first ones selection to control the second ones datasource but i get a Stack overflow error.

The first datasource for Manufacturers dropdown is:

<llblgenpro:LLBLGenProDataSource ID="manufacturers" runat="server" DataContainerType="EntityCollection"
        EntityCollectionTypeName="vca_mass_update.CollectionClasses.ManufacturersCollection, vca_mass_update" LivePersistence="True" CacheLocation="Session">
    </llblgenpro:LLBLGenProDataSource>

The second one for Models dropdown is:

<llblgenpro:LLBLGenProDataSource ID="models" runat="server" DataContainerType="EntityCollection"
        EntityCollectionTypeName="vca_mass_update.CollectionClasses.ModelsCollection, vca_mass_update" LivePersistence="True" CacheLocation="Session">
           <SelectParameters>
            <asp:ControlParameter ControlID="dllManufacturers" Name="ManufacturerId" PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
</llblgenpro:LLBLGenProDataSource>

The dropdowns are:

<asp:DropDownList ID="dllManufacturers" runat="server" AutoPostBack="True" DataSourceID="manufacturers"
        DataTextField="Manufacturer" DataValueField="ManufacturerId" AppendDataBoundItems="True">
        <asp:ListItem Value="0">select</asp:ListItem>
</asp: DropDownList>


<asp:DropDownList ID="ddlModels" runat="server" AppendDataBoundItems="True" AutoPostBack="True"
                    DataSourceID="models" DataTextField="Model" DataValueField="ModelId">
                    <asp:ListItem Value="0">select</asp:ListItem>
</asp:DropDownList>

Any ideas why this doesn't work? The error i get doesn't point to anywhere specific but says "An unhandled exception of type 'System.StackOverflowException' occured in mscorlib.dll"

Thanks in advance.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 16-Mar-2007 10:10:13   

Would you please try to remove the following line:

 <asp:ListItem Value="0">select</asp:ListItem>

from the ddlManufacturers? Since the second dataSource is filtering on the selectedValue of the ddlManufacturers.

Koolworld
User
Posts: 50
Joined: 10-Oct-2006
# Posted on: 16-Mar-2007 10:33:56   

Hi, it's still giving the same problem. When running in debugging mode within VS2005, it does hang around for about 10 secs and then the exceptions occurs, it suggests in the troubleshooting tips that it might be in an infinite loop.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 16-Mar-2007 15:44:01   

Which LLBLGen Pro runtimeLibrary version are you using?

Koolworld
User
Posts: 50
Joined: 10-Oct-2006
# Posted on: 16-Mar-2007 16:02:59   

Hi, im using the latest runtimes from your site, just downloaded and installed and still the same thing. Sometimes the exception occures in System.Data.dll sometimes in the other.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 17-Mar-2007 14:07:31   

Reproduced. Strange issue, I'm looking into it.

(edit). It was introduced in the feb 19th build, where an issue was fixed with a memory leak with re-using the same page over and over again. This seems unrelated but when testing the fix I ran into an issue where after a fetch, the datasource control didn't flag itself as changed in all cases, so you could have the situation where you had a grid and a formview bound to the same datasourcecontrol and when editing a row in the formview, the grid wasn't updated properly (data was added but the indexes inside the grid weren't).

I solved that by raising the changed event from the datasourcecontrol. After all, it did fetch data.

This however makes the 2 combobox stuff go into an infinite loop, as the fetch of the first triggers the re-check of the select parameters apparently by ASP.NET so the second combobox gets a new call to its select method and again filters, which apparently seems to trigger the first one again to filter.

So, long story short: I have to re-fix that issue where indexes weren't updated properly with the grid + formview setup as raising the event again isn't an option.

(edit). Ok, it's slightly different, but still causing the issue: the filtered combobox dives into an infinite loop because it gets a new trigger that it's changed, so the filter is REapplied, and whopla... it does a refetch on the same page.

I found the cause and compared with the objectdatasource code, I raised the events at the wrong spots (great documentation Microsoft has on how to create a datasourcecontrol with any real features: use a decompiler)... testing

(edit). Ok fixed it! smile

It's in build: 2.0.07.0317

I'll upload that build later today.

(edit) I've attached the new build to this post so you can continue with your work.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 17-Mar-2007 16:51:42   

I have to postpone the official release of the runtime libs till at least monday, as a bug in the Oracle DQE OR Oracle Driver for 10g has to be solved as well. (it depends on where the bug is best solved).

Either way, you can use the ormsupportclasses build I attached in my previous post to get this issue solved now.

Frans Bouma | Lead developer LLBLGen Pro
Koolworld
User
Posts: 50
Joined: 10-Oct-2006
# Posted on: 23-Mar-2007 10:36:57   

Hi, forgot to say thanks for getting this fixed so quickly, much appreciated.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 23-Mar-2007 11:54:06   

Koolworld wrote:

Hi, forgot to say thanks for getting this fixed so quickly, much appreciated.

No problem simple_smile the new build is now also on our website.

Frans Bouma | Lead developer LLBLGen Pro