DotNet Academy of Rajesh Rolen

Solutions by Rajesh Rolen

Check / Unheck all checkboxes of HTML Table

Lets we have a HTML Table whose id=tblemail and it contain many rows and every row contains a check box.. and this HTML table contains check box in its header.. so when i click on checkbox of header then all checkboxes of rows of that table should be checked/ unchecked according to check box in header...

< table id="tblemail" border="1" style="text-align: left" width="80%" class="border" >
< tr >
< th >
Select Your choices
< /th >
< th >
< asp:CheckBox ID="cbSelectAll" runat="server" / >
< /th >
< /tr >
< tr >
< td >
I want to send message
< /td >
< td >
< asp:CheckBox ID="chkmsg" runat="server" / >
< /td >
< /tr >
< tr >
< td >
i want to receive message
< /td >
< td >
< asp:CheckBox ID="chkrcvmsg" runat="server" / >
< /td >
< /tr >

< /table >




below is java script function code to check/uncheck all checkboxes of a HTML table:
< script language="javascript" type="text/javascript" >

function SelectAll(id) {

var frm = document.getElementById('tblemail').getElementsByTagName("input");
var len = frm.length;

for (i=0;i< len;i++)
{
if (frm[i].type == "checkbox")
{
frm[i].checked = document.getElementById(id).checked;
}
}


}

< /script >



add below line in page_load so that it will add click event to selectall check box:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If (Not IsPostBack) Then
cbSelectAll.Attributes.Add("onclick", "javascript:SelectAll('" & cbSelectAll.ClientID & "')")
end if
end sub

Check / Unheck all checkboxes of HTML Table

Lets we have a HTML Table whose id=tblemail and it contain many rows and every row contains a check box.. and this HTML table contains check box in its header.. so when i click on checkbox of header then all checkboxes of rows of that table should be checked/ unchecked according to check box in header...

< table id="tblemail" border="1" style="text-align: left" width="80%" class="border" >
< tr >
< th >
Select Your choices
< /th >
< th >
< asp:CheckBox ID="cbSelectAll" runat="server" / >
< /th >
< /tr >
< tr >
< td >
I want to send message
< /td >
< td >
< asp:CheckBox ID="chkmsg" runat="server" / >
< /td >
< /tr >
< tr >
< td >
i want to receive message
< /td >
< td >
< asp:CheckBox ID="chkrcvmsg" runat="server" / >
< /td >
< /tr >

< /table >




below is java script function code to check/uncheck all checkboxes of a HTML table:
< script language="javascript" type="text/javascript" >

function SelectAll(id) {

var frm = document.getElementById('tblemail').getElementsByTagName("input");
var len = frm.length;

for (i=0;i< len;i++)
{
if (frm[i].type == "checkbox")
{
frm[i].checked = document.getElementById(id).checked;
}
}


}

< /script >



add below line in page_load so that it will add click event to selectall check box:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If (Not IsPostBack) Then
cbSelectAll.Attributes.Add("onclick", "javascript:SelectAll('" & cbSelectAll.ClientID & "')")
end if
end sub

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.

What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.

What methods are fired during the page load?

Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

What methods are fired during the page load?

Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

What is the difference between Response.Write() andResponse.Output.Write()?

Response.Output.Write() allows you to write formatted output.
for eg:
it is very similer to console.write which we use in c#.net(console programming)
we use place holders for formated output...

Response.Output.Write("

Item: {0}, Cost: ${1}

",item.Description, item.Cost);

What is the difference between Response.Write() andResponse.Output.Write()?

Response.Output.Write() allows you to write formatted output.
for eg:
it is very similer to console.write which we use in c#.net(console programming)
we use place holders for formated output...

Response.Output.Write("

Item: {0}, Cost: ${1}

",item.Description, item.Cost);

What is the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process?

inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.

actually mainly inetinfo.exe:
Inetinfo.exe is the ASP.Net request handler that handles the requests from the client .If it's for static resources like HTML files or image files inetinfo.exe process the request and sent to client. If the request is with extension aspx/asp, inetinfo.exe processes the request to API filter.

What is the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process?

inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.

actually mainly inetinfo.exe:
Inetinfo.exe is the ASP.Net request handler that handles the requests from the client .If it's for static resources like HTML files or image files inetinfo.exe process the request and sent to client. If the request is with extension aspx/asp, inetinfo.exe processes the request to API filter.

What is the maximum possible length of a query string?

Many of times this question have been asked while interview or we also should know that how much characters a query string can contain....

Although the specification of the HTTP protocol does not specify any maximum length, practical limits are imposed by web browser and server software.

Microsoft Internet Explorer (Browser)

Microsoft states that the maximum length of a URL in Internet Explorer is 2,083 characters, with no more than 2,048 characters in the path portion of the URL. In my tests, attempts to use URLs longer than this produced a clear error message in Internet Explorer.

Firefox (Browser)

After 65,536 characters, the location bar no longer displays the URL in Windows Firefox 1.5.x. However, longer URLs will work. I stopped testing after 100,000 characters.

Safari (Browser)

At least 80,000 characters will work. I stopped testing after 80,000 characters.

Opera (Browser)

At least 190,000 characters will work. I stopped testing after 190,000 characters. Opera 9 for Windows continued to display a fully editable, copyable and pasteable URL in the location bar even at 190,000 characters.

Apache (Server)

My early attempts to measure the maximum URL length in web browsers bumped into a server URL length limit of approximately 4,000 characters, after which Apache produces a "413 Entity Too Large" error. I used the current up to date Apache build found in Red Hat Enterprise Linux 4. The official Apache documentation only mentions an 8,192-byte limit on an individual field in a request.

Microsoft Internet Information Server (Server)

The default limit is 16,384 characters (yes, Microsoft's web server accepts longer URLs than Microsoft's web browser). This is configurable.

Perl HTTP::Daemon (Server)

Up to 8,000 bytes will work. Those constructing web application servers with Perl's HTTP::Daemon module will encounter a 16,384 byte limit on the combined size of all HTTP request headers. This does not include POST-method form data, file uploads, etc., but it does include the URL. In practice this resulted in a 413 error when a URL was significantly longer than 8,000 characters. This limitation can be easily removed. Look for all occurrences of 16x1024 in Daemon.pm and replace them with a larger value. Of course, this does increase your exposure to denial of service attacks.

What is the maximum possible length of a query string?

Many of times this question have been asked while interview or we also should know that how much characters a query string can contain....

Although the specification of the HTTP protocol does not specify any maximum length, practical limits are imposed by web browser and server software.

Microsoft Internet Explorer (Browser)

Microsoft states that the maximum length of a URL in Internet Explorer is 2,083 characters, with no more than 2,048 characters in the path portion of the URL. In my tests, attempts to use URLs longer than this produced a clear error message in Internet Explorer.

Firefox (Browser)

After 65,536 characters, the location bar no longer displays the URL in Windows Firefox 1.5.x. However, longer URLs will work. I stopped testing after 100,000 characters.

Safari (Browser)

At least 80,000 characters will work. I stopped testing after 80,000 characters.

Opera (Browser)

At least 190,000 characters will work. I stopped testing after 190,000 characters. Opera 9 for Windows continued to display a fully editable, copyable and pasteable URL in the location bar even at 190,000 characters.

Apache (Server)

My early attempts to measure the maximum URL length in web browsers bumped into a server URL length limit of approximately 4,000 characters, after which Apache produces a "413 Entity Too Large" error. I used the current up to date Apache build found in Red Hat Enterprise Linux 4. The official Apache documentation only mentions an 8,192-byte limit on an individual field in a request.

Microsoft Internet Information Server (Server)

The default limit is 16,384 characters (yes, Microsoft's web server accepts longer URLs than Microsoft's web browser). This is configurable.

Perl HTTP::Daemon (Server)

Up to 8,000 bytes will work. Those constructing web application servers with Perl's HTTP::Daemon module will encounter a 16,384 byte limit on the combined size of all HTTP request headers. This does not include POST-method form data, file uploads, etc., but it does include the URL. In practice this resulted in a 413 error when a URL was significantly longer than 8,000 characters. This limitation can be easily removed. Look for all occurrences of 16x1024 in Daemon.pm and replace them with a larger value. Of course, this does increase your exposure to denial of service attacks.

Date Difference in JavaScript

Date Difference in JavaScript

Make HTML textbox readonly

to make html textbox readonly follow below steps:
make Html textbox runat="server"

and in codding write
txtname.Disabled = True

Make HTML textbox readonly

to make html textbox readonly follow below steps:
make Html textbox runat="server"

and in codding write
txtname.Disabled = True

Optional Nullable Parameter introduced in VB.NET 10

In previous editions like .net framework 2.0/3.0/3.5 we were not able to create a Optional parameter as a nullable in vb.net. but now its time to get happy. you can create Nullable Optional Parameter in VB.NET 10.

eg:

Sub MyFunc(ByVal _name As String, ByVal _email As String, Optional ByVal _age As Integer? = Nothing)
your code
end sub



Benefit: The benefit of Nullable Optional Parameter is that if you want to pass value then it will take value if you will not pass value then it will take 'Nothing' in that parameter then before using that parameter you can easily check that value is Nothing or not

like:

if _age isnot Nothing then
your code
end if

Optional Nullable Parameter introduced in VB.NET 10

In previous editions like .net framework 2.0/3.0/3.5 we were not able to create a Optional parameter as a nullable in vb.net. but now its time to get happy. you can create Nullable Optional Parameter in VB.NET 10.

eg:

Sub MyFunc(ByVal _name As String, ByVal _email As String, Optional ByVal _age As Integer? = Nothing)
your code
end sub



Benefit: The benefit of Nullable Optional Parameter is that if you want to pass value then it will take value if you will not pass value then it will take 'Nothing' in that parameter then before using that parameter you can easily check that value is Nothing or not

like:

if _age isnot Nothing then
your code
end if

Improve Query Performance using "With" Clause

Using with clause we can improve query performance.
Read complete Article

Improve Query Performance using "With" Clause

Using with clause we can improve query performance.
Read complete Article

Open popup window using JavaScript

if we want to open a popup window using javascript we can do it by using following function:
javascript:showWindow('mypage.aspx"',800,600,50)

How to use it?

if you want to open popup window using Anchor tag of Html:
< a href='javascript:showWindow('mypage.aspx"',800,600,50)' >click me< /a >

open popup window using Html Button:

< input type="button" id="btnmap" name="btnmap" value="Map" onclick ='javascript:showWindow(< %# """MapDSHotelDetail.aspx?hotelname=" &container.dataitem("hotelname")& "&cityid=" & container.dataitem("cityid") & "&countryid=" & ddlcountry.selectedvalue &"""" % >,800,600)'/ >

Open popup window using JavaScript

if we want to open a popup window using javascript we can do it by using following function:
javascript:showWindow('mypage.aspx"',800,600,50)

How to use it?

if you want to open popup window using Anchor tag of Html:
< a href='javascript:showWindow('mypage.aspx"',800,600,50)' >click me< /a >

open popup window using Html Button:

< input type="button" id="btnmap" name="btnmap" value="Map" onclick ='javascript:showWindow(< %# """MapDSHotelDetail.aspx?hotelname=" &container.dataitem("hotelname")& "&cityid=" & container.dataitem("cityid") & "&countryid=" & ddlcountry.selectedvalue &"""" % >,800,600)'/ >

Colors in CSS

If you are not a regular regular designer or you don't remember names of different colors provided by CSS.Then this is list of all Mostly used colors of CSS:































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Color NameHEXColorShadesMix
AliceBlue #F0F8FF
ShadesMix
AntiqueWhite #FAEBD7
ShadesMix
Aqua #00FFFF
ShadesMix
Aquamarine #7FFFD4
ShadesMix
Azure #F0FFFF
ShadesMix
Beige #F5F5DC
ShadesMix
Bisque #FFE4C4
ShadesMix
Black #000000
ShadesMix
BlanchedAlmond #FFEBCD
ShadesMix
Blue #0000FF
ShadesMix
BlueViolet #8A2BE2
ShadesMix
Brown #A52A2A
ShadesMix
BurlyWood #DEB887
ShadesMix
CadetBlue #5F9EA0
ShadesMix
Chartreuse #7FFF00
ShadesMix
Chocolate #D2691E
ShadesMix
Coral #FF7F50
ShadesMix
CornflowerBlue #6495ED
ShadesMix
Cornsilk #FFF8DC
ShadesMix
Crimson #DC143C
ShadesMix
Cyan #00FFFF
ShadesMix
DarkBlue #00008B
ShadesMix
DarkCyan #008B8B
ShadesMix
DarkGoldenRod #B8860B
ShadesMix
DarkGray #A9A9A9
ShadesMix
DarkGreen #006400
ShadesMix
DarkKhaki #BDB76B
ShadesMix
DarkMagenta #8B008B
ShadesMix
DarkOliveGreen #556B2F
ShadesMix
Darkorange #FF8C00
ShadesMix
DarkOrchid #9932CC
ShadesMix
DarkRed #8B0000
ShadesMix
DarkSalmon #E9967A
ShadesMix
DarkSeaGreen #8FBC8F
ShadesMix
DarkSlateBlue #483D8B
ShadesMix
DarkSlateGray #2F4F4F
ShadesMix
DarkTurquoise #00CED1
ShadesMix
DarkViolet #9400D3
ShadesMix
DeepPink #FF1493
ShadesMix
DeepSkyBlue #00BFFF
ShadesMix
DimGray #696969
ShadesMix
DodgerBlue #1E90FF
ShadesMix
FireBrick #B22222
ShadesMix
FloralWhite #FFFAF0
ShadesMix
ForestGreen #228B22
ShadesMix
Fuchsia #FF00FF
ShadesMix
Gainsboro #DCDCDC
ShadesMix
GhostWhite #F8F8FF
ShadesMix
Gold #FFD700
ShadesMix
GoldenRod #DAA520
ShadesMix
Gray #808080
ShadesMix
Green #008000
ShadesMix
GreenYellow #ADFF2F
ShadesMix
HoneyDew #F0FFF0
ShadesMix
HotPink #FF69B4
ShadesMix
IndianRed #CD5C5C
ShadesMix
Indigo #4B0082
ShadesMix
Ivory #FFFFF0
ShadesMix
Khaki #F0E68C
ShadesMix
Lavender #E6E6FA
ShadesMix
LavenderBlush #FFF0F5
ShadesMix
LawnGreen #7CFC00
ShadesMix
LemonChiffon #FFFACD
ShadesMix
LightBlue #ADD8E6
ShadesMix
LightCoral #F08080
ShadesMix
LightCyan #E0FFFF
ShadesMix
LightGoldenRodYellow #FAFAD2
ShadesMix
LightGrey #D3D3D3
ShadesMix
LightGreen #90EE90
ShadesMix
LightPink #FFB6C1
ShadesMix
LightSalmon #FFA07A
ShadesMix
LightSeaGreen #20B2AA
ShadesMix
LightSkyBlue #87CEFA
ShadesMix
LightSlateGray #778899
ShadesMix
LightSteelBlue #B0C4DE
ShadesMix
LightYellow #FFFFE0
ShadesMix
Lime #00FF00
ShadesMix
LimeGreen #32CD32
ShadesMix
Linen #FAF0E6
ShadesMix
Magenta #FF00FF
ShadesMix
Maroon #800000
ShadesMix
MediumAquaMarine #66CDAA
ShadesMix
MediumBlue #0000CD
ShadesMix
MediumOrchid #BA55D3
ShadesMix
MediumPurple #9370D8
ShadesMix
MediumSeaGreen #3CB371
ShadesMix
MediumSlateBlue #7B68EE
ShadesMix
MediumSpringGreen #00FA9A
ShadesMix
MediumTurquoise #48D1CC
ShadesMix
MediumVioletRed #C71585
ShadesMix
MidnightBlue #191970
ShadesMix
MintCream #F5FFFA
ShadesMix
MistyRose #FFE4E1
ShadesMix
Moccasin #FFE4B5
ShadesMix
NavajoWhite #FFDEAD
ShadesMix
Navy #000080
ShadesMix
OldLace #FDF5E6
ShadesMix
Olive #808000
ShadesMix
OliveDrab #6B8E23
ShadesMix
Orange #FFA500
ShadesMix
OrangeRed #FF4500
ShadesMix
Orchid #DA70D6
ShadesMix
PaleGoldenRod #EEE8AA
ShadesMix
PaleGreen #98FB98
ShadesMix
PaleTurquoise #AFEEEE
ShadesMix
PaleVioletRed #D87093
ShadesMix
PapayaWhip #FFEFD5
ShadesMix
PeachPuff #FFDAB9
ShadesMix
Peru #CD853F
ShadesMix
Pink #FFC0CB
ShadesMix
Plum #DDA0DD
ShadesMix
PowderBlue #B0E0E6
ShadesMix
Purple #800080
ShadesMix
Red #FF0000
ShadesMix
RosyBrown #BC8F8F
ShadesMix
RoyalBlue #4169E1
ShadesMix
SaddleBrown #8B4513
ShadesMix
Salmon #FA8072
ShadesMix
SandyBrown #F4A460
ShadesMix
SeaGreen #2E8B57
ShadesMix
SeaShell #FFF5EE
ShadesMix
Sienna #A0522D
ShadesMix
Silver #C0C0C0
ShadesMix
SkyBlue #87CEEB
ShadesMix
SlateBlue #6A5ACD
ShadesMix
SlateGray #708090
ShadesMix
Snow #FFFAFA
ShadesMix
SpringGreen #00FF7F
ShadesMix
SteelBlue #4682B4
ShadesMix
Tan #D2B48C
ShadesMix
Teal #008080
ShadesMix
Thistle #D8BFD8
ShadesMix
Tomato #FF6347
ShadesMix
Turquoise #40E0D0
ShadesMix
Violet #EE82EE
ShadesMix
Wheat #F5DEB3
ShadesMix
White #FFFFFF
ShadesMix
WhiteSmoke #F5F5F5
ShadesMix
Yellow #FFFF00
ShadesMix
YellowGreen #9ACD32
ShadesMix

About this blog

Blog Archive

My Blog List

Advertise On This Site

Site Info

Advertise on this Site

To advertise on this site please mail on RajeshRolen@gmail.com

Information Source

About

Pages

Dot Net Academy

Advertis in This Area of Site

Powered by Blogger.

Followers

Blog Archive

Search This Blog