Pages

About Me

My photo
ForEach(Minute in MyLife) MyExperience ++;

Saturday, July 30, 2011

Regular expression library

http://regexlib.com/%28X%281%29A%28veT2YrYs6oiekXsLokG37Fc2mfxjYmViaR4eW0zuOEP1CBjGIgwDHLXIrg1zhhwk6_erWPt6NjWtU1-6PeLbawT5VfFqS2SmYao_lf6LjPAwFXUojZs13Y9NoHPphmf4isJf_uCicvYjRUCHuaNJ294Hc8v0W-xQaZncUlLzwRtIOMLCzSnXYjE7nlvK5NTD0%29%29/DisplayPatterns.aspx

Thursday, July 28, 2011

Popup window using javascript

<script language="javascript" type="text/javascript">

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos)
{
if(pos=="random"){LeftPosition=(screen.width)?
Math.floor(Math.random()*(screen.width-w)):100;
TopPosition=(screen.height)?Math.floor
(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?
(screen.width-w)/2:100;TopPosition=(screen.height)
?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") ||
pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+
TopPosition+',left='+LeftPosition+',scrollbars='
+scroll+',location=no,directories=no,status
=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
</script>
Copy the following where you want to generate popup link
<a href="http://www.google.com" 
onclick="NewWindow(this.href,'mywin',
'120','120','no','center');return false" 
onfocus="this.blur()">YourLinkText</a>

Disable back key in browser

Add this script inside head tag in html page 

<script type = "text/javascript" >
   function preventBack(){window.history.forward();}
    setTimeout("preventBack()", 0);
    window.onunload=function(){null};
</script

Cross Browser HTML and CSS Compatibility

If you follow XHTML and CSS standards according to the XHTML and CSS version then no need to worry about the browser compatibility ..




Check your pages whether it follow using ,


http://validator.w3.org/
http://jigsaw.w3.org/css-validator/
http://www.w3.org/QA/Tools/

Wednesday, July 27, 2011

Disable Enter Key

<script language=javascript type=text/javascript>

function stopRKey(evt) {
   var evt = (evt) ? evt : ((event) ? event : null);
   var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
   if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}

document.onkeypress = stopRKey;

</script>

How browsers understand ASP.NET or PHP pages?

How browsers understand ASP.NET or PHP pages?

If visit any web site, no matter what technology is used to develop the site, your browser will be able to display the page for you. The only thing a browser can understand is "HTML". It does not know ASP.NET or PHP. So, even if your web site is developed using ASP.NET, still your browser can understand only HTML.

This is how it works:

You type a URL in your browser. (Eg: http://www.xyz/asp.net/lesson1.aspx)
Your browser will compose a request for this page and send to the web server in
internet. The web server analyzes the request and it understands that the request is for an ASP.NET page called "lesson1.aspx". So, the web server hand over the request to the aspnet service running as part of the web server. (If the page is a .php file,then there must be a php service running on the webserver).The aspnet service loads the page "lession1.aspx". Inside this page, we have written code to read the TutorialId passed as a parameter (parameters are called "Query String"). Our code gets this tutorial id and then retrieves the corresponding content from the database. Then our code embeds this content into the page and returns the dynamically modified page content to the web server. Web server returns the dynamically generated page to the browser. This dynamically generated page has only HTML in it, even though this html came from database. When the browser receives the page, it has only HTML. So, as far as a browser is concerned, it does not care what type of web site it is. It can be any technology like ASP.NET or PHP. It is the responsibility of the web server to generate dynamic content from database or wherever and give only HTML page content to the browser.

Pop a banner each time Windows Boots

To pop a banner which can contain any message you want to display just before a user is going to log on, go to the key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WinLogon Now create a new string Value in the right pane named LegalNoticeCaption and enter the value that you want to see in the Menu Bar. Now create yet another new string value and name it: LegalNoticeText. Modify it and insert the message you want to display each time Windows boots. This can be effectively used to display the company's private policy each time the user logs on to his NT box. It's .reg file would be: REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Winlogon] "LegalNoticeCaption"="Caption here."

Clear all controls in a webform

private void Clear(Control Parent)
{
foreach (Control Child in Parent.Controls)
{
if (Child.HasControls())
Clear(Child);
else
{
if (Child.GetType() == typeof(TextBox))
((TextBox)Child).Text = "";
}
}
}
protected void Button1_Click(object sender, EventArgs e)

{

Clear(this.Page);
}
} 

Export only selected values

http://www.aspsnippets.com/Articles/ASP.Net-GridView-Export-only-selected-columns-to-Excel-Sheet.aspx

Auto complete textbox in asp.net

http://www.aspsnippets.com/Articles/Using-jQuery-AutoComplete-Plugin-in-ASP.Net.aspx

Implementing Spelling Check Feature using TinyMCE Rich Text Editor in ASP.Net

Check username availability in .Net

http://www.aspsnippets.com/Articles/Check-Username-Availability-in-ASP.Net-using-AJAX-PageMethods.aspx

Tuesday, July 26, 2011

Fixed header gridview

http://www.aspsnippets.com/Articles/Scrollable-GridView-with-Fixed-Headers-using-jQuery-Plugin.aspx

.Net Document Viewer

http://www.aspsnippets.com/Articles/Display-Word-document-on-web-page-in-ASP.Net.aspx

Validate File types

http://www.aspsnippets.com/Articles/jQuery-Plugin-to-validate-File-Types-and-Extensions-in-ASP.Net-AsyncFileUpload-Control.aspx

Formatted Emails

Send format emails using asp.net   :

http://www.aspsnippets.com/Articles/Create-and-send-HTML-Formatted-Emails-in-ASP.Net-using-C-and-VB.Net.aspx

Image preview after upload

http://www.aspsnippets.com/Articles/Display-image-after-upload-without-page-refresh-or-postback-using-ASP.Net-AsyncFileUpload-Control.aspx

Rich textbox editor in asp.net

http://www.aspsnippets.com/Articles/Using-Tiny-MCE-Rich-TextBox-in-ASP.Net.aspx

Multiple File hosting using ASP.Net and jQuery

http://www.aspsnippets.com/Green/Articles/Multiple-File-Uploads-Gmail-Style-using-JQuery-and-ASP.Net.aspx

Format date time

String.Format("{0:dd MMM yyyy }", Convert.ToDateTime(your value in datetime format));

Automatic redirection of pages after few seconds

 HtmlMeta meta = new HtmlMeta();
                meta.HttpEquiv = "Refresh";
                meta.Content = "3; URL=Default2.aspx";
                Page.Header.Controls.Add(meta);

Get Referrer URL

Get the details of your referrer , ie, from where the user gets redirected to your page ....


_REFUrl = Request.URLReferrer.Host.ToString

Friday, July 22, 2011

C sharp code optimization techniques

Reference : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/highperfmanagedapps.asp

Thursday, July 21, 2011

Passing multiple arguments in c#

.aspx page ,

"<asp:imagebutton com="" commandargument="&lt;%#Eval(&quot;ERROR_FILE1&quot;) + &quot;,&quot;+Eval(&quot;ERROR_FILE2&quot;)+&quot;,&quot;+Eval(&quot;ERROR_FILE3&quot;)%&gt;" commandname="&lt;%# Eval(&quot;ERROR_ID&quot;) %&gt;" id="ImgB_DELETE" imageurl="../images/Manager/trash.png" onclientclick="return confirm('Are you sure you want to delete this Error Report?')" oncommand="Delete" runat="server"></asp:imagebutton>"

.cs page

 string[] Argument = e.CommandArgument.ToString().Split(new char[] { ',' });
        string File1 = Argument[0].ToString();
        string File2 = Argument[1].ToString();
        string File3 = Argument[2].ToString();

Saturday, July 16, 2011

My Career-Blog With Jobs: Applied Development – Walkin for .Net Developer @ ...

My Career-Blog With Jobs: Applied Development – Walkin for .Net Developer @ ...: "Applied Development – Walkin for .Net Developer @ Chennai On 16 July 2011 Position : Dotnet Developer Job Location : Chennai Venue : App..."

"M" 4 Mahi: .Net programmers needed urgently

"M" 4 Mahi: .Net programmers needed urgently: "Position:-.Net Developer Location : Bangalore Education : ANY GRADUATION and PG Exp : 2-3 YRS Salary Offered: 7-8 K during 3-4 months pr..."

.Net programmers needed urgently

Company :impulse technology
Email :
Website : www.impulse-technologies.com
Qualification :Degree
Expeience :1 year
Vaccancy posted :
Tehnology :C#, ASP.Net, SQL Server 2005
Location: Banglore

.Net vaccancies

Candidates with qualifications .BE/ B.Tech./ MCA
2 plus years .

Employer: Reylon soft

post your resume at careers@relyonsoft.com., or visit
http://www.relyonsoft.com/careers/current-openings.php

.Net vaccancies in bangalore

Candidates with qualifications .BE/ B.Tech./ ME/ M.Tech/ MCA/ MSc ,
1-3 Yrs Exp in VB.Net, ASP.Net, ADO.Net & SQL Server needed . Work location is Bangalore.

Employer: Xsys Software Technologies

post your resume at careers@xsyssoftech.com or visit
http://www.xsyssoftwaretechnologies.com

"M" 4 Mahi: Inport your contacts from Other sites

"M" 4 Mahi: Inport your contacts from Other sites: "http://www.plaxo.com/api/widget?src=ab_chooser"

Inport your contacts from Other sites

http://www.plaxo.com/api/widget?src=ab_chooser

Wednesday, July 13, 2011

Monday, July 11, 2011

Default Upload file size is 4 mb

Add this to the web config file and change the file size as u wish

Image save / retrieve/ extension / delete

==================================
image save
==================================

public string Save_Photo = HttpContext.Current.Server.MapPath("~/Upload/User_Photo/");
public string Get_Photo = "~/Upload/User_Photo/";

====================================
image retrieve
====================================
Img_USER_PHOTO.ImageUrl = clas.Get_Photo + dt.Rows[0]["USER_PHOTO"].ToString();


=====================================
Sub string
=====================================

Fup_USER_PHOTO.FileName.Substring(Fup_USER_PHOTO.FileName.LastIndexOf('.'));

====================================
delete image from folder
=====================================
System.IO.File.Delete(HttpContext.Current.Server.MapPath("~/images/") + DropDownList1.SelectedValue);

======================================
File search
=======================================
if (File.Exists(clas.Save_Photo + Photo_Del))
{
File.Delete(clas.Save_Photo + Photo_Del);
}

========================================
File extensions
========================================
if (fu.HasFile) // fu refers to FileUpload control.
{
String fileExtension = System.IO.Path.GetExtension(fu.FileName).ToLower();
String[] allowedExtensions = { ".jpg", ".gif", ".png" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
if (fileExtension == allowedExtensions[i])
{
fileOK = true;
if (fileOk == true) { fu.SaveAs("path" + fu.FileName); }
}
}

Saturday, July 2, 2011

Change gridview row style dynamically ...

Inside row databound ,
e.Row.Font.Bold = true;

e.Row.Style.Add("color","White");
e.Row.Style.Add("background-color", hf.Value);
e.Row.BackColor = Color.White; ( add namespace system.drawing)


Example :
protected void Gv_NOTICE_LIST_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HiddenField HF_Status = (HiddenField)e.Row.FindControl("Hf_NOTICE_STATUS");
ImageButton Delete = (ImageButton)e.Row.FindControl("ImgB_DELETE");
if (HF_Status.Value != "")
{
if (HF_Status.Value == "0")
{
Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
Lbl_Status.Text = "Unread";
Delete.Enabled = false;
e.Row.Font.Bold = true;
Delete.Attributes.Add ("title", "An unreaded notice cant be delete");

}
else if (HF_Status.Value == "1")
{
Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
Lbl_Status.Text = "Read";
Delete.Enabled = true;

}

//else if (HF_Status.Value == "2")
//{
// Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
// Lbl_Status.Text = "Deleted";
//}
}
}
}