Sunday 13 November 2011

Custom Exception

The Microsoft .NET team has done a good job by providing us a rich set of Exception classes. Most of the time, these exception classes are sufficient enough to handle any common error situation. However, it may be required that our application would need some additional exception classes, that are not available in .NET Framework.

Friday 11 November 2011

State Management

What is ViewState?

ViewState allows the state of objects (serializable) to be stored in a hidden field on the page.  ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.  ViewState is used the retain the state of server-side objects between postabacks.

Tuesday 8 November 2011

excel to sql


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb" Inherits="Default3" %>

Friday 4 November 2011

jquery



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

HTML 5



<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Untitled Page</title>
    <script type="text/javascript" language="javascript" >
    if (localStorage.pagecount)
 {
 localStorage.pagecount=Number(localStorage.pagecount) +1;
 }
else
 {
 localStorage.pagecount=1;
 }
document .write ("Visits: " + localStorage.pagecount + " time(s).");
if (sessionStorage.pagecount)
 {
 sessionStorage.pagecount=Number(sessionStorage.pagecount) +1;
 }
else
 {
 sessionStorage.pagecount=1;
 }
document .write ("Visits " + sessionStorage.pagecount + " time(s) this session.");
    </script>
</head>
<body>
<form action=''>
<video width="320" height="240" controls="controls">
  <source src="http://www.w3schools.com/html5/movie.mp4" type="video/mp4" />
  <source src="movie.ogg" type="video/ogg" />
  Your browser does not support the video tag.
</video>
<div id="support1"></div>
<div id ="support"></div>
Name: <input type="text" name="usr_name" required="required" /><br />
Image :<input type="image" src="/images/logo.png" width="40" height="40" /><br />
E-mail: <input type="email" name="user_email" /><br />
URL   : <input type ="url" name ="user_url" /><br />
number: <input type ="number" min="1" max="10" /><br />
Range :<input type="range" name="points" min="1" max="10" /><br />
Date  : <input type="date" name="user_date" /><br />
Color : <input type="color" name="user_color" /><br />
Select images: <input type="file" name="img" multiple="multiple" /></br/>
Points: <input type="number" name="points" min="0" max="10" step="3" /><br />
Country code: <input type="text" name="country_code"
pattern="[A-z]{3}" title="Three letter country code" />
Webpage: <input type="url" list="url_list" name="link" />
<datalist id="url_list">
<option label="160by2" value="http://www.160by2.com" />
<option label="Google" value="http://www.google.com" />
<option label="Microsoft" value="http://www.microsoft.com" />
</datalist><br />
Username: <input type="text" name="usr_name" />
Encryption: <keygen name="security" />

<input type ="submit" value="submit" />

</form>
<hr />
<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0
<input type="range" name="a" value="50" />100
+<input type="number" name="b" value="50" />
=<output name="x" for="a b"></output>
<input type ="submit" value="submit" />
</form><hr />

<form action="eachjquery.htm" id="form_un" method="get" autocomplete="on">
First name: <input type="text" name="fname" /><br />
Last name: <input type="text" name="lname" /><br />
E-mail: <input type="email" name="email" autocomplete="off" /><br />
<input type="submit" />
</form><hr />

<form action="demo_form.asp" method="get" id="user_form">
E-mail: <input type="email" name="userid" /><br />
<input type="submit" value="Submit" />
<br />
<input type="submit" formaction="demo_admin.asp" value="Submit as admin" />
<br />
<input type="submit" formnovalidate="true"
value="Submit without validation" />
<br />
</form><hr />

<form action="demo_form.asp" novalidate="novalidate">
E-mail: <input type="email" name="user_email" />
<input type="submit" />
</form><hr />
User name: <input type="text" name="user_name" form="form_un"  autofocus="autofocus" />
<article>hihihihi
hihi
dsd
sdsds</article>
<menu>
<command onclick="alert('Hello World')">
Click Me!</command>
</menu>
<cite>click me</cite>
<embed src="http://w3schools.com/html5/helloworld.swf" />
hihihiihiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii<wbr/>iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiihihiihellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello123113333hellohellohellohellohellohellohellohellohellohello


</body>
</html>

What?s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?


CodeBehind is relevant to Visual Studio.NET only

         Code All build Assembly is placed inside the bin folder
Src the source cs file/vb fiel is placed in the source
folder and the source file is complied and assembly is
placed inside bin folder during runtime of the aspx page.

Cross Page Post backing in .NET


Asp.Net 2.0 fixed this with built-in features that allowed us to easily send information from one page to another.

Button control has property PostBackUrl that can be set to URL of any page in our ASP.Net WebSite where we want to transfer all form values to.