in
Forums
Blogs
Files
Devexpress.Com
Client Center
Support Center
DevExpress Channel

Passing Parameters To Datasource

Last post 11/3/2008 9:18 PM by Mehul Harry (Developer Express). 1 replies.
Page 1 of 1 (2 items)
Sort Posts:
Previous Next
  • 10/13/2008 3:48 PM

    Passing Parameters To Datasource

    Ok I have a drop down list populated with user names.  I want my end user to be able to select a user name and then have it update the calendar with the user's calendar info.

    My SqlDataSource is somethign like select * from xxx where username=@userName

    How do I pass that DropDownList1.SelectedValue to the Sql statement? 

  • 11/3/2008 9:18 PM In reply to

    Re: Passing Parameters To Datasource

    Hi Ron,

    Click the smart tag of the datasource (in design view) and you can setup the datasource to lookup the value of the control. In the code below, the datasource will look for the categoryid from the spinedit control:

            <asp:AccessDataSource ID="AccessDataSource1" runat="server" 

                DataFile="~/App_Data/nwind.mdb" 

                

                SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Categories] WHERE ([CategoryID] = ?)">

                <SelectParameters>

                    <asp:ControlParameter ControlID="ASPxSpinEdit1" DefaultValue="1" 

                        Name="CategoryID" PropertyName="Number" Type="Int32" />

                </SelectParameters>

            </asp:AccessDataSource>

Page 1 of 1 (2 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED