aspx.vb SqlDataSource

Discussion in 'ASP .Net' started by prontoo, Dec 5, 2005.

  1. prontoo

    prontoo Guest

    Hello,

    I dont know how to get a recordset from sqldatasource with
    selectcommand and put in standard listbox (not html) when i press the
    standard button.

    Thank you
     
    prontoo, Dec 5, 2005
    #1
    1. Advertising

  2. prontoo

    Guest

    Not sure what not HTML means or what standard button means, but...

    You can think of the .NET 2.0 data sources controls as being akin to
    the select statements themselves. That is, you "hit go" and BAM
    something happens.

    If you want automatical binding all you have to do is this...

    <asp:ListBox ID="lstMyStuff" runat="server"
    DataSourceID="sdsMyStuff" DataTextField="Something"
    DataValueField="SomethingElse"></asp:ListBox>
    <asp:SqlDataSource id="sdsMyStuff" runat="server"
    SelectCommand="select * from..."></asp:SqlDataSource>


    If you want this to be on demand, do the same with
    lstMyStuff.DataBind( ) in the code behind.

    If you don't want the list to show until button, have this in the code
    behind.

    lstMyStuff.Visible = true
    lstMyStuff.DataBind( )

    with the list set to Visible="false" in the declarative code.

    David Betz
    http://www.davidbetz.net/dynamicbliss/
    http://www.davidbetz.net/winfx/
     
    , Dec 6, 2005
    #2
    1. Advertising

  3. prontoo

    prontoo Guest

    Thank you it's work. But I have one question more. How kan I change the
    selectcommand on sqldatasource from standard (not html) button on event
    click.

    Thank you once again.


    напиша:
    > Not sure what not HTML means or what standard button means, but...
    >
    > You can think of the .NET 2.0 data sources controls as being akin to
    > the select statements themselves. That is, you "hit go" and BAM
    > something happens.
    >
    > If you want automatical binding all you have to do is this...
    >
    > <asp:ListBox ID="lstMyStuff" runat="server"
    > DataSourceID="sdsMyStuff" DataTextField="Something"
    > DataValueField="SomethingElse"></asp:ListBox>
    > <asp:SqlDataSource id="sdsMyStuff" runat="server"
    > SelectCommand="select * from..."></asp:SqlDataSource>
    >
    >
    > If you want this to be on demand, do the same with
    > lstMyStuff.DataBind( ) in the code behind.
    >
    > If you don't want the list to show until button, have this in the code
    > behind.
    >
    > lstMyStuff.Visible = true
    > lstMyStuff.DataBind( )
    >
    > with the list set to Visible="false" in the declarative code.
    >
    > David Betz
    > http://www.davidbetz.net/dynamicbliss/
    > http://www.davidbetz.net/winfx/
     
    prontoo, Dec 10, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gerry O'Brien [MVP]
    Replies:
    0
    Views:
    523
    Gerry O'Brien [MVP]
    Apr 11, 2004
  2. vish
    Replies:
    2
    Views:
    1,781
    Steve C. Orr, MCSD
    Jul 16, 2003
  3. John M
    Replies:
    1
    Views:
    1,310
    Kumar Reddi
    May 29, 2005
  4. Casper
    Replies:
    4
    Views:
    742
    Casper
    Feb 7, 2007
  5. Casper
    Replies:
    4
    Views:
    811
    Casper
    Feb 7, 2007
Loading...

Share This Page