Showing posts with label asp.net(c#). Show all posts
Showing posts with label asp.net(c#). Show all posts

Tuesday, May 17, 2011

Make Regular Expression Checker in 10 minutes using Asp.net C#

In most of the times we need to make or create a regular expression to find matching patterns from a given string or a file. Many languages support this feature like Javascript and also Asp.net C#. Regular expresion makes our life easy. Few days ago i have done a dataminig project where i found that how much necessary the regular expression is. I understand its power and capability. The developer

Sunday, March 27, 2011

Validate XML aganist an XSD in Asp.Net C#

Most of the times when we are working with XML we need to validate the XML file from an XSD file. Here i am showing an code example how one can validate XML file using an XSD in Asp.Net C#.

To do that add an aspx page in your project.











Now under Page_Load event write the below code:
using System;
using System.Xml;
using System.Text;
using System.Xml.Schema;

public partial class

Creating XSD file from an XML file in Asp.Net within few seconds

There are a lot of tools in the internet you will get to create XSD file from an XML file but you need to download then install or may be convert on-line. But there is good news that Asp.Net has built in menu to create XSD file from an XML file.












To do that first write the below XML file in VisualStudio:


Bind DataSource into DataList example in Asp.Net

The DataList control is a standard control of Asp.Net like others. It is used to display repeated list of data or items. You can bind any datasource in this DataList control like DataTable, SqlDataReader and XML etc. In most e-commerce site use DataList control to display products insted of repeater control. Here in this example i will show you how one can bind data to DataList control in runtime

Wednesday, March 23, 2011

Tricks for URL Rewriting using Request.PathInfo in Asp.Net

To publish cleaner URL in your Asp.Net application you can use URL Rewriting. The most popular reason for URL Rewriting is let you have implemented pages based on query string like http://yourdomain/product.aspx?Brand=Lux. But now you want to change the URL to http://yourdomain/product.aspx/Lux for SEO purpose. There is a lot of way to implement this. One of the easy trick is you can achieve URL

Monday, March 21, 2011

Check user name login name email address availability using jquery ajax in Asp.Net page

In most registration page we need to check the availability of user name or email address using Jquery/Ajax. Because it will be hectic job for user to rewrite the data after getting post back error that user name already taken or email address already taken. So it would be very helpful for user if he can check his name or login name or email address availability in time without losing any data.

Friday, December 3, 2010

Using Server.Transfer how to pass values from source page to destination page

It's not possible to pass value using query string from source page to destination page when using Server.Transfer. To pass data or value from source page to destination page while using Server.Transfer you can use HttpContext object. To do that add two aspx pages in your project & give name source.aspx & destination.aspx. In source.aspx page place a LinkButton. And under the LinkButton Click

Difference Between Server.Transfer vs Response.Redirect

There is a common question for developers in Asp.net interview board that "What is the difference between Response.Redirect and Server.Transfer". In a common term we can use both to redirect the user from source page to destination page. But there are some differences in between Response.Redirect and Server.Transfer, which i want to share with you.
Response.Redirect:
1. A round trip occurs to the

Friday, November 26, 2010

How to bind XML File or XML DataSource to a DataList Control in Asp.Net

DataList control is an important control in Asp.Net applications. Most of the times we need to bind DataList control from a Database using Ado.Net datasource. But sometimes we need to bind XML file as Datasource into a DataList control. Here in this article i will demonstrate how one can bind XML data into a DataList control using the datasource XmlDataSource. The output will be:


To do the

Web Parts Drag & Drop functionality in Asp.net Pages

It’s my first article on Asp.net Web Parts. Basically it’s an introduction article how one can start to learn the high end feature of Asp.net web parts. As you knew that most of the portal contains several block. In general the end user can not change the page block orientation or positioning which is termed as personalization. The Asp.net Web Parts gives us the personalization facility with

Thursday, September 30, 2010

Jquery to get set read access IFrame content TextBox Value Data

As you know that this days smart developers doesn't use IFRAME. But in our job always developers need to handle legacy systems. I found such type of legacy application. Now i am trying to modify the user requirement. To do that i need to read or access IFrame content as well as get or put some data from parent page to IFRAME. Since i did it thats why i want to share with you how one can access/

Tuesday, September 21, 2010

Jquery to get SelectedValue SelectedIndex SelectedText of a DropdownList in Asp.net

When you bind a DropdownList by data sometimes it may require to do something in the client side using javascript or jquery. To read the same post using javascript click here. In this article i will show you how one can get DropdownList SelectedValue, SelectedText & SelectedIndex. So that you can now play with Asp.net DropdownList control. The output like below:


An example of complete code is

Wednesday, August 4, 2010

How to prevent avoid Session Timeouts in an Asp.Net C# vb.net Page

As we knew that its a very big problem specially when developers provide a very large entry page to users. It will be Irritating for users after entering all data & then session timeout occur. To prevent or avoid session timeout problem, there is no fixed or specific or direct way to handle. But one can handle this problem using javascript asynchronous call. But one thing keep in mind that time

Tuesday, August 3, 2010

Maintaining Scroll Position after Asp.Net Page PostBack

Sometimes we need to Maintain scroll position after page postback specially if the page is a large page & user need to work in the middle portion of the page. In this article i will give you a simple tips on How to maintain Scroll Position after Asp.Net Page PostBack. To do that in the Page Directive of your large Asp.Net Page, add the property 'MaintainScrollPositionOnPostback' and set its value

Monday, August 2, 2010

Error: Specified string is not in the form required for an e-mail address

This error may occur when you are working with .net 1.1 means when using the namespace Sytstem.Web.Mail. If we want to send email to multiple or more than one person usually we use like:

To=aaaaaaa@gmail.com;bbbbbbbb@gmail.com;ccccccccc@gmail.com;

This will work in the namespace Sytstem.Web.Mail because here we use semicolon to split or separate email ID's.

But the ERROR: "Specified string is

Wednesday, July 28, 2010

How to bind or populate Dropdownlist from XML file

Few days ago i got an email from one of my reader. He wants more article on XML specially on Dropdownlist. Here in this article i will explain how one can bind or populate XML data into a Dropdownlist control. Asp.net DataSet provide us a method named ReadXml where we can initially load XML file. After that we can populate Dropdownlist DataTextField & DataValueField by DataSet default view table.

Sunday, July 25, 2010

How to convert ArrayList to Array in Asp.net C# VB.Net

In many cases developers have to create ArrayList to achieve dyanamic array functionalities. But sometimes you may need to convert the ArrayList to an array. For example if you are wnat to trnsfer csv data to ORACLE database then if you use bindarray then the conversion is required. Otherwise you won't to insert data into oracle databse. This is only one scenario but for lot of reasons you may

Creating Using Dynamic Array's in Asp.Net C# VB.Net

In some cases developers need to use dynamic arrays in Asp.net. But it’s not straight forward as like VB. If you were a VB developer then you knew that for dynamic array's VB uses REDIM keyword to generate dynamic array's. Here in this post i will discuss how developer can use dynamic arrays in asp.net pages. Basically there is no straight forward way to use but you can achieve the dynamic size

Sunday, May 16, 2010

How to read hidden field data in GridView Asp.net C#

In some cases developers need to collect more data instead of datakeynames. In that cases developers use hidden field to retain those important data. Here in this article i wil show how one can use hidden field to store some important data & how can read those. For simplicity here i use a product table & use ID in a hidden field to read them from server side SelectedIndexChanged event. The

Sunday, May 9, 2010

Master page image path problem in asp.net C#

As you knew that master page uses absolute image URL which cause problem to reference an image inside other folder. The problem occurs due to below reasons:

1. Master page is in the root folder
2. Images under another root folder
3. Aspx pages under another root folder

As a result you will get "Image not found" or "Image file path not exist" error.

Scenarios like below will help you to