473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

databinding for datetime datatype

How to define databinding for 'datetime' data type ?

( Xxx = '<%# Bind("Datetime") %>' )

Thank you.

Pen
Apr 10 '07 #1
7 5750
On Apr 10, 7:52 pm, Pen Juan <l...@hotmail.comwrote:
How to define databinding for 'datetime' data type ?

( Xxx = '<%# Bind("Datetime") %>' )

Thank you.

Pen
Do you mean

<%=DateTime.Now()%>

?

Apr 10 '07 #2
Yes. What is lvalue (not TextBox or Checked) ?

Thank you.
--
Pen
"Alexey Smirnov" wrote:
On Apr 10, 7:52 pm, Pen Juan <l...@hotmail.comwrote:
How to define databinding for 'datetime' data type ?

( Xxx = '<%# Bind("Datetime") %>' )

Thank you.

Pen

Do you mean

<%=DateTime.Now()%>

?

Apr 10 '07 #3
On Apr 10, 8:32 pm, Pen Juan <l...@hotmail.comwrote:
Yes. What is lvalue (not TextBox or Checked) ?
Can you rephrase the question, please?

Apr 10 '07 #4
I am trying to use either 'Bind' or 'Eval' to store (insert a record) the
DateTime.now() info to SQL 2005 database table through the FormView.

Thank you.

--
Pen
"Alexey Smirnov" wrote:
On Apr 10, 8:32 pm, Pen Juan <l...@hotmail.comwrote:
Yes. What is lvalue (not TextBox or Checked) ?

Can you rephrase the question, please?

Apr 10 '07 #5
On Apr 10, 9:56 pm, Pen Juan <l...@hotmail.comwrote:
I am trying to use either 'Bind' or 'Eval' to store (insert a record) the
DateTime.now() info to SQL 2005 database table through the FormView.
I think you have to specify the type of your variable

<UpdateParameters>
<asp:Parameter Name="Datetime" Type="DateTime" />

.....

( Xxx = '<%# Bind("Datetime") %>' )

Apr 10 '07 #6
I think it is:
<InsertParameters>
<asp:Parameter Name="Datetime" Type="DateTime" />
</InsertParameters>
But, how to define the two-way binding in FormView and code-behind (onClick)
for the 'xxx', 'yyy', 'Zzz' and 'aaa' shown below:

<asp:xxx ID="Datetime1" runat="server"
yyy='<%# Bind("Datetime") %>'
Visible="False">
</asp:xxx>
The code behind is something like:
Zzz var = (Zzz) FormView1.Row.FindControl("Datetime1");
var.aaa= System.DateTime.Now();

Thank you

--
Pen
"Alexey Smirnov" wrote:
On Apr 10, 9:56 pm, Pen Juan <l...@hotmail.comwrote:
I am trying to use either 'Bind' or 'Eval' to store (insert a record) the
DateTime.now() info to SQL 2005 database table through the FormView.

I think you have to specify the type of your variable

<UpdateParameters>
<asp:Parameter Name="Datetime" Type="DateTime" />

.....

( Xxx = '<%# Bind("Datetime") %>' )

Apr 10 '07 #7
On Apr 10, 11:00 pm, Pen Juan <l...@hotmail.comwrote:
I think it is:
<InsertParameters>
<asp:Parameter Name="Datetime" Type="DateTime" />
</InsertParameters>

But, how to define the two-way binding in FormView and code-behind (onClick)
for the 'xxx', 'yyy', 'Zzz' and 'aaa' shown below:

<asp:xxx ID="Datetime1" runat="server"
yyy='<%# Bind("Datetime") %>'
Visible="False">
</asp:xxx>

The code behind is something like:
Zzz var = (Zzz) FormView1.Row.FindControl("Datetime1");
var.aaa= System.DateTime.Now();

Thank you

--
Pen

"Alexey Smirnov" wrote:
On Apr 10, 9:56 pm, Pen Juan <l...@hotmail.comwrote:
I am trying to use either 'Bind' or 'Eval' to store (insert a record) the
DateTime.now() info to SQL 2005 database table through the FormView.
I think you have to specify the type of your variable
<UpdateParameters>
<asp:Parameter Name="Datetime" Type="DateTime" />
.....
( Xxx = '<%# Bind("Datetime") %>' )- Hide quoted text -

- Show quoted text -

I think you should get the date from the data source. SQL Server has
the GetDate() function to get the date and time of the DB-server. You
can use that function in your SqlDataSource, for example "SELECT ....,
getdate() as Datetime FROM....

After that, I think, you will be able to bind that field in the
FormView.

I'm not sure if it's working, please test.

If it is working, I must say, it makes no sense. You can always use an
INSERT query with the getdate() function without binding a FormView to
any date control...

Apr 10 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Richard | last post by:
Hi, I have a DateTime picker control on a form. The datetime picker control is data bound to a column in a DataTable. Yes I know about bound DateTime pickers and DBNull and etc. so no troubles...
11
by: Mark Rae | last post by:
Hi, I have a class with several properties, one of which is of the DateTime datatype. However, this property will not always have a value, and I need to check later whether it has a value or...
6
by: eye5600 | last post by:
Is there a cure for the problems using databinding with a DateTimePicker? I find that a) sometimes it works, sometimes it doesn't, and b) it fails silently causing all databinding on the DataSet...
9
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
0
by: vijayalakshmi.venkataraman | last post by:
Hello, I have a .NET client that accesses a Java webservice. Let me first say that the client stub I got generated from the wsdl was incomplete and had to make changes to it manually to make it...
1
by: Zak Lomakus | last post by:
Hi, From my main page (default.aspx) I am calling another .aspx (e.g. otherpage.aspx) page through Javascript using window.showModalDialog. otherpage.aspx has a databoud control (webchart),...
4
by: Mohan | last post by:
In the database, we are storing time in 3 columns: hours, Minutes and AM,PM. After retrieving it from the database, I want to load these values into a DateTime variable. I haven't had much...
8
by: Dirk | last post by:
Hello, I have a problem to use databinding with my business layer classes. My data class does not have simple properties (string, int or datetime), instead, all my properties are objects of the...
11
by: Matt F | last post by:
I'm trying to do something that seems like it should be pretty simple, but haven't found a solution. I am trying to add a datacolumn to a datatable that adds or subtracts a number of days based on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.