Wednesday, March 25, 2009

Silverlight 3- Beta - released

Silverlight 3- Beta - released

MicroSoft Released its Silverlight3 beta in MIX [conference for designers and developers at Las Vegas].

Its available for download at:

1. MicroSOft Silverlight 3 SDK Beta 1
2. MicroSoft Silverlight 3 Tools Beta 1 for Visual Studio 2008 SP1
3. The MicroSoft 3 beta Runtime

Tuesday, March 24, 2009

Creating Calender Using Java Script

Following is the JavaScript Code for the HTML File....the whole file is posted as an attachment please have a look on that for detailed Information...
Script in Head Tag
function showseldate(obj)
seldate.innerHTML="<b>" + parseInt(document.calform.drpmonth.value)+1 + "/" + obj.value + "/" + document.calform.drpyear.value + "</b>";
} }
function changecalendar()
var m,y;
function showcurcal()
var dt=new Date();
var m,y; m=dt.getMonth(); y=dt.getFullYear();
function displaycalendar(m,y)
var nod=numofdays(parseInt(m)+1,y);
var wd; var dt=new Date();
var curday=dt.getDate(); dt.setDate(1);
dt.setMonth(m); dt.setFullYear(y); wd=dt.getDay();
for(var i=1;i<=nod;i++)
function clear()
for(var i=0;i<42;i++)
} }
In Body[code]
for(var i=1;i<=6;i++)
document.write("tr bgcolor='#FFCC00' >");
for(var j=1;j<=7;j++)
document.write("td><div align='center'><input name='txtday' type='text' size='3' onclick='showseldate(this)' readonly></div></td>");
} document.write("</tr>"); }[/code]

Thanks and Regards
Meetu Choudhary

Monday, March 23, 2009

Blinking Text Using JavaScript

functions for the script tag in body
function prog1(objid)
var obj;
function prog2(objid)
var obj;
function blinktext()
call binktext function onload of body tag and
in p tag use the following line
onmouseover="prog1('p1')" onmouseout="prog2('p1')"

for more details please see the attachment
Thanks and Regards
Meetu Choudhary

Use a session variable in the class files in c# ASP.Net

To use the value of a session variable in the class files using c# with ASP.Net use the following statement

direct use of Session collection is not allowed in the .cs files so to achieve the purpose we have to follow the whole path i.e


Thanks and Regards
Meetu Choudhary

ASP page with database handling

ASP page with database handling

Here is an Sample Example Which Handles MYSQL 5.0 DataBase with .Net

//This page will be refreshed with each access!

//create connection object
set con=server.createobject("adodb.connection")
//Conection String and open the connection
//For Select Query Execution
set rs=con.execute("select * from tablename )
//displaying the records in a table format
//loop till rs has records
while not rs.eof
response.write("<tr><td>" & rs.fields(0) & "</td><td>" & rs.fields(1) & "</td></tr>")

//Update Process

//update query
//a will contain how mny records are modified
con.execute("Upadte Query goes here"),a
response.write(a & " records updated")

//Insert Process

//insert query
con.execute("insert into RegClLog (SrNo,ProdKey,ClDtTm) values('"& request.form("hidSrno") &"','"& request.form("hidResult") &"','"& request.form("hidClDtTym") &"') "),a
response.write(a & " records Inserted")

//close connection

<form action="#" method="post">
Any HTML CODE here will run perfectly. to display the page


//Trapping Errors in ASP.
//This will get the last error occurred.
dim objErr
set objErr=Server.GetLastError()
response.write("ASPCode=" & objErr.ASPCode)
response.write("ASPDescription=" & objErr.ASPDescription)
response.write("Category=" & objErr.Category)
response.write("Column=" & objErr.Column)
response.write("Description=" & objErr.Description)
response.write("File=" & objErr.File)
response.write("Line=" & objErr.Line)
response.write("Number=" & objErr.Number)
response.write("Source=" & objErr.Source)


Thanks and Regards
Meetu Choudhary

Keycodes at a glance

While working in the real time development environment some times we feel a great need to know the key codes by which a character is represented. as the computer does not understands the graphical representation but using the keycodes and keyascii we can trace the character used by the user so here is the list for your use. keeping in mind the windows operation system.

Key Code

8 * *
9 * *
10 * *
13 * *
32 [space]
33 !
34 "
35 #
36 $
37 %
38 &
39 '
40 (
41 )
42 *
43 +
44 ,
45 -
46 .
47 /
48 0
49 1
50 2
51 3
52 4
53 5
54 6
55 7
56 8
57 9
58 :
59 ;
60 <
61 =
62 >
63 ?
64 @
65 A
66 B
67 C
68 D
69 E
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
80 P
81 Q
82 R
83 S
84 T
85 U
86 V
87 W
88 X
89 Y
90 Z
91 [
92 \
93 ]
94 ^
95 _
96 `
97 a
98 b
99 c
100 d
101 e
102 f
103 g
104 h
105 i
106 j
107 k
108 l
109 m
110 n
111 o
112 p
113 q
114 r
115 s
116 t
117 u
118 v
119 w
120 x
121 y
122 z
123 {
124 |
125 }
126 ~
128 €
129 
130 ‚
131 ƒ
132 "
133 …
134 †
135 ‡
136 ˆ
137 ‰
138 Š
139 ‹
140 Œ
141 
142 Ž
143 
144 
145 '
146 '
147 "
148 "
149 o
150 -
151 -
152 ˜
153 ™
154 š
155 ›
156 œ
157 
158 ž
159 Ÿ
160 [space]
161 ¡
162 ¢
163 £
164 ¤
165 ¥
166 ¦
167 §
168 ¨
169 ©
170 ª
171 "
173 *
174 ®
175 ¯
176 °
177 ±
178 ²
179 ³
180 ´
181 µ
183 ·
184 ¸
185 ¹
186 º
187 "
188 ¼
189 ½
190 ¾
191 ¿
192 À
193 Á
194 Â
195 Ã
196 Ä
197 Å
198 Æ
199 Ç
200 È
201 É
202 Ê
203 Ë
204 Ì
205 Í
206 Î
207 Ï
208 Ð
209 Ñ
210 Ò
211 Ó
212 Ô
213 Õ
214 Ö
215 ×
216 Ø
217 Ù
218 Ú
219 Û
220 Ü
221 Ý
222 Þ
223 ß
224 à
225 á
226 â
227 ã
228 ä
229 å
230 æ
231 ç
232 è
233 é
234 ê
235 ë
236 ì
237 í
238 î
239 ï
240 ð
241 ñ
242 ò
243 ó
244 ô
245 õ
246 ö
247 ÷
248 ø
249 ù
250 ú
251 û
252 ü
253 ý
254 þ
255 ÿ

The Symbol :  represents those characters which are not supported by Microsoft Windows.

The Values 8, 9, 10, and 13 are converted into backspace, tab, linefeed, and carriage return characters, respectively.
They can not be graphically represented but, depending on the application, they can affect the visual display of text.

The values in the table are the Windows default.
where as, values in the ANSI character set above 127 are determined by the code page which is specific to the operating system.

Thanks and Regards
Meetu Choudhary

Saturday, March 14, 2009

JavaScript String Replace All

JavaScript String Replace All

Today When I was working I came across the need to replace all the “’” marks with null or with nothing like “” as the “’” mark produces an error while handling with database I have the StringBuldier Class and could replace all at once but to use that it will be a server side code that means irrespective of anything on textchanged event the page should be postback so I decided to use the JavaScript function replace ()

Now the problem with this JavaScript String Replace function is that it replaces the first occurrence in the string. It takes two simple parameters. The first parameter is the pattern to find and the second parameter is the string to replace the pattern with when found. The JavaScript function does not Replace All...


str=” and”;

str = str.replace(/heaven/,”mentor”)


The output

str=” and”;

To make the replace function of the JavaScript to replace all the occurrences of the matched string we have to apply a trick and the trick is, use the g modifier like this:


str=” and”;

str = str.replace(/heaven/g,”mentor”)


The output

str=” and”;

Friday, March 13, 2009

Type Text in Upper Case using CSS

Type Text in Upper Case using CSS

While working with web application forms. When we create the forms which can be filled online and then printed to submit we came across the need that the particular textbox such as Name or Father’s Name should be filled in capital letters as most of the conventional forms need this. To accomplish this task we can take help of the CSS property by writing a single line code we can lower our most of the extra work and can concentrate on other parts of the code here is a small example to achieve what I have described above. Here we go:

Type Text in Upper Case using CSS


< head runat="server" >
< title > Upper Case < /title >
< style type="text/css" >
text-transform: uppercase;
< /style >
< /head >
< body >
< form id="form1" runat="server" >
< div >

< /div >
< asp:TextBox ID="TextBox1" runat="server" CssClass="test" > < /asp:TextBox >
< /form >
< /body >


Thanks and Regards
Meetu Choudhary

No scrollbar on HTML web pages - JavaScript code

No scrollbar on HTML web pages - JavaScript code

In my previous article I described how we can hide a scrollbar from user's view by putting the same color value as the web page.

What I have described in that article is absolutly fine for those web pages whose content fits in the browser display area because Netscape and Mozilla display no scrollbars for such pages and as far as IE is concern the scrollbar can be made transparent or hidden as it recognizes the CSS scrollbar properties. Even, if the page content is more than the browser display area, IE would show transparent or hidden scrollbar as it understands the css properties of the scrollbar but in case of Netscape and Mozilla they will display a scrollbar.

So the need arises to create cross-browser compatible web page windows with no scrollbars to accomplish this purpose we have to take help of little JavaScript code.

Note: But again a drawback is that it will not work on browsers that do not supports JavaScript or have JavaScript turned off.

We will use the method of the javascript which will help us to open a new window with controlled funcationalty.

a small snipet of code will look like


< a href="javascript:void(0)"onclick="'')" >Open a new window < /a>[/code] The open method is of the window object and in the above code it is taking an argument i.e. the ame of the webpage to be opened. and the onclick is a JavaScript event handler which is used to invoke the function in our case.

Bacically the JavaScript method takes in four arguments.'URL', 'NAME', 'FEATURES', 'REPLACE')By default, If we provide the filename of a web page through the first argument, it will be loaded in the new window.

NAME: specifies a name for the new window which can be used as value for the target attribute of < a > tags.

FEATURES: let you define properties of the window such as width, height, presence or absence of scrollbars, location bar, status bar etc.

REPLACE: takes a boolean value... we won't bother ourselves with this argument!

[code]< a href="javascript:void(0)"onclick="'','welcome')">Open a new window </a>< a href="javascript:void(0)"onclick="'','welcome','width=300,height=200')">Open a new window </a>[/code]List of important FEATURESheight: Specifies height of the new window in pixels. width: width of the new window in pixels location: determines the presence of the location bar menubar: menubar scrollbars: scrollbars status: status bar toolbar: toolbar directories: specifies the display of link buttons resizable: determines whether the window can be resized. If it's absent or its value is set 'no', the window does not have resize handles around its border. fullscreen: Specific to the Internet Explorer, it determines whether the window is displayed in the full screen mode. In the new window please notice that It is not having any scrollbars, location bar, status bar, menubar, toolbar or buttons!
The width and the height take a number (pixels) as value, for other features the value is either a yes or no.

[code]< a href="javascript:void(0)"onclick="'','welcome','width=300,height=200,menubar=yes,status=yes')">Open a new window </a>[/code]

This window has the menu and the status bars. The others are absent since we didn't specify them.


< a href="javascript:void(0)"onclick="'','welcome','width=300,height=200,menubar=yes,status=yes,location=yes,toolbar=yes,scrollbars=yes')">Open a new window </a>

The fullscreen feature is specific to this browser and displays the document on the entire screen. A neat effect... sort of! Click on the F11 to remove the full screen display.

< a href="javascript:void(0)"onclick="'','welcome','fullscreen=yes,scrollbars=yes')">Open a full screen window </a>

Note: Firefox and Netscape also open a full sized window but show the title bar at top.

Wednesday, March 11, 2009

Transparent or Hide Scrollbar

Transparent or Hide Scrollbar

Sometimes when < body style="overflow: hidden" > property doesnt workswith some broswers then we have the alternative that we must hide it by making it transpernt or coloring it as the page is.

To create a transparent scrollbar or hide it from view, What we need is to work with the css properties of the scrollbar. for our assistance I am here mentionning the cascading style sheet properties.

Note: These properties are recognized by Internet Explorer (5.5 and above) and are ignored by FireFox, Opera and Netscape.

scrollbar-track-color: Sets the color for scroll bar track
scrollbar-face-color: Sets the color for the scroll bar slider
scrollbar-arrow-color: Sets the scroll bar arrow color
scrollbar-3dlight-color: Sets the scroll bar 3D light color
scrollbar-highlight-color: Sets the scroll bar highlight color
scrollbar-shadow-color: Sets the scroll bar shadow color
scrollbar-darkshadow-color: Sets the scroll bar dark shadow color

When does a web page display a scrollbar?
When the content overflows the display area on a browser a web page displays a scrollbar. The controll of the display area on a web browser is monitored and ruled by several factors some of them are the screen resolution, installed toolbars, browser configuration (text size, display of large or small icons), view/hide status bar etc. If the page is long, the browser displays a scrollbar on the right and if the width of the page set at a higher value then the horizontal scrollbar will be added in the browser window.

Sometimes when the page content is less than the display area in a browser.

Different Browsers behave differently if the page fits in the display area. Internet Explorer displays a "grayed" scrollbar while Netscape and Mozilla do not show a scrollbar.

Even if the page content fits nicely in the display area, IE will show a scrollbar. which we may not want to display or just we want to hide it from the user

we have to set the following style properties you may add this in the head section of the page or may use it in external stylesheet

makes the scrollbar transparent.

considering that the page background color is white


html {
background-color: #FFFFFF;
scrollbar-shadow-color: #FFFFFF;
scrollbar-highlight-color: #FFFFFF;
scrollbar-face-color: #FFFFFF;
scrollbar-3dlight-color: #FFFFFF;
scrollbar-darkshadow-color: #FFFFFF;
scrollbar-track-color: #FFFFFF;
scrollbar-arrow-color: #FFFFFF;

Note:-- Basically we are setting the color of the scroll bar as the page to give it a feel of transprancy but it will be there

Thanks and Regards
Meetu Choudhary

disable scroll bar

In some cases we would like to disable the scroll bar on the page in that case we can use the following lines in the appropiate section of the .aspx page. the code is as follows


< body style="overflow: hidden" >

[style type="text/css"]

body {
overflow-x: hidden;
overflow-y: scroll;



Note: That all browsers doest not support this method (for instance IE for Mac still shows the scrollbars).

in my next article i will post the code how to handle those browsers...

Thanks and Regards
Meetu Choudhary

Tuesday, March 10, 2009

Show or Hide combobox at Runtime using JavaScript

Show or Hide combobox at Runtime using JavaScript

Many a times in the programming world we feel the need to hide or show the dropdown lists or combo boxes of the particular page or a div or anyother control so here is a small snippet

The Following is the JavaScript function to achieve the above you can embede it in any external JavaScript file or write as an inline script or include in the head section...

function showOrHideAllDropDowns(newState)

var elements = document.documentElement.getElementsByTagName('select');

for (var i=0; i
elements[i].style.visibility = newState;
} }

To use the Above function in a div we can write it like

< style="width:220px;" onmouseover="showOrHideAllDropDowns('hidden');" onmouseout="showOrHideAllDropDowns('visible');">

Thanks and Regards
Meetu Choudhary

Saturday, March 7, 2009

Sending Email Through ASP.NET using C#

The following Sample Code is the code which can be used to send mails through ASP.Net C#.... its a working code for me.....

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.
using System.Web.UI.HtmlControls;
using System.Net.Mail;

public partial class Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
protected void Button1_Click(object sender, EventArgs e)
//Calling the function SendMail
Response.Write( SendMail("","","","Test Mail","Test Mail Body"));

public string SendMail(string toList, string from, string ccList, string subject, string body)
MailMessage message = new MailMessage();
SmtpClient smtpClient = new SmtpClient();
string msg = string.Empty;
MailAddress fromAddress = new MailAddress(from);
message.From = fromAddress;
if (ccList != null && ccList != string.Empty)
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = body;
smtpClient.Host = "";
smtpClient.Port = 25;
smtpClient.UseDefaultCredentials = true;
smtpClient.Credentials = new System.Net.NetworkCredential("", "password");

msg = "Successful";
catch (Exception ex)
msg = ex.Message;
return msg;


Thanks and Regards
Meetu Choudhary

Overview of ASP.Net Framework

ASP.NET and the .NET Framework

ASP.NET is part of the Microsoft .NET Framework. To build ASP.NET pages, you need to take advantage of the features of the .NET Framework. The .NET Framework consists of two parts: The Framework Class Library (FCL) & The Common Language Runtime (CLR).

Understanding the Framework Class Library

The .NET Framework contains thousands of classes that you can use when building an application. The Framework Class Library was designed to make it easier to perform the most common programming tasks.
Some Examples are

File class Enables you to represent a file on your hard drive.

Graphics class Enables you to work with different types of images such as GIF, PNG, BMP, and JPEG images.

These are some examples of classes in the Framework. The .NET Framework contains almost 13,000 classes you can use when building applications.

You can view all the classes contained in the Framework by opening the Microsoft .NET Framework SDK documentation and expanding the Class Library node

Subscribe via email

Enter your email address:

Delivered by FeedBurner


MSDotnetMentor My Website