Results 1 to 9 of 9

Thread: Call & display SQLDataSource variable.

  1. #1
    Hyperactive Member
    Join Date
    Feb 07
    Posts
    332

    Call & display SQLDataSource variable.

    I would like to call and display the selection that is being used as my SQLDataSource

    What is the command that will display it and give me some formating control?


    Code:
    <b>Defensive Boxscore - Select Team:</b>
        <asp:DropDownList ID="DropDownList2" DataSourceID="SqlDataSource4" AutoPostBack="true"
          DataTextField="defense" runat="server" />
        <asp:SqlDataSource ID="SqlDataSource4" runat="server" SelectCommand="SELECT DISTINCT [defense] FROM [cfb_boxscores] ORDER BY [Defense]"
          ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>" />
    Last edited by ggodwin; Apr 21st, 2008 at 09:03 AM. Reason: better sybject

  2. #2
    Hyperactive Member
    Join Date
    Feb 07
    Posts
    332

    Re: Call & display SQLDataSource variable.

    bump

  3. #3
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: Call & display SQLDataSource variable.

    Handle the SqlDataSource's selecting or selected event.

  4. #4
    Hyperactive Member
    Join Date
    Feb 07
    Posts
    332

    Re: Call & display SQLDataSource variable.

    Basically the selected event.
    I just want to be able to display what the user selects to make it clear what they are looking at.

  5. #5
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: Call & display SQLDataSource variable.

    So if it's from the dropdownlist why don't you just display what's selected in the dropdown?

  6. #6
    Hyperactive Member
    Join Date
    Feb 07
    Posts
    332

    Re: Call & display SQLDataSource variable.

    I am doing that now.
    But I would like to put some text above my gridview to explain what is being viewed.

  7. #7
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: Call & display SQLDataSource variable.

    You aren't explaining your problem very well. What do you have now and what do you want?

  8. #8
    Hyperactive Member
    Join Date
    Feb 07
    Posts
    332

    Re: Call & display SQLDataSource variable.

    I Just want to be able to show what the current value is that the user selected.

    http://visualboxscore.com/boxscores/NCAA_football.aspx

    On the above web link you will see the user choices.
    They may choose Example:

    Michigan.
    Just above the grid I want to display this Name "Michigan".
    Keep in mind the page you are seeing is not my final one. This is just a pilot while I learn this stuff. I thought it would be a simple command that I could put in.

  9. #9
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: Call & display SQLDataSource variable.

    Right. Have a label sitting somewhere above the grid, and in the page load event, if it is a postback, read the value in the dropdownlist. Then put that into the label. You can even concatenate a string for it.

    Label1.Text = "You are currently viewing: " + DropDownList1.SelectedItem.Value

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •