studio NETSOULS

Applying Web To Your Business

A lot of times in development scenarios you come to a situation where you want to do a postback on a webpage when a user hits the enter button.

If you are using RadAjaxManager on that page, then to submit the page for postback or invoke a button click event handler, use the following code:

   1: function PerformPostBack(e)
   2: {
   3:     evt = e || window.event;
   4:     var Key = evt.which || evt.keyCode;
   5:     if ( Key == 13 ) 
   6:     {
   7:         AjaxNS.ARWO(new WebForm_PostBackOptions("<%=btnButton.UniqueID%>", "", true, "", "", false, true), "<%=UpdateControl.ClientID%>", event);
   8:         return false;
   9:     }
  10: }

In the web page where the textbox is set onKeyPress=”return PerformPostBack(event)”

  • Currently 0 /5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

I am always searching the internet for the DateTime formats, so i thought i will post it in my blog so that i don’t need to keep googling for it.

Specifier String Result Output
d dd-MM-yyyy 03-01-2009
D dd MMMM yyyy 03 January 2009
f dd MMMM yyyy HH:mm:ss 03 January 2009 17:31:14
g MM/dd/yyyy HH:mm 03-01-2009 17:31:14
m MMMM dd January 03
r ddd, dd MMM yyyy HH':'mm':'ss 'GMT' Sat, 03 Jan 2009 17:31:14 GMT
s yyyy'-'MM'-'dd'T'HH':'mm':'ss 2009-01-03T17:31:14
t HH:mm:ss 17:31:14
u yyyy'-'MM'-'dd HH':'mm':'ss'Z' 2009-01-03 17:31:14Z
U dd MMMM yyyy HH:mm:ss 03 January 2009 12:01:14
y MMMM, yyyy January, 2009
o yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK 2009-01-03T17:31:14.0303453+05:30
DateTime todayDate = DateTime.Now;
string dateToStringInFormat = todayDate.ToString(formatSpecifier, 
System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat)
  • Currently 0 /5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

A neat regular expression function to strip the passed string of all HTML Tags.

public static string StripHTML ( string value )
{
    // Strip the html tagstring
    pattern = "<(.|\n)+?>"; 
    string strOutput = string.Empty; 
 
    Regex regex = new Regex ( pattern, RegexOptions.IgnoreCase ); 
 
    // Replace all HTML tag matches with an empty 
    stringstrOutput = regex.Replace(value, string.Empty); 
    // Replace all < and > with &lt; and &gt; 
    strOutput = strOutput.Replace("<", "&lt;"); 
    strOutput = strOutput.Replace ( ">", "&gt");
 
    return strOutput; 
}
  • Currently 0 /5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

About Us

studio NETSOULS is a complete IT services company, offering strategy, design, development and implementation of the total solution for your web and IT initiatives. The solutions we provide, enables businesses to leverage leading edge technology to gain sustainable competitive advantages in today's marketplace.

We specialize in designing, developing and deploying the next generation of IT solutions including e-business solutions Read more...

Tags

This will be shown to users with no Flash or Javascript.

Contact Us

My status

Quote of the Day

Men are disturbed, not by the things that happen, but by their opinion of the things that happen

- Epictetus

NutritionVista

www.NutritionVista.com

Archives


Advertisements


Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Log in