asp.net 2.0, setting parameters for datasource

J

johnnyD

I am creating a page which displays a customers billing history.

As such it uses a datasource which queries the billing table.
This works fine, and outputs desired information I need. I need the
datasource parameters to show only todays information as a default.

And when i enter dates into 2 textboxes, i want the page to postback,
but use the values from these text boxes.


Code for Text Boxes
<asp:TextBox ID="txt_StartDate" runat="server" Style="z-index: 100;
left: 15px; position: absolute;
top: 82px"></asp:TextBox>
<asp:TextBox ID="txt_EndDate" runat="server" Style="z-index: 101; left:
270px; position: absolute;
top: 82px"></asp:TextBox>
<asp:Button ID="btn_getData" runat="server" Style="z-index:
111; left: 522px; position: absolute;
top: 80px" Text="Go" Visible="False"
PostBackUrl="~/dashboard/billingHistory.aspx" />


Code for DataSource
<asp:SqlDataSource ID="sqlds_CallHistory" runat="server"
ConnectionString="<%$ ConnectionStrings:myConnectionString %>"
SelectCommand="sp_getCallHistory" SelectCommandType="StoredProcedure"
DataSourceMode="DataReader" >
<SelectParameters>
<asp:SessionParameter Name="userName" SessionField="username"
Type="String" />
<asp:ControlParameter ControlID="txt_StartDate" Name="dateStart"
PropertyName="Text"
Type="DateTime" />
<asp:ControlParameter ControlID="txt_EndDate" Name="dateEnd"
PropertyName="Text"
Type="DateTime" />
</SelectParameters>
</asp:SqlDataSource>



When i click the button control, i want the page to postback, and use
the dates in my textboxes as the dateStart and dateEnd
SELECTPARAMETERS.

Any help would be appreciated. If you need more information to be of
assistance, please let me know.


Thanks all.
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top