Include The Hour , Minute And Second In DateTime.Now?
Dec 30, 2010i have used the Created_Date = DateTime.Now, to set the default value of a datebut i want that date to include inaddtion to the day the hour minutes and seconds
View 6 Repliesi have used the Created_Date = DateTime.Now, to set the default value of a datebut i want that date to include inaddtion to the day the hour minutes and seconds
View 6 Replies[Code]....
How to convert days into hours?
I have a DateTime column in my SQL database, how do I check if the Day in that is Today, or yesterday?
What I want to is something like: If date is today then the result would be "Today, at " same for yesterday..
I keep getting errors when I try to convert. I have a date row that when my page loads it displays as
1/28/2010 12:00:00 AM.
I have my default value set to '00:00:00" for it. I'm trying to convert it to 24 hour format so that it will read out as 00:00:00 initially. SQL Statement(The one that is working)
SELECT user_id, bpi_title, HoR, Date, Duration FROM tblViewLog2
JOIN tblBPIModules on tblViewLog2.module_id = tblBPIModules.id
I assume that I need to modify my SQL statement, but I'm having a hard time with the exact syntax. I'm trying to figure out exactly what I need to do with the information below in order to get what I want.
14 or 114
24 hour time with milliseconds.
HH:mm:ss:fff
21:00:00:000
I have just started with ASP.NET.
I like the idea of using Include files so that I can create various versions of individual parts of a site and decide in code which to display. I used:
<%Response.WriteFile("contentcontent.aspx")%>
to include a content.aspx file within my default.aspx page.
I would like to include a Left.aspx, Main.aspx and Right.aspx file inside the content.aspx file. I tried using the reponse.writefile function but noticed when I debug the website that the text "reponse.writefile..." displays instead of the code contained within the referenced file(s).
Can this not be done?
I have a Asp Mvc 2 site using forms authentication. When I run it locally I can log in and stay logged in indefinitely.
However when I put it on the server I seem to only stay logged in for a few minutes and then seems to be logged out. I have looked at the cookies and there are 2 which seem relevant:
.ASPXAUTH which is a session cookie .ASPXANONYMOUS which expires in 3 months.
When I refresh the page the cookies stay the same until I get logged out, when I seem to get a new .ASPXANONYMOUS cookie, but the .ASPXAUTH seems to be the same. It seems that I might be able to stay logged in until I do something after a certain amount of time. If I submit a form as soon as I am logged in then it works ok, but if I keep submitting data again and again then after a minute or so, one of the submits will happen as a logged out user and not as the user who was logged in, which all the other submits worked as. What might cause this behaviour and how can I track down what is different & change it so that I can stay logged in indefinitely?
its a single server, but after some more investigation and searching the likely candidate seems to be that I am using more than 100mb on the server and the application pool is getting recycled. I suppose now i need to know How can I check how much memory I'm using. What advice there is to reduce that.
I need to subtract one minute from the TimeOfDay
[Code]....
I want to update a Panel after every 2 minute in asp.net mvc. For that i tried to impletment Update panel and Timer as we do in simple Asp.net . But page not refreshing data in update panel in asp.net mvc. i dont know whether it is problem of timer or update panel.i added the events on aspx page using script tag. So is there any way to update the update panel only after sometime in asp.net mvc..
View 2 RepliesI want to add Mins column in Stored procedure .
ex - Mins(column)
3:10
4:20
5:10
2:30
Output should be 15:10
I have a SQL Server database which contains stock market quotes and other related data. This database needs to be updated at regular interval, say 1 minute. My question is: How do I get stock quotes every 1 minute and update it to database?
View 2 RepliesThis the code.
Cache.Insert(txtUserName.Text.Trim(), 1, null,
DateTime.Now.AddMinutes(1),
TimeSpan.Zero);
But Cache didn't expire after a minute.
I'm using ASP.NET MVC 3 with the Authorize attribute, but it keeps kicking me to the logon page after 1 minute, but even though my expiration is set to a very high value, it times out quickly. I check the cookie in my browser and its still there and not set to expire until about a month later, and it's set to be persistent, so I'm not sure why it keeps booting me. It only happens on my published location, locally it works just fine.
var ticket = new FormsAuthenticationTicket(username, true, 500000);
var encryptedTicket = FormsAuthentication.Encrypt(ticket);
var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
cookie.Expires = ticket.Expiration;
Response.Cookies.Add(cookie);
web.config:
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="7200" slidingExpiration="false"/>
</authentication>
i use asp.net and ajax
I have a button and I want to count that, how many times was the button clicked in 1 minute.if the user clicked the button more than 5 times in 1 minute it will be deny for 5 minute.
I have a scoreboard kind of application, In which the value of labels in the update panel has to be refreshed every minute.
View 3 Repliesi want to execute some code every one minute like i select * from customers , now for each row, i want that each row will execute after 1 minute , in asp.net web application not in windows application.
View 1 RepliesI took a copy of a website that works fine on a server (done have server access) but when I set up a website in IIS7 and run the classic asp code loading a page is taking nearly a minute. It always loads the pages but just takes forever.
View 1 RepliesI have a gridview which is taking values using template feild. ASP databound feild displays duration in my gridview as hour:minute:second .
Eg: 1:30:10 (1hour:30 minutes:10 seconds) . I want to change this to minutes only. that it should converted to 90 minutes , The actual value is 90 minutes 10 seconds, As it has 10 seconds more I want to display it as 91 minutes. Final result in gridvew should be 91 minutes.How can i do this ?
I heard that onrowdatabound can be used for this, if so how can i do it. how can i make use the onrowdatabound to make this work
My source page is as bellow
<asp:GridView id="GrdCallList" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="ObjectDataSource2"
Width="876px"
BackColor="#CCCCFF" BorderColor="Black" BorderStyle="Outset" BorderWidth="3px"
EnableViewState="False" Height="85px">
<columns>
<asp:BoundField DataField="Duration" HeaderText="Duration" SortExpression="Duration">
<HeaderStyle Wrap="False"></HeaderStyle>
I had a friend ask me about writing a program that would allow data entry and then run and display a report each day at 11:00 am. What is the best/easiest way to make the report run at a specified hour? He wants something that can run on a standalone (laptop) computer running windows xp. Most of my experience is with asp.net and c#.
View 4 Repliesi would like to add one hour to this two dates bellow:
DateTime sd = DateTime.Parse(calendar.m_Start.ToString());
DateTime ed = DateTime.Parse(calendar.m_End.ToString());
string strSD = sd.ToString("dd. MMM HH:mm", System.Globalization.CultureInfo.CreateSpecificCulture("oo-OO"));
string strED = ed.ToString("dd. MMM HH:mm", System.Globalization.CultureInfo.CreateSpecificCulture("oo-OO"));
They are output here:
Response.Write(" <start_time>" + Server.HtmlEncode(strSD) + "</start_time>" + Environment.NewLine);
Response.Write(" <end_time>" + Server.HtmlEncode(strED) + "</end_time>" + Environment.NewLine);
in my web site there ar 4 links i want when user login on my site after 20 minute automatcaly logoff and go to home page using session?
View 11 RepliesI am developing an intranet web application. i am using asp.net,C# and MS sql. Now i want to make everyone hour to bring a grid view page with lists of names whose contractperiod is expiring soon. So how do I make an asp.net page to be pop up every hour.
View 2 RepliesI created a UserControl and added a public DateTime property. I want to set this property in Markup (ie. <cc1:MyControl runat="server" id="MyControl1" DateTimeProp="1/1/2010" /> ) however I live in a place with a dd/mm/yyyy date format so it complains if I set something like "20/1/2010". Is there a way to set markup in my local datetime format or do I have to conform to "mm/dd/yyyy"?
View 2 RepliesI have a problem:
I've created usual Controller and View(Edit view) for editing my Entity (EntityFramework)
Here is view example:
<div class="editor-field">
@Html.EditorFor(model => model.BirthDate)
@Html.ValidationMessageFor(model => model.BirthDate)
</div>
BirthDate is Nullable<DateTime>
but during loading my View I get this exception
The model item passed into the dictionary is null, but this dictionary requires a non-null model item of type 'System.DateTime'.
That's because of BirthDate is null in database but it is nullable and I expect that it just leaves the filed empty.
And I have Shared EditorTemplate:
@model System.Nullable<System.DateTime>
@if (Model.HasValue)
I have an XML string which contains Dates formatted "dd/MM/yyyy hh:mm:ss".
I'm loading this XML into a dataset using DataSet.ReadXml().
How can I ensure that this Date is stored in the DataSet as a typed DateTime so that I can Sort, Format and RowFilter on it accordingly.
My test harness is as below:
ASPX Page:
[code]....
obj.From = DateTime.Parse(txtFrom.Text, ci);
And it will give error String was not recognized as a valid DateTime. How it can be solved..