Given a DropDownList box [ddlHour] and a DateTime variable [dtSelected].
I want to update the hour in dtSelected.hour with the ddlHour.SelectedValue however when I try to do the following directly:
dtSelected.Minute = ddlMinute.SelectedValue;
I get the following error:
1) Cannot implicitly convert type 'string' to 'int'
2) Property or indexer 'System.DateTime.Hour' cannot be assigned to -- it is read only
So I guess I have 2 questions; how could I convert the string returned by ddlHour.SelectedValue into an Integer so I can update the dtSelected.hour AND why am I seeing that read-only error? Am I not doing this right at all?
Enter your message below
Sign in or Join us (it's free).