How To Change The Hour Property Of Date.now
Sep 6, 2010i want to change the hour that i get from date.now because the server is in different country and we have 2 hours difference.
View 19 Repliesi want to change the hour that i get from date.now because the server is in different country and we have 2 hours difference.
View 19 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);
I have requirement to show time in 24 hour format.
Right now code is like this
PorudctInfo.ReturnDate.ToString("yyyy-MM-ddThh:mm:ss").
Right now for eg return date time is "2010-11-17T01:15:00"
I want it in 24 hour format I should get it 13:15:00 format
How can I change a date to orcle date format? I am developing a web application using csharp. I am typing a date in a text box control as dd-mmm-yyyy. Now when I submit it is giving an error saying that date is not in a correct format. The code I am using is below. How can ensure that date is in a acceptable format to oracle sql?[Code]....
View 3 Replies I am using this code to generate the current date to label.
Label14.Text = DateTime.Now.ToString
It output as 5/27/2010 10:31:53 AM
However I want only 5/27/2010
How should I change this code ?
I am using Jquery datepicker in a textbox...if user want to type the date in the format of 12202010 needs to convert to 12/20/2010...
I didn't it on the server side...but its always doing a postback once i got the focus on the textbox...
I just want to do it on the client side using jquey...
Is there a property for clear date in ajax calendar
View 2 RepliesSql Server 2008 introduced a number of new data types. One of those types is Date. I have been trying to find the C# equivalent of the Date data type. Before I start using the Date data type I have a few questions. Am I correct that I still need to use the DateTime Data type in C# when mapping data to and from Sql Server? I am using Linq to Sql. Are there any conversion issues that I need to be aware of when mapping the Sql Server Date into and out of a C# DateTime property?
View 2 RepliesSome strange problem have occured while developing application. Some WCF webservice returns object with date property.On client this web service is called using Jquery.ajax.Then result is parsed using json2.For date I simply use following expressions:
var reMsAjax = /^/Date((d|-|.*))[/|\]$/;
a = reMsAjax.exec(value);
if (a)
var b = a[1].split(/[-+,.]/);
return new Date(b[0] ? +b[0] : 0 - +b[1]);
unfortunatelly if browser timezone differs simple new Date with milliseconds not works.Time will be based on timezone.
I am getting error message: The value '31/12/2050' of the MaximumValue property of 'RangeValidator1' cannot be converted to type 'Date'
Asp.net pages were working fine before but after reinstalling the VS2008 on new machine and copied the old pages to new machine i am getting this error message.
I have multiple .sitemap xml defined with different providers. For one xml file, I want to change the url (append Customerid in the url) by taking the defined url in xml file. I want this to be changed when the page is loaded the first time.
For eg one of my node is
<siteMapNode
url="~/CustDetail.aspx?type=Contact"
title="Contacts"
description="Contacts">
And I want to make it as
<siteMapNode
url="~/CustDetail.aspx?type=Contact&CustID=ABCD"
title="Contacts"
description="Contacts">
I have read many articles online talking about changing node in memory but cant make it work.
I get this error when I try to have my C# class change the skin of an asp control:
The 'SkinId' property can only be set in or before the Page_PreInit event for static controls. For dynamic controls, set the property before adding it to the Controls collection.
My goal is to provide a panel, call it ID="response", on every page, and then dynamically change it's CSS class from Error to Success, or Success to Error (so it's red or green). And also I make it visible = true, when a response is created.
Apparently, I am forced to use CssClass attribute, which is the only way this will work.
As a side-off-topic note: In PHP, you would not have a problem of using different "pre-init" "post-init" etc. A completely unnecessary process. You would simply change the html before you send it back to the user. I'm a bit confused why ASP.NET decides to overcomplicate everything. It's a bit silly for me to take time to learn all these different complicated processes to simply display a webpage. It takes time to learn all the quirks written in difficult-to-read ASP life-cycle documents on microsoft. Not to insult any microsoft people, but it's just not practical.
I'm trying to use PostBackUrl on my asp.net form (insert mode) to go back to previous page. I'm hoping to use Request.UrlReferrer.AbsoluteURL or similar.The difficulty I have is how to assign value to link button (called InsertButton) property "PostBackURL".
Some examples show simply InsertButton.PostBackUrl = Request.UrlReferrer.AbsoluteURL but it my case it doesn't recognize the control. I'm using VS 2010 with asp.net 4.0
In an ASP.NET 3.5 VB web app, I successfully manage to cache an object containing several personal details such as name, address, etc. One of the items is CreditNum which I'd like to change in the cache on the fly. Is there a way to access this directly in the cache or do I have to destroy and rebuild the whole object just to change the value of objMemberDetails.CreditNum?The cache is set using:
Public Shared Sub CacheSet(ByVal key As String, ByVal value As Object)
Dim userID As String = HttpContext.Current.User.Identity.Name
HttpContext.Current.Cache(key & "_" & userID) = value
End Sub
I have Connected an XmlDtaSource to a TreeView with checkboxes.I want to populate the user permissions in that.
<asp:TreeView ID="TreeView1" runat="server" ExpandDepth="2"
ShowCheckBoxes="All" ShowLines="True">
<DataBindings>
<asp:TreeNodeBinding ValueField="Value" DataMember="menuNode" TextField="title" />
I tried this javascript but it doesn't work - here
I need to change the button's enabled property to true when the checkbox is checked and to false when it isn't. This is my code.
[Code]....
i am unable to change the selectedindex property to 0 it is coming as -1 only and the code wat i am using is
if (lstintellisense.SelectedIndex.ToString() == "-1")
{
lstintellisense.SelectedIndex = 0;
}
after making 0 also its remaining as -1 only and i am getting exception as InvalidArgument=Value of '0' is not valid for 'SelectedIndex'. Parameter name: SelectedIndex
Is there a way to change the properties on the textboxes that are outputed by the TextBoxFor method in MVC 2 RC?
View 9 RepliesI have a form with a detailsview control and I want to validate if a particular index is selected in a a dropdown.I can set the causesValidation property on the controls in the dropdown control in it's selected index changed event but once it is set, lets say someone selected the wrong index on the DDL and now they want to change it before updating they are stuck in validate Hell. Here is my code from the relevant details rows, the row with the DDL that causes the validation and it's selected index changed event.
[Code]....
[Code]....
[Code]....
[Code]....
This property was originally set in the aspx file, however I want to change it to select programatically on page load. I set the Pager.PagedControlID property, but I receive the following error message on this line:
Pager.PageSize = Convert.ToInt32(ListLength);
Page properties cannot be set because no IPageableItemContainer has been found. The ID I am using I copied and pasted out of the inline aspx and I checked it is correct.
I'm trying to programaticaly change the 'headerText' property of a GridView boundfield.
[Code]....
Apparently all goes weel, because i ca see, in a a debug session, the control initial value, and after i change it, the value changes.
I'm trying to use the menu control for the first time in ASP.NET and everything is fine except for the fact that I can't seem to change the item spacing property. My menu is a horizontal menu where the menu items have come from a sitemap file. I've tried changing the menu item spacing in both the dynamic and state menu item properties but nothing seems to change it. I've also tried changing the item spacing via css but that doesn't work either.
[Code]....
I came to know that we can pass values from one page to another. What I wanted was 'on click of a button on admin.aspx webpage , the button on user.aspx page gets invisible'
After creating the instance and trying to do so, the error occured which said-"due to security the button cannot be accessed on user.aspx from admin.aspx"
Even if all the above what I did was wrong, I request you to suggest me how can I change the property of a button on webform1 from webform2 ( this is the admin.aspx page in which i have logged in) to invisible. And whosoever accesses the webform1 gets the same property (i.e. invisible) untill i click on the button in webform2 that again turns the property of the button in webform1 as visible.
I have a table with a date field that had date saved in the format of yyyy-mm-dd, what i want to achieve is when I display them I want them to be displayed as an example "September 05 2009" format.
View 1 RepliesI am getting date on my aspx page as
10/22/2010 11:52:07 AM
How can i change the format so that i becomes:
22 Oct 2010 11:52 AM