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
Wednesday, March 25, 2009
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
[code]
function showseldate(obj)
{
if(obj.value!="")
{
seldate.innerHTML="<b>" + parseInt(document.calform.drpmonth.value)+1 + "/" + obj.value + "/" + document.calform.drpyear.value + "</b>";
} }
function changecalendar()
{
var m,y;
m=document.calform.drpmonth.value;
y=document.calform.drpyear.value;
displaycalendar(m,y);
}
function showcurcal()
{
var dt=new Date();
var m,y; m=dt.getMonth(); y=dt.getFullYear();
displaycalendar(m,y);
}
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();
clear();
for(var i=1;i<=nod;i++)
{
document.calform.txtday[wd].value=i;
if(i==curday)
{
document.calform.txtday[wd].style.backgroundColor="red";
document.calform.txtday[wd].style.color="white";
}
wd++;
}
}
function clear()
{
for(var i=0;i<42;i++)
{
document.calform.txtday[i].value="";
} }
[/code]
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
Script in Head Tag
[code]
function showseldate(obj)
{
if(obj.value!="")
{
seldate.innerHTML="<b>" + parseInt(document.calform.drpmonth.value)+1 + "/" + obj.value + "/" + document.calform.drpyear.value + "</b>";
} }
function changecalendar()
{
var m,y;
m=document.calform.drpmonth.value;
y=document.calform.drpyear.value;
displaycalendar(m,y);
}
function showcurcal()
{
var dt=new Date();
var m,y; m=dt.getMonth(); y=dt.getFullYear();
displaycalendar(m,y);
}
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();
clear();
for(var i=1;i<=nod;i++)
{
document.calform.txtday[wd].value=i;
if(i==curday)
{
document.calform.txtday[wd].style.backgroundColor="red";
document.calform.txtday[wd].style.color="white";
}
wd++;
}
}
function clear()
{
for(var i=0;i<42;i++)
{
document.calform.txtday[i].value="";
} }
[/code]
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
[code]
function prog1(objid)
{
var obj;
obj=window.document.getElementById(objid);
obj.style.backgroundColor="red";
obj.style.color="yellow";
}
function prog2(objid)
{
var obj;
obj=document.getElementById(objid);
obj.style.backgroundColor="yellow";
obj.style.color="red";
}
function blinktext()
{
if(p3.style.visibility=="visible")
{
p3.style.visibility="hidden";
}
else
{
p3.style.visibility="visible";
}
window.setTimeout("blinktext()",300);
}
[/code]
call binktext function onload of body tag and
in p tag use the following line
[code]
onmouseover="prog1('p1')" onmouseout="prog2('p1')"
[/code]
for more details please see the attachment
--
Thanks and Regards
Meetu Choudhary
[code]
function prog1(objid)
{
var obj;
obj=window.document.getElementById(objid);
obj.style.backgroundColor="red";
obj.style.color="yellow";
}
function prog2(objid)
{
var obj;
obj=document.getElementById(objid);
obj.style.backgroundColor="yellow";
obj.style.color="red";
}
function blinktext()
{
if(p3.style.visibility=="visible")
{
p3.style.visibility="hidden";
}
else
{
p3.style.visibility="visible";
}
window.setTimeout("blinktext()",300);
}
[/code]
call binktext function onload of body tag and
in p tag use the following line
[code]
onmouseover="prog1('p1')" onmouseout="prog2('p1')"
[/code]
for more details please see the attachment
--
Thanks and Regards
Meetu Choudhary
Labels:
Blinking Text Using JavaScript
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
System.Web.HttpContext.Current.Session["varname"].ToString()
Example:
[code]
System.Web.HttpContext.Current.Session["con1"].ToString()
[/code]
++
Thanks and Regards
Meetu Choudhary
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
System.Web.HttpContext.Current.Session["varname"].ToString()
Example:
[code]
System.Web.HttpContext.Current.Session["con1"].ToString()
[/code]
++
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
[code]
<%
//This page will be refreshed with each access!
Response.Expires=-1
%>
<%
//create connection object
set con=server.createobject("adodb.connection")
//Conection String and open the connection
call con.open("provider=msdasql;driver={Mysql};server=mysqlServerName;uid=username;pwd=password;database=dbnsme;")
//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>")
rs.movenext
wend
rs.close()
response.write("</table>")
//Update Process
//update query
//a will contain how mny records are modified
con.execute("Upadte Query goes here"),a
response.write(a & " records updated")
//response.write("Done")
//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
con.Close()
%>
<html>
<head></head>
<body>
<form action="#" method="post">
Any HTML CODE here will run perfectly. to display the page
</form>
</body>
</html>
//Trapping Errors in ASP.
//This will get the last error occurred.
<%
dim objErr
set objErr=Server.GetLastError()
response.write("ASPCode=" & objErr.ASPCode)
response.write("
")
response.write("ASPDescription=" & objErr.ASPDescription)
response.write("
")
response.write("Category=" & objErr.Category)
response.write("
")
response.write("Column=" & objErr.Column)
response.write("
")
response.write("Description=" & objErr.Description)
response.write("
")
response.write("File=" & objErr.File)
response.write("
")
response.write("Line=" & objErr.Line)
response.write("
")
response.write("Number=" & objErr.Number)
response.write("
")
response.write("Source=" & objErr.Source)
%>
[/code]
Thanks and Regards
Meetu Choudhary
Founder: http://www.msdotnetmentor.com
Here is an Sample Example Which Handles MYSQL 5.0 DataBase with .Net
[code]
<%
//This page will be refreshed with each access!
Response.Expires=-1
%>
<%
//create connection object
set con=server.createobject("adodb.connection")
//Conection String and open the connection
call con.open("provider=msdasql;driver={Mysql};server=mysqlServerName;uid=username;pwd=password;database=dbnsme;")
//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>")
rs.movenext
wend
rs.close()
response.write("</table>")
//Update Process
//update query
//a will contain how mny records are modified
con.execute("Upadte Query goes here"),a
response.write(a & " records updated")
//response.write("Done")
//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
con.Close()
%>
<html>
<head></head>
<body>
<form action="#" method="post">
Any HTML CODE here will run perfectly. to display the page
</form>
</body>
</html>
//Trapping Errors in ASP.
//This will get the last error occurred.
<%
dim objErr
set objErr=Server.GetLastError()
response.write("ASPCode=" & objErr.ASPCode)
response.write("
")
response.write("ASPDescription=" & objErr.ASPDescription)
response.write("
")
response.write("Category=" & objErr.Category)
response.write("
")
response.write("Column=" & objErr.Column)
response.write("
")
response.write("Description=" & objErr.Description)
response.write("
")
response.write("File=" & objErr.File)
response.write("
")
response.write("Line=" & objErr.Line)
response.write("
")
response.write("Number=" & objErr.Number)
response.write("
")
response.write("Source=" & objErr.Source)
%>
[/code]
Thanks and Regards
Meetu Choudhary
Founder: http://www.msdotnetmentor.com
Labels:
ASP page with database handling
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
0
1
2
3
4
5
6
7
8 * *
9 * *
10 * *
11
12
13 * *
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 ~
127
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 "
172
173 *
174 ®
175 ¯
176 °
177 ±
178 ²
179 ³
180 ´
181 µ
182
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
Founder: http://www.msdotnetmentor.com
Key Code
0
1
2
3
4
5
6
7
8 * *
9 * *
10 * *
11
12
13 * *
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 ~
127
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 "
172
173 *
174 ®
175 ¯
176 °
177 ±
178 ²
179 ³
180 ´
181 µ
182
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
Founder: http://www.msdotnetmentor.com
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...
[code]
str=”http://www.msdotnetheaven.com and http://www.msdotnetheaven.com”;
str = str.replace(/heaven/,”mentor”)
[/code]
The output
str=”http://www.msdotnetmentor.com and http://www.msdotnetheaven.com”;
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:
[code]
str=”http://www.msdotnetheaven.com and http://www.msdotnetheaven.com”;
str = str.replace(/heaven/g,”mentor”)
[/code]
The output
str=”http://www.msdotnetmentor.com and http://www.msdotnetmentor.com”;
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...
[code]
str=”http://www.msdotnetheaven.com and http://www.msdotnetheaven.com”;
str = str.replace(/heaven/,”mentor”)
[/code]
The output
str=”http://www.msdotnetmentor.com and http://www.msdotnetheaven.com”;
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:
[code]
str=”http://www.msdotnetheaven.com and http://www.msdotnetheaven.com”;
str = str.replace(/heaven/g,”mentor”)
[/code]
The output
str=”http://www.msdotnetmentor.com and http://www.msdotnetmentor.com”;
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
[code]
< head runat="server" >
< title > Upper Case < /title >
< style type="text/css" >
.test
{
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 >
[/code]
Thanks and Regards
Meetu Choudhary
founder: http://www.msdotnetmentor.com
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
[code]
< head runat="server" >
< title > Upper Case < /title >
< style type="text/css" >
.test
{
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 >
[/code]
Thanks and Regards
Meetu Choudhary
founder: http://www.msdotnetmentor.com
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 window.open method of the javascript which will help us to open a new window with controlled funcationalty.
a small snipet of code will look like
[code]
< a href="javascript:void(0)"onclick="window.open('http://www.msdotnetmentor.com')" >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 window.open() method takes in four arguments.
window.open('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="window.open('http://msdotnetheaven.com','welcome')">Open a new window </a>< a href="javascript:void(0)"onclick="window.open('http://www.msdotnetmentor.com','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="window.open('http://msdotnetheaven.com','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.
[code]
< a href="javascript:void(0)"onclick="window.open('http://www.msdotnetmentor.com','welcome','width=300,height=200,menubar=yes,status=yes,location=yes,toolbar=yes,scrollbars=yes')">Open a new window </a>
[/code]
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.
[code]
< a href="javascript:void(0)"onclick="window.open('http://www.msdotnetmentor.com','welcome','fullscreen=yes,scrollbars=yes')">Open a full screen window </a>
[/code]
Note: Firefox and Netscape also open a full sized window but show the title bar at top.
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 window.open method of the javascript which will help us to open a new window with controlled funcationalty.
a small snipet of code will look like
[code]
< a href="javascript:void(0)"onclick="window.open('http://www.msdotnetmentor.com')" >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 window.open() method takes in four arguments.
window.open('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="window.open('http://msdotnetheaven.com','welcome')">Open a new window </a>< a href="javascript:void(0)"onclick="window.open('http://www.msdotnetmentor.com','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="window.open('http://msdotnetheaven.com','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.
[code]
< a href="javascript:void(0)"onclick="window.open('http://www.msdotnetmentor.com','welcome','width=300,height=200,menubar=yes,status=yes,location=yes,toolbar=yes,scrollbars=yes')">Open a new window </a>
[/code]
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.
[code]
< a href="javascript:void(0)"onclick="window.open('http://www.msdotnetmentor.com','welcome','fullscreen=yes,scrollbars=yes')">Open a full screen window </a>
[/code]
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
[code]
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;
}
[/code]
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
Founder http://www.msdotnetmentor.com
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
[code]
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;
}
[/code]
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
Founder http://www.msdotnetmentor.com
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
[code]
< body style="overflow: hidden" >
[style type="text/css"]
body {
overflow-x: hidden;
overflow-y: scroll;
}
[/style]
[code]
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
Founder http://www.msdotnetmentor.com
[code]
< body style="overflow: hidden" >
[style type="text/css"]
body {
overflow-x: hidden;
overflow-y: scroll;
}
[/style]
[code]
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
Founder http://www.msdotnetmentor.com
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...
To use the Above function in a div we can write it like
Thanks and Regards
Meetu Choudhary
Founderhttp://msdotnetmentor.com
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
Founderhttp://msdotnetmentor.com
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.....
--
Thanks and Regards
Meetu Choudhary
[code]
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.
WebParts;
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("meetuchoudhary@gmail.com","meetudmeet@gmail.com","meetudmeet@yahoo.com","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;
try
{
MailAddress fromAddress = new MailAddress(from);
message.From = fromAddress;
message.To.Add(toList);
if (ccList != null && ccList != string.Empty)
message.CC.Add(ccList);
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = body;
smtpClient.Host = "mail.server.com";
smtpClient.Port = 25;
smtpClient.UseDefaultCredentials = true;
smtpClient.Credentials = new System.Net.NetworkCredential("info@server.com", "password");
smtpClient.Send(message);
msg = "Successful";
}
catch (Exception ex)
{
msg = ex.Message;
}
return msg;
}
}
[/code]
--
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
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 to:
Posts (Atom)
Subscribe via email
MSDotnetMentor
MSDotnetMentor
My Website
http://msdotnetmentor.com
Author
Blog Archive
-
▼
2009
(53)
-
▼
March
(14)
- Silverlight 3- Beta - released
- Creating Calender Using Java Script
- Blinking Text Using JavaScript
- Use a session variable in the class files in c# AS...
- ASP page with database handling
- Keycodes at a glance
- JavaScript String Replace All
- Type Text in Upper Case using CSS
- No scrollbar on HTML web pages - JavaScript code
- Transparent or Hide Scrollbar
- disable scroll bar
- Show or Hide combobox at Runtime using JavaScript
- Sending Email Through ASP.NET using C#
- Overview of ASP.Net Framework
-
▼
March
(14)