studio NETSOULS

Applying Web To Your Business

Need to crop or resize images before uploading, in asp.net? Sounds like the alternative to thumbnail generation in asp.net web page? Here comes a handy code using jQuery, JCrop and ASP.NET.

I have coded a shopping cart in which there was the need of uploading images to the server, and keep the sizes as required by the content of the pages. In my case I had to hard-code the size of the thumbnail I generated. But wouldn't it be lovely if the site user could crop the image and fix the required size? So I have found one very useful way to Upload and Crop Images with jQuery, JCrop and ASP.NET. I hope this will be useful for all programmers.

Upload and Crop Images with jQuery, JCrop and ASP.NET

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

When searching for this I found dozens of implementations doing things like parsing each character, string manipulation, and more. But one of the best solutions i could come up is this:

   1: function isInteger(val) {
   2:  
   3:    return (val == null || isNaN(val)) ? false : 
   4:       ( ((1.0 * val) == Math.floor(val)) && (val.indexOf(".") == -1));
   5:  
   6: }
  • Currently 4 /5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Below is a table of the most common client side events in JavaScript. The Table is divided into three columns – the first lists the name of the event. The second contains a short description of the event, and the third lists all page objects, which support the given event.

Event Name

               Description

Supported by objects

onabort

The onabort event occurs when loading of an image is aborted.

image

onblur

The onblur event occurs when an object loses focus.

button, checkbox, fileUpload, layer, frame, password, radio, reset, submit, text, textarea, window

onchange

The onchange event occurs when the content of a field changes.

fileUpload, select, text, textarea

onclick

The onclick event occurs when an object gets clicked.

button, document, checkbox, link, radio, reset, submit

ondblclick

The ondblclick event occurs when an object gets double-clicked.

document, link

onerror

The onerror event is triggered when an error occurs loading a document or an image.

window, image

onfocus

The onfocus event occurs when an object gets focus.

button, checkbox, fileUpload, layer, frame, password, radio, reset, select, submit, text, textarea, window

onkeydown

The onkeydown event occurs when a keyboard key is pressed.

document, image, link, textarea

onkeypress

The onkeydown event occurs when a keyboard key is pressed or held down.

document, image, link, textarea

onkeyup

The onkeyup event occurs when a keyboard key is released.

document, image, link, textarea

onload

The onload event occurs immediately after a page or an image is loaded.

image, layer, window

onmousedown

The onmousedown event occurs when a mouse button is clicked.

button, document, link

onmousemove

The onmousemove event occurs when the mouse pointer is moved.

onmousemove is, by default, not an event of any object, because mouse movement happens very frequently.

onmouseout

The onmouseout event occurs when the mouse pointer moves away from a specified object.

layer, link

onmouseover

The onmouseover event occurs when the mouse pointer moves over a specified object.

layer, link

onmouseup

The onmouseup event occurs when a mouse button is released.

button, document, link

onreset

The onreset event occurs when the reset button in a form is clicked.

Form

onresize

The onresize event occurs when a window or frame is resized.

Window

onselect

The onselect event occurs when text is selected in a text or textarea field.

text, textarea

onsubmit

The onsubmit event occurs when the submit button in a form is clicked.

Form

onunload

The onunload event occurs when a user exits a page.

window

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

The current article is taken from http://blog.telerik.com

In some scenarios it is useful to encode and decode the URI. For example:

To avoid unexpected requests to the server, you should call encodeURIComponent on any user-entered parameters that will be passed as part of a URI. For example, a user could type "Thyme &time=again" for a variable comment. Not using encodeURIComponent on this variable will give comment=Thyme%20&time=again. Note that the ampersand and the equal sign mark a new key and value pair. So instead of having a POST comment key equal to "Thyme &time=again", you have two POST keys, one equal to "Thyme " and another (time) equal to again.

encodeURIComponent

Core Function:
Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, or three escape sequences representing the UTF-8 encoding of the character.

//Syntax
var encoded = encodeURlComponent(str);

encodeURIComponent escapes all characters except the following: alphabetic, decimal digits, - _ . ! ~ * ' ( )

decodeURIComponent

Replaces each escape sequence in the encoded URI component with the character that it represents.

Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine.

  • Currently 5 /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

"Do you see a man wise in his own eyes? There is more hope for a fool than for him."

- Proverbs 26:12

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