possible sqldatasource bug

  • Thread starter Abraham Andres Luna
  • Start date
A

Abraham Andres Luna

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top