tip and trick

Tips & Tricks

Don't Leave this page !!!!!

posted Apr 12, 2012, 6:09 AM by mb s

COnfirm Navigation

to  create this confirm VIA jquery ,write this code :

<html>
<head>
<title>Refresh a page in jQuery</title>
 
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
 
</head>
 
<body>
 
<h1>Stop a page from exit with jQuery</h1>
 
<button id="reload">Refresh a Page in jQuery</button>
 
<script type="text/javascript">
 
	$('#reload').click(function() {
 
	 	location.reload();
 
	});
 
	$(window).bind('beforeunload', function(){
		return '>>>>>Before You Go<<<<<<<< \n Your custom message go here';
	});
 
</script>
 
</body>
</html>

View Sample Online

Create Your Own Loading.gif File on Internet ?!!!!!

posted Apr 11, 2012, 4:43 AM by mb s

hi
i was looking for a good and nice Loading.gif  file

loading

that i see there is a site that give you a nice Service :

via http://www.ajaxload.info/ you can generate your own loading file
you can select the fore & back Color and ...Fire..

try it sure...
good luck

Visual Studio shortcut keys - Part 2 (Text navigation)

posted Feb 15, 2012, 2:03 AM by mb s

Text navigation

The 'must-know' shortcut keys are  highlighted .
Shortcut Description
Left Arrow 
Moves the cursor one character to the left
Right Arrow 
Moves the cursor one character to the right
Down Arrow 
Moves the cursor down one line
Up Arrow 
Moves the cursor up one line
Page Down 
Scrolls down one screen in the editor window
Page Up 
Scrolls up one screen in the editor window
End 
Moves the cursor to the end of the current line
Home
Moves the cursor to the beginning of the line. If you press Home when the cursor is already at the start of the line, it will toggle the cursor between the first non-whitespace character and the real start of the line
Ctrl-End 
Moves the cursor to the end of the document
Ctrl-Home 
Moves the cursor to the start of the document
Ctrl-G
Displays the Go to Line dialog. If the debugger is running, the dialog also lets you specify addresses or function names to go to
Ctrl-] 
Moves the cursor to the matching brace in the document. If the cursor is on an opening brace, this will move to the corresponding closing brace and vice versa
Ctrl-K, Ctrl-N
Moves to the next bookmark in the document
Ctrl-K, Ctrl-P
Moves to the previous bookmark
Ctrl-K, Ctrl-I
Displays Quick Info, based on the current language
Ctrl-Down Arrow 
Scrolls text down one line but does not move the cursor. This is useful for scrolling more text into view without losing your place. Available only in text editors
Ctrl-Up Arrow 
Scrolls text up one line but does not move the cursor. Available only in text editors
Ctrl-Right Arrow 
Moves the cursor one word to the right
Ctrl-Left Arrow 
Moves the cursor one word to the left
Ctrl-Shift-1
Navigates to the next definition, declaration, or reference of an item. Available in the object browser and Class View window. Also available in source editing windows if you have already used the Edit.GoToReference (Shift-F12) shortcut
Ctrl-Shift-2
Navigates to the previous definition, declaration, or reference of an item

Source : DoFactory


Visual Studio shortcut keys - Part 1 (General)

posted Feb 15, 2012, 1:59 AM by mb s   [ updated Feb 15, 2012, 2:01 AM ]

General

The 'must-know' shortcut keys are  highlighted .
Shortcut Description
Ctrl-X or
Shift-Delete
Cuts the currently selected item to the clipboard
Ctrl-C or
Ctrl-Insert
Copies the currently selected item to the clipboard
Ctrl-V or
Shift-Insert
Pastes the item in the clipboard at the cursor
Ctrl-Z or
Alt-Backspace
Undo previous editing action
Ctrl-Y or
Ctrl-Shift-Z
Redo the previous undo action
Ctrl-Shift-V or
Ctrl-Shift-Insert
Pastes an item from the clipboard ring tab of the Toolbox at the cursor in the file and automatically selects the pasted item. Cycle through the items on the clipboard by pressing the shortcut keys repeatedly
Esc 
Closes a menu or dialog, cancels an operation in progress, or places focus in the current document window
Ctrl-S 
Saves the selected files in the current project (usually the file that is being edited)
Ctrl-Shift-S 
Saves all documents and projects
Ctrl-P
Displays the Print dialog
F7
Switches from the design view to the code view in the editor
Shift-F7
Switches from the code view to the design view in the editor
F8
Moves the cursor to the next item, for example in the TaskList window or Find Results window
Shift-F8
Moves the cursor to the previous item, for example in the TaskList window or Find Results window
Shift-F12 
Finds a reference to the selected item or the item under the cursor
Ctrl-Shift-G
Opens the file whose name is under the cursor or is currently selected
Ctrl-/
Switches focus to the Find/Command box on the Standard toolbar
Ctrl-Shift-F12
Moves to the next task in the TaskList window
Ctrl-Shift-8
Moves backward in the browse history. Available in the object browser or Class View window
Alt-Left Arrow
Go back in the web browser history
Alt-Right Arrow
Go forward in the web browser history

Source : DoFactory

Persian DatePicker in Windows Forms

posted Dec 12, 2011, 12:12 PM by mb s   [ updated Dec 12, 2011, 12:15 PM ]

DateTime format in .NET 4.0

posted Oct 18, 2011, 1:00 AM by mb s

Lets assume I have the DateTime pattern "dd-MMM-yyyy" in my locale.
 
DateTime.Now.ToString("yyyy/MM/dd") working different in 3.5 & 4.0 framework.
 
In 3.5, it uses the pattern given in the parameter to convert the date to string. So, the output would be "2011/11/10" and it the expected result.
 
But in 4.0, this would return as "2011-11-10" which is not correct. 4.0 is using the current culture's ("-") separator instead of using the pattern's separator ("/") given in the parameter. To fix it, we need to pass IFormatProvider along with the ToString function.

Javascript : Calculate Random value

posted Oct 10, 2011, 9:39 AM by mb s

            function CalculateRand(END) {
                var rand = Math.floor(Math.random() * END);
                return rand;
            }

Javascript : Numeric Texbox

posted Oct 10, 2011, 9:34 AM by mb s   [ updated Oct 10, 2011, 9:39 AM ]

Javascript 

function JustDigits() {
    if (event.keyCode < 32) {
            return;
        }
    if ((event.keyCode <= 57) && (event.keyCode >= 48)) {
        if (!event.shiftKey) {
                return;
            }
        }
    event.returnValue = false;
}

ASP


                                        <asp:TextBox ID="txtbx_Example"  
                                               runat="server" MaxLength="6"
                                           Width="50" onkeypress="JustDigits();" ></asp:TextBox>


How to print SharePoint 2010 page without header and navigation

posted Sep 11, 2011, 1:20 AM by mb s   [ updated Sep 11, 2011, 1:34 AM ]


    سلام
     هنگامی که شما تلاش می کنید تاصفحه وبسایت شیرپوینتی را چاپ کنید ، قسمتheader  و navigation هم چاپ می شوند . در بسیاری مواقع شما نیاز به چاپ این قسمت ها ندارید و فقط مایل به چاپ محتوای اصلی هستید! برای حل این مشکل شما به راحتی مبتواید باتغییراتی در CSS ، آن قسمتهارا در چاپ غیر فعال کنید




/* This CSS removes the header, navigation and other action elements from the print preview */
/* To use this CSS for PrintPreview just add the to this CSS with the media="print" */

@media print 
{

/* SharePoint 2010 */

        /* Team Site */
        #s4-titlerow, #s4-statusbarcontainer, #s4-topheader2 { display:none; visibility: hidden; }

        #s4-leftpanel { display:none; visibility: hidden; }
        #MSO_ContentTable { margin: 0 0 0 0 }

 

/* SharePoint 2007 */


        /* CORE.CSS override */ 
        .ms-leftareacell,.ms-globallinks,.ms-siteaction,.ms-areaseparatorleft, 
        .ms-rightareacell,.ms-areaseparatorright, .ms-areaseparatorcorner, 
        .ms-titlearealeft,.ms-titlearearight,.ms-searchform,.ms-banner, 
        .ms-buttonheightwidth,.ms-buttonheightwidth2 
        { 
                display:block; 
                visibility:visible; 
        }        

        /* hide header * quick navigation */ 
        .ms-globalbreadcrumb { display:none; visibility: hidden; } 
        .ms-globalTitleArea { display:none; visibility: hidden; } 
        #nav-wrapper { display:none; visibility: hidden; } 
        .ms-titlearealeft { display:none; visibility: hidden; } 
        .ms-navframe { display:none; visibility: hidden; } 
        .ms-nav { display:none; visibility: hidden; } 
        
        /* move content to the left */ 
        .ms-bodyareacell, #above-main { margin: 0 0 0 0 } 
        
        /* fonts normalization */ 
        .ms-formbody { font-size: xx-small} 
        
        /* remove the actions buttons */ 
        .ms-toolbar { display:none; visibility: hidden; }

       /* expanding edit form controls on the width of the screen */

        #onetIDListForm  { width: 100%; } 
       .ms-formlabel { width:20% } 
       .ms-formbody {  width: 80%; } 
       .ms-long { width: 100%; } 
       .ms-rtelong { width: 100%; height: 400px; } 
       .ms-rtetoolbarmenu { width: 100%; text-align: left; } 
       TEXTAREA.ms-long { width: 100%; } 
       .ms-formbody SPAN SPAN DIV { width: 100%; }

 }

 


                        Source + Moreinfo : Sharepoint Sandbox [Tip #63]



Named and Optional Arguments in CSharp 4.0

posted Sep 8, 2011, 10:02 AM by mb s

Difference between Variable & Variable:

C# Sample Code from MSDN




1-10 of 17

Comments