Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   one objectdatasource for multiple listboxes (http://www.velocityreviews.com/forums/t594198-one-objectdatasource-for-multiple-listboxes.html)

bugmenot 02-26-2008 03:48 AM

one objectdatasource for multiple listboxes
 
I'm trying to get an objectdatasource to bind data to 2(to start) different listboxes. The selectmethod is the same but the parameter values are different and are determined by the listbox being populated.

I'd prefer that as much coding be in the code behind file(C#).
Right now i can get the objectdatasource to populate both listboxes, but when one listbox is populated the other gets the same data. I want it to retain the data that it already had. the objectdatasource should only populate one listbox.

objectdatasource
Code:

<asp:ObjectDataSource ID="ObjectDataSource2"  TypeName="dataType"  runat="server" > </asp:ObjectDataSource>
code behind:
Code:

if (!listb.Visible)
        {
            switch (clicked.ID.ToString())
            {
                case "btnAdd":
                    ObjectDataSource2.SelectParameters["arg1"].DefaultValue="data1";
                    ObjectDataSource2.SelectParameters["arg2"].DefaultValue = "data2";
                    ObjectDataSource2.SelectParameters["arg3"].DefaultValue = "data3";
                    break;
                case "btnAddTeam":
                    ObjectDataSource2.SelectParameters["arg1"].DefaultValue = "data1";
                    ObjectDataSource2.SelectParameters["arg2"].DefaultValue ="data2";
                    ObjectDataSource2.SelectParameters["arg3"].DefaultValue = "data3";
                    break;
            }
            clicked.Text = DONE;
            listb.Visible = true;
        }



All times are GMT. The time now is 09:37 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.