开发者

Take the datepicker value

i have a gridview that dynamically generate datepicker , i have taken the value of datepicker using

GMDatePicker dtp = (GMDatePicker)Gridview1.Rows[rowIndex].Cells[3].FindControl("frmdate_starttime");

and i have inserted using dtp.Date,while storing in the database it only store the date and not the time开发者_如何学Python. how to retrive the time to save in database along with date


You can change the Format property to Custom and the CustomFormat property to what you require, something like dd MMM yyyy hh:mm.

You should then be able to use

DateTime dt = dateTimePicker1.Value;

to get the date and time.


Split the problem into two parts: are you getting the right value out of the control but failing to save/restore it in the database correctly, or are you failing to get the right value out of the control in the first place? Once you've worked out whether it's a UI or database problem, you can ignore the other half of it.

Have you enabled the time picker in the control?

What column type are you using in the database?

If you run your application in the debugger, what value do you see before you store it in the database?

If you run a query against the database in the relevant admin tool, does that show a time?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜