When there was XmlDocument why we need XDocument, is there any better feature available with XDocument, answer is yes, XDocument has a number of benefits, easy to create, easy to update, easy to search, ability to use LINQ to XML, cleaner object model etc. In this post we will see some examples and difference of code while using XmlDocument and XDocument; we will discuss some way to convert... By Ali Adravi On 16 Mar 2013 Viewed: 3,481
Most of the times we need to use GridView control to show tabular data in our asp.net application. We simply write procedure to search the records and bind them with GridView and show 10 to 20 records per page. Have you ever thought that why you are fetching all the records and show only 10 to 20 records, why cannot fetch only those records which we have to show on the page, means 20 records if... By Ali Adravi On 16 Feb 2013 Viewed: 8,386
A nice feature with ASP.Net is the model binding, it reduced our code and effort to bind our well know controls like GridView, DataList, Repeater etc. So let’s see how we can bind our old controls in new and easy way. Let’s see how we bind the our grid before 4.5 1. We write the code to get data from database 2. Set the data source of control say GridView 3. Finally call the DataBind()... By Mike .Net On 17 Jan 2013 Viewed: 3,200
There are many cases where we need to validate the value in controls before submitting to the database, so let's discuss email validation like format, length and existence into database. We will walk through in this article, how to validate entered user email from database, whether email is already exists in database if yes then show error to user that email already taken by some one, if no email... By Ali Adravi On 05 Jan 2013 Viewed: 7,039
Microsoft .NET Framework 3.5 SP1 introduced a routing engine to the ASP.NET runtime. The routing engine can decouple the URL in an incoming HTTP request from the physical Web Form that responds to the request, allowing you to build friendly URLs for your Web applications. Let's start make our web application work with routing, first of all you need to do some changes in your global.asax file,... By Ali Adravi On 05 Jan 2013 Viewed: 2,564
It’s good practice to log all the error into a file or database so in future you can check, how your application is working, and is there any issue which is not caught by Q.A. team. Really it's helpful to understand and caught the issues after deploying the application on production server. Create a method to log the error into a file: public void LogError(Exception ex, String... By Myghty On 30 Dec 2012 Viewed: 1,821
How and when to use RangeValidator is a tricky question, can we use RangeValidator to validate a string or date, most of us say we can not use RangeValidator for string but we can, we will see How to use RangeValidator for string?, How to use MinimumValue and MaximumValue for type String? ASP.net provides easy to use control to validate a control value between the range. It can be used to... By Tigers On 29 Dec 2012 Viewed: 2,162
- **Complacency** 1. Educate yourself. 2. Assume your applications will be hacked. 3. Remember that it’s important to protect user data. - **Cross-Site Scripting (XSS)** 1. HTML-encode all content. 2. Encode attributes. 3. Remember JavaScript encoding. 4. Use AntiXSS if possible. - **Cross-Site Request Forgery (CSRF)** 1. Token Verification. ... By Ali Adravi On 27 Dec 2012 Viewed: 461
In asp.net there is not control to select multiple files and upload them once with progress bar, so we will use a small third party DLL to achieve this functionality. We will use Flajaxian FileUploader, you can download it from [http://www.flajaxian.com][1] We will create three different images of size 100X100, 400X400 and original file, you can say thumbnail, medium size image and original... By Hamden On 12 Jul 2012 Viewed: 6,546
I was searching for select/deselect all checkboxes code into a gridview. I found most of them only provide to select and deselet all the checkboxes if any of the checkbox is unselected into grid the main checkbox is not affecting. I further try to search some useful code but could not found any useful solution, some of them are selecting all the checkboxes on the page or some provides only to... By Ali Adravi On 10 Jul 2012 Viewed: 5,376
I was checking how to validate a user email from database without post back, using JavaScript. After some search and RND found the way to call the web service method with the help of Ajax and JavaScript. Let’s say we have a registration page on which we accept email from the user and we expect it should be unique in entire database. So we need a method to immediately validate the email from... By Ali Adravi On 24 Jun 2012 Viewed: 14,569
Ajax CalendarExtendar: I found many questions on different sites regarding date range selection in Ajax CalendarExtender, while it is quite simple to bound the range to select from, you can allow all the dates, disable past dates, disable date greater than current date, date should be greater than current date + 1 month, current date to 1 month etc. So let me explain one by one: **For all... By Jonathan King On 23 Jun 2012 Viewed: 28,465
When we use Linq to SQL it creates a connection string in Settings files. When we need to create the DLL of the DataAccessLayer (DAL) for production server or any server which is not our current development server then we need to change connection string manually in Settings file, is not it would be good to set something in application so it can always read the connection string form web.config... By Montana Neyra On 17 Jun 2012 Viewed: 5,005