possible sqldatasource bug

Discussion in 'ASP .Net Web Controls' started by Abraham Andres Luna, Aug 17, 2006.

  1. hello everyone,

    i am attempting to set the selectcommand in the SqlDataSource.Selecting
    event. so far it has not worked. here is my code:

    <%@ Page %>
    <script runat="server">
    void SqlDataSource1_Selecting(Object Sender,
    SqlDataSourceSelectingEventArgs E)
    {
    E.Command.CommandText = "SELECT * FROM INVENTORY"
    }
    </script>
    <html>
    <head>
    <title>Inventory</title>
    </head>
    <body>
    <form runat="server">
    <asp:gridview id="GridView1" runat="server"
    datasourceid="SqlDataSource1" />
    <asp:sqldatasource id="SqlDataSource1" runat="server"
    onselecting="SqlDataSource1_Selecting" />
    </form>
    </body>
    </html>

    if i set the selectcommand on the asp tag, then the data will be bound.
    according to the documentation, the selecting event is fired before the data
    is selected, allowing to manipulate the statement. i did some testing and i
    thing that the selecting event is not fired unless the page is posted back.
    please help me in figuring out how and when to set the selectcommand. i need
    to some advanced filtering and i dont think that the selectparamters will
    let me do "SELECT * FROM INVENTORY WHERE DATECREATED BETWEEN '' AND ''".

    thank you for your help.
    Abraham Andres Luna, Aug 17, 2006
    #1
    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. Markus
    Replies:
    1
    Views:
    456
    Markus
    Nov 22, 2005
  2. Steve Holden
    Replies:
    1
    Views:
    382
    Behrang Dadsetan
    Jul 2, 2003
  3. Replies:
    4
    Views:
    281
    Kenny McCormack
    Feb 21, 2006
  4. Replies:
    10
    Views:
    469
    Chris Gonnerman
    Dec 14, 2007
  5. Michael Fellinger
    Replies:
    3
    Views:
    144
    Michael Fellinger
    Dec 27, 2007
Loading...

Share This Page