Hello, I’m Nilesh

Category: Asp.net

  • Asp.net Web API Help Page Customization

    After you have set up the Web API help page as shown here, you could do the following customizations: List APIs by controller name Edit Areas\HelpPage\Views\Index.cshtml and replace the below line with That way, it would be easy for anyone to refer to the help page documentation, and a person can be sure that all […]

  • iTextSharp: Add dynamic header

    Note: If you have not gone through my previous post iTextSharp–Add header/footer to PDF, please go through it. Most of the time, we’ll require to print the dynamic value in the header. i.e. Company Name etc. You can create properties in the PageEvent class that inherits the PdfPageEventHelper class. Now add the below code to […]

  • JQuery UI AutoComplete TextBox from Database using PageMethod in ASP.Net

    In this post we’ll see how to user JQuery UI Autocomplete with asp.net pagemethod. For database, we’ll be using Northwind database. PageMethod: In above code, we’re fetching data from customer table from northwind database based on text entered by user. You may want to have this code in separate (data access) layer and must use […]

  • iTextSharp–Add watermark to PDF

    In the last post iTextSharp–Add header/footer to PDF we saw how to create a pdf with a header/footer. To add a watermark to pdf, you need to create a class that implements IPdfPageEvent as shown below code: Now let’s see how to add a watermark using the above class: After using the code above, it […]

  • iTextSharp–Add header/footer to PDF

    It’s a common requirement to have a header/footer on PDF, and it could be achieved using PageEvents in iTextSharp. It depends on the requirement, but in general, the header may contain: And footer may contain the following: Check out the below function that creates a sample PDF having five pages with a header and footer: […]

  • iTextSharp–Print PDF

    To print the HTML page, we use the below code. But the same can not be used to print the PDF as it won’t work. However, iTextSharp provides a way to print the PDF on the client side with the AddJavaScript method of PdfWriter. Check out the below code: It won’t print the PDF directly […]

  • jQuery multiselect plugin retain selection on postback in Asp.net

    The jQuery Mutiselect plugin allows users to select multiple items from the options available in the dropdown. When we click on the dropdown, it looks something like the below : Check out the demo page of the plugin here. The problem with the plugin is that it won’t remember the user selection, and value will […]

  • Reset .net validation controls client side

    We often provide form reset functionality, and people handle it client-side or server-side. Generally, we validate user input and show the proper validation messages. But sometimes, the user has entered the wrong information, and thus it will display validation messages. Now, if you have handled form reset functionality client-side, you must also reset all validation […]

  • iTextSharp – Add Image from base64 string

    Itexhsharp is a popular third-party component for creating PDFs with the .Net framework. If you’re using Itextsharp for the first time, I would suggest you go through Mike’s series on Itextsharp that helps you get started, and here is the article from the series that shows different ways to add images to Itextsharp. To add an […]

  • How to pass multiple records to stored procedure in Asp.net?

    There are three main ways to pass multiple records to the stored procedure. To know what is a table-valued parameter and how to pass a data table to stored procedure and implement upsert (update + insert) logic using Merge Statement, check out an old post here. We’ll see in this post how you can pass […]