Hello!
I have a table in an SQL database, in which I have a field in datetime format.
In my aspx page I would like to get the date the user chooses from an asp: calendar I have and submit it to the DB.
I already have all the code ready, the datasource, the gridview, all other fields to submit, and I just added a template field with the asp:calendar so that the user could choose a date.
I′m getting this error when I run the page: "Conversion from type 'Date' to type 'Boolean' is not valid."
It seems to be a problem about the date that is given by the Calendar object (?) and the one I should submit to my DB.
Here′s the part of the code where I have my standard Calendar binded to the correspondant field:
<asp:Calendar ID="Calendar1" runat="server" SelectedDate='<%# Bind("data")%>' Visible='<%# Eval("data")%>'></asp:Calendar>
I′m gessing I should probably change the format of the date somehow before submit it to the DB, but how?
Thank you all,
RR
Format(dateVariable,"MM/dd/yyyy")
|||
sorry the noobness, but where can I do that?
in a script section in the beginnig of the page?
|||You have bound the "data" column to both the SelectedDate and the Visible property. SelectedDate is of type Date, and Visible is of type Boolean. What datatype is the "data" column?
|||You′re asking about the datatype in the db, right?
It′s datetime. (don′t know if it′s the best datatype, any advise here?) I only need a data like DD-MM-YYYY but when building my table in SQL, I have no format like this...
An update to this issue, I erased the visible property and the page at least runs, but no connection between the calendar and my field... maybe it′s better to explain my objective:
What I would need is a gridview where I can see my records. (done)
In the default view I would see all the fields in normal textboxes, (ok!, done)
When clicking insert new or edit, I would like to let the user choose a date from the calendar!
Can anyone help me to buid a thing like this?
THKS
No comments:
Post a Comment