Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Contents tagged with jQuery

  • Two Ways of Passing HTML5 Web Storage Data to ASP.NET

    HTML5 web storage allows you to store data on the client side. However, unlike cookies this data is not passed automatically to the server with every request-response cycle. To pass the data stored in web storage to the server you need to make some programmatic arrangement. Two ways by which such a data transfer can be facilitated are hidden form field and Ajax call. This article explains both of these techniques with an example.

  • Two ways of selecting files for uploading

    As you know HTML5 has native support for drag and drop operations. A part of this support also allows you to drag files from Windows explorer and drop them on to a web page element. The files can then be uploaded on the server as usual. In addition to HTML5 drag-n-drop you may want to allow users to use classic technique of file selection - displaying an open file dialog and let them select the files. If you are supporting both the types of file selection techniques you may want to hide the File Upload server control from being displayed on the form entirely because generally you will have some other element (usually a graphical element) on which the end user can drop the files.

  • Uploading Files Using ASP.NET Web Forms, Generic Handler and jQuery

    In order to upload files from the client machine to the server ASP.NET developers use FileUpload server control. The FileUpload server control essentially renders an INPUT element with its type set to file and allows you to select one or more files. The actual upload operation is performed only when the form is posted to the server. Instead of making a full page postback you can use jQuery to make an Ajax call to the server and POST the selected files to a generic handler (.ashx). The generic handler can then save the files to a specified folder. The remainder of this post shows how this can be accomplished.

  • Content Negotiation in Web API

    Whenever you access ASP.NET Web API from your client side script (JavaScript / jQuery) by default the data is returned in JSON format. However, in certain cases you lay want to retrieve the data in XML format instead of JSON. On the server side, Web API determinses what data format to use for sending data to the client by doing what is known as Content Negotiation. Simply put, content negotiation is a process by which Web API inspects the incoming request and HTTP headers accompanying the request to figure out what response format(s) the client can understand. Based on this checking Web API sends the output.

  • Edit GridView data without displaying default Edit, Update and Cancel buttons

    ASP.NET GridView control provides an easy way to edit and update data with the help of CommandField column type. The default CommandField arrangement is such that the Edit, Update and Cancel buttons are displayed in a column. The problem with this design is that the GridView edit column always occupies some screen real estate. Additionally in the edit mode the GridView expands horizontally disturbing the page layout. Luckily, with some easy trick you can render an editable GridView without displaying the default Edit, Update and Cancel buttons. This post shows how.

  • Convert GridView Data to CSV using jQuery

    At times you may want to allow the end user to save GridView data into CSV format for further processing (say for opening later in Excel). Doing so using server side code is quite common. However, this requires an extra round trip to the server. You can also convert data from a GridView into CSV using jQuery. This post shows how.

  • Display a list of audio / video files using HTML5 and GridView

    Recently one of the readers asked this question - How to display a list of audio and video files in ASP.NET web form? Additional requirements were - a) The database contains audio as well as video file URLs. At run time depending on whether a file is audio file or video file appropriate media player should be displayed to the user. b) At a time only one media file should be playing from a given list. This post provides one of the possible solution to the problem.

  • ASP.NET Web Forms, ASP.NET MVC and HTML5 Courses in Thane

    After taking a break for some time from my training activities I will be conducting classroom training programs again in the month of June and July 2013. Since the release of VS2012  lots of people have inquired about our training programs and hence will be arranging these courses for them. To begin with three courses are scheduled - Programming ASP.NET Web Forms, Programming ASP.NET MVC and Programming HTML5 & jQuery for ASP.NET Developers. All of the course are 40 hrs. duration each and will be conducted in Thane on weekends.

  • Generating Short URLs using Google URL Shortener API

    At times URLs that you wish to share with others are too long to be shared in their original form. Such long URLs can affect the readability and flow of your message. Additionally, they are unsuitable to use with applications such as Twitter because of their length. Many websites, therefore, allow you to create a shorter version of a URL which gets expanded to the full original URL when accessed. This article shows how to use Google URL Shortener API to generate short URLs programmatically.

  • Add a notification bar to your website using jQuery

    Many websites display notifications or prompts in what is called as information bar or notification bar. Such an information bar typically contains some text, graphics or any other HTML markup along with a close button. The information bar is always visible and is flushed with the top edge of the browser window. Once user closes it, it remains hidden for the active session. Such an information bar can be easily developed using jQuery. The remainder of this article explains how.