Monday, March 7, 2011

ASP.Net : Load XML from String

If you are interested to know how to load XML from a string rather than from a file, then this tutorial says it all:

http://www.xmlplease.com/create-xml-parse#s2.

The first line is very important, don't miss it.

** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**

Friday, March 4, 2011

ASP.Net: Printing raw xml .

I was trying to print a raw xml string. Browser was omitting the xml tags at the time of display. Then I searched through the internet and found that ASP.Net has a pretty cool widget named Literal. Using this widget, it is very simple to print xml string without the xml tags omitted by the browser. Here is an example code snippet:

1) Add the literal object.

2) Then just use this literal object like a label:

Literal1.Text = XMLString;

Is not it cool!!!

Thursday, March 3, 2011

ASP.net : Post data to another page programmatically without a form submit button.

I was working on a project where I had to pass some value securely to a php script from an ASP.NET page. I found that .NET web request and web response class is there to do this task. Here is the MSDN provided tutorial on how to use these two classes to sent the data through post method and get the response.

http://msdn.microsoft.com/en-us/library/debx8sh9.aspx

In the receiving page, I need to write the data through Response.write (for ASP.net) or echo(for php). The response is automatically sent to the requesting page.

Is not it cool!!

** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**

Friday, February 18, 2011

Finding HTML controls from ASP.NET

Here is the article that says ins and outs of this issue.

http://www.asp.net/master-pages/tutorials/control-id-naming-in-content-pages-cs

** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**

Friday, February 11, 2011

ASP.NET: Check a file for its MIME type.

If you want to check a file file for its MIME type, this is the link that tells you how to do it. I used this link when I checked MIME type of a file with ASP.NET file uploader tool.

http://tiredblogger.wordpress.com/2008/04/07/verifying-extensions-and-mime-types-of-fileupload/

** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**

Thursday, February 10, 2011

ASP.NET : How to use customvalidator with a file upload tool for client side validation

We really do not want to validate in the server side because it makes the server busy.
So a good approach is to validate in the client side using javascript. Here is a good tutorial that does it:

http://www.beansoftware.com/ASP.NET-FAQ/FileUpload-Validation.aspx

** I believe when there are so many quality tutorials over the web, I do not really need to write one of my own unless the topic is something unique**

Javascript: split method can be used to split based on string or regular expression.

If you want to split a string based on another string, this how you do it:
str.split(" ");

If you want to split a string based on a reges, this how you do it:
str.split(/\s/);

\s is a reges which is used for any space character like space,\n,\t or \r.