|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
possible sqldatasource bugi 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. |
|||||||||||||||||||||||