G
gsauns
Hello,
I have an ASP.NET app with a DropDownList on the page, which is bound
to values from a table. I have a Repeater control on the page whose
displayed data is dependent on the DropDownList value selected by the
user. (The DataTextField is a Datetime concatenated with a string).
On the Page_Load event, if it's not a postback, I would like the
DropDownList to programmatically be set to the next occurring day in
the DropDownList (the date values are in the table in fairly regular
weekly intervals). For example, if today is 8/23/07, I would like,
upon opening the page, the DropDownList to select 8/25/07 (if that is
the next occurring day in the data) and display the appropriate data
below.
I'm having no luck... any help?
-Here's my ASP.NET code for the controls:
<asp:SqlDataSource ID="sqldsDayList" runat="server" ConnectionString="<
%$ ConnectionStrings:ConnectionStringNew %>"
SelectCommand="SELECT [key], CONVERT(varchar(10), [day_dt], 1) + ' - '
+ [day_cd] As Day FROM
"></asp:SqlDataSource>
<aspropDownList ID="ddlDaySelect" runat="server"
DataSourceID="sqldsDayList" DataTextField="Day" DataValueField="key"
AutoPostBack="true">
</aspropDownList>
<!--- For the repeater: -->
<asp:SqlDataSource ID="sqldsCreds" runat="server" ConnectionString="<%
$ ConnectionStrings:ConnectionStringNew %>"
SelectCommand="SELECT * FROM Credit">
</asp:SqlDataSource>
<asp:Repeater ID="rptrCredListing" runat="server"
DataSourceID="sqldsCreds">
-And now the C# code for my ddlDaySelect.OnSelectedIndexChanged:
sqldsCreds.SelectCommand = "SELECT Credit.*, Type.credit_type AS
credit_type FROM Credit, Type WHERE Credit.ctype_id = Type.ctype_id
AND key=" + ddlDaySelect.SelectedValue AND created = '" +
(string)Session["Username"] + "'";
I have an ASP.NET app with a DropDownList on the page, which is bound
to values from a table. I have a Repeater control on the page whose
displayed data is dependent on the DropDownList value selected by the
user. (The DataTextField is a Datetime concatenated with a string).
On the Page_Load event, if it's not a postback, I would like the
DropDownList to programmatically be set to the next occurring day in
the DropDownList (the date values are in the table in fairly regular
weekly intervals). For example, if today is 8/23/07, I would like,
upon opening the page, the DropDownList to select 8/25/07 (if that is
the next occurring day in the data) and display the appropriate data
below.
I'm having no luck... any help?
-Here's my ASP.NET code for the controls:
<asp:SqlDataSource ID="sqldsDayList" runat="server" ConnectionString="<
%$ ConnectionStrings:ConnectionStringNew %>"
SelectCommand="SELECT [key], CONVERT(varchar(10), [day_dt], 1) + ' - '
+ [day_cd] As Day FROM
<aspropDownList ID="ddlDaySelect" runat="server"
DataSourceID="sqldsDayList" DataTextField="Day" DataValueField="key"
AutoPostBack="true">
</aspropDownList>
<!--- For the repeater: -->
<asp:SqlDataSource ID="sqldsCreds" runat="server" ConnectionString="<%
$ ConnectionStrings:ConnectionStringNew %>"
SelectCommand="SELECT * FROM Credit">
</asp:SqlDataSource>
<asp:Repeater ID="rptrCredListing" runat="server"
DataSourceID="sqldsCreds">
-And now the C# code for my ddlDaySelect.OnSelectedIndexChanged:
sqldsCreds.SelectCommand = "SELECT Credit.*, Type.credit_type AS
credit_type FROM Credit, Type WHERE Credit.ctype_id = Type.ctype_id
AND key=" + ddlDaySelect.SelectedValue AND created = '" +
(string)Session["Username"] + "'";