How To Include Time
Sep 23, 2010my requirement is showing the clock in asp.net {this should show all hh:mm:ss}....
View 4 Repliesmy requirement is showing the clock in asp.net {this should show all hh:mm:ss}....
View 4 RepliesI 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?
My web application has hosted on the canada server but my all clients are indians.So, as I am using System.datetime.Now to store all the dates in application.Obviously, it is displaying the canadian time instead of india time.How can i do it?Is there not any gloabl settings that we can do in our web.config file so that it indicates to the server at run time which time zone to execute..?Or any other suitable alternate?
View 3 Repliesi have to listen my mail server for every 30 min. i have a distribution list and i want to count number of email comes for that distribution list and no of replies goes from the outlook for every 30 minutes. also i need to get the time difference between the replied time with arrived time of the mail. so show me some sample code
View 3 RepliesAnyone know how to format a TIME COLUMN in SQL 08 to regular time and not military time? VB.net
View 2 RepliesI'm using Telerik's RadScheduler Control with WebService Binding.
I've used RadScheduler with Server Side Binding which has an event called "OnTimeSlotCreated" which fires every time when a particular time slot creates so that i can access the time slot and get the control (HtmlTableCell Control) to modify it according to the requirement.
But now i'm binding it from client side through WebService which has no such "onClientTimeSlotCreated" event, also these time slots are not having any identity at client side to access.
how to suppress the "AM" in the gridview (template Bind("RideTimeMin", "{0:t}")? Don't tell me to use military time because the function is not "time on a clock"; it's how much time is allowed for a task (in this case the min/max hours & minutes that horses have to complete a 20 mile trail; e.g. 05:00, 05:27, etc). I'm currently accomplishing this in the "ondatabound" function by "..RTmin.Replace("AM","")". I have looked and looked at all the websites that talk about datetime formatting but have yet to find a way to do it upfront in the gridview bind statement.
View 6 RepliesSince virturl directory name is not fixed, I wrote code below to include .css file in .aspx page now.
<link rel="Stylesheet" href="<%= ResolveUrl("~/Css/xxx.css") %>" type="text/css" />
The question is, when I use "ResolveUrl" in tag, IDE is always barking about that all CSS classes is undefined.
Is there any better way to define .css file including?
I want to use the following format of my url:
http://localhost/{url}/{options}/{hash} But since the url will be very strange with a url inside a url, how would I encode that?
I was thinking of encoding it in hex, since url encoding in .net gave me some strange result that didn't work inside a url. But I don't really know what would be the best way here.
I want to keep the structure of the url, not including any querystring.
I use the code bellow to dynamically include a CSS file:
HtmlHead head = (HtmlHead)Page.Header;
HtmlLink link = new HtmlLink();
link.Attributes.Add("href", Page.ResolveClientUrl("~/App_Themes/Default/StyleSheet.css"));
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
head.Controls.Add(link);
The problem is: I want to do it only once, and only if it isn't alrealy included in the page.
How do I verify if it is already included?
Edit:
Answers telling me to include in page load using !IsPostBack won't solve my problem, as this code will be inside a Web User Control and my page may have a lot of the same user control.
For example, I use the code below to do it with javascript:
if (!Page.ClientScript.IsClientScriptIncludeRegistered("jsScript"))
{
Page.ClientScript.RegisterClientScriptInclude("jsScript", ResolveUrl("~/Utilities/myScript.js"));
}
Possible Duplicate: Include javascript file inside javascript file?
Including a reference to another .js that your current .js file code is reliant on instead of having to add 2 includes in every page to ensure that both those files are there? I assume the answer is no...as I have not found any info on it on the net so far.
Is the classic way of using include files still the best practice in ASP.NET. IS there a better way in ASP.NET to simulate include files? IF not can someone please provide an example of the .NET way?
View 5 Repliesif there's someone could help me to solve the problem,i'll be delighted ...
View 6 Replieshow to include .swf file in html 4 without <embed> tag
View 2 RepliesCan anyone tell how to include, save and use the google maps in asp.net applications??
View 5 RepliesI've read that Microsoft now bundles jQuery with Visual Studio. How then do I "include" the jQuery source in my ASP.Net project?
View 3 RepliesI'm using DotNetNuke 4.8.x and want to utilize jQuery. Could anyone possibly suggest me on what is the best way to integrate jQuery into DNN? I won't be able to upgrade DNN version to 5 which has built-in support for jQuery.
View 1 RepliesHow do I include CSS reference in only certain pages on my asp.net website? If I include the reference in my master page, all pages of the website share the CSS reference.
View 2 RepliesI am testing an aspx page I wish to use to post to but I cannot seem to send the certificate over with the data. Here is my client code:
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
string postData = "age=23&state=47";
byte[] data = encoding.GetBytes(postData);
X509Certificate x509certificate = X509Certificate.CreateFromCertFile(@"C:Documents and Settings
cimbaloMy DocumentsDownloadsSSL Certificates estCert.cer");
string key = x509certificate.GetPublicKeyString();
string certData = Encoding.ASCII.GetString(x509certificate.Export(X509ContentType.Cert));
string pks12 = Encoding.ASCII.GetString(x509certificate.Export(X509ContentType.Pkcs12));
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://localhost:3493/Index.aspx");
myRequest.Credentials = new NetworkCredential("xxxx", "yyyy");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
myRequest.ClientCertificates.Add(x509certificate);
Stream newStream = myRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
System.IO.StreamReader st = new StreamReader(((HttpWebResponse)myRequest.GetResponse()).GetResponseStream());
Console.Write(st.ReadLine());
and here is the code from my aspx page:
protected void Page_Load(object sender, EventArgs e)
{
if (this.CheckCredentials())
{
string data = this.Context.Request.Form.ToString();
}
}
private bool CheckCredentials()
{
string userName = User.Identity.Name;
HttpClientCertificate certificate = Request.ClientCertificate;
if (certificate.IsPresent)
{
string w = certificate.Get("SUBJECT 0");
return true;
}
return false;
}
There is never a certificate present.
I found this earlier post X509Certificate not getting transmitted to the server
But did not understand the answer. I created a certificate using the MakeCert.exe utility but I do not really understand why it does not work.
i have function
public Menu Details(int? id)
{
return _dataContext.Menu.Include("ChildMenu").FirstOrDefault(m => m.MenuId == id);
}
now i need to add condition to child list ChildMenu something like fieldname=id. how can i do it?
my aspx file is include in master page.
now i can't call js function which i already include in the file when page is loaded.
page_load (cs file)
Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "1", "test.js");
Page.ClientScript.RegisterStartupScript(this.GetType(), "2", "<script type="text/javascript">testing();</script>");
test.js
function testing(){
alert("test");
}
but an error msg occurs: object expect?
i want to execute more than one query in a page.i tried to use sqlreader it didnt allow me to include.how to do ?This is my code.
[Code]....
this is how i did.it shows me error.how to solve this error?
I need to include a ticker in my asp.net web form.
the ticker will take the data from an xml file.
I'm trying to see what is the best way to include some protection against XSS in a web app but it needs to be easy for the developer!
Let me explain. I'm going to provide a library for the developers which will include the security controls. I'm thinking I have two choices:
1) Include some HTML encoding functions in that library e.g. AntiXSS and let the developer call the function every time he needs to output something
e.g.
Response.Write(AntiXss.HtmlEncode(value));
2) Create a new write method
Response.Writesecure(value)
The writesecure method would then call the appropriate functions and it would be transparent to the developer.
Additionally, I can write some easy code analyis scripts that will identify the use of the standard Write method...
I would like to have two .css files. One for each mastercontent page and one file for common elements. How to do this?
The following code doesn't work (css classes from Common.css file are not avalaible)
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<link href="MasterPage.css" rel="stylesheet" type="text/css" />
<link href="Common.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div id="Master_Header" CssClass="SomeClassFromCommonCssFile"></div>
</form>
</body>
</html