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
Labels: ASP.NET , java script
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
Labels: ASP.NET , java script
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.
Labels: ASP.NET Interview Questions
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.
Labels: ASP.NET Interview Questions
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.
Labels: ASP.NET Interview Questions
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.
Labels: ASP.NET Interview Questions
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);Labels: ASP.NET Interview Questions
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);Labels: ASP.NET Interview Questions
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.
Labels: ASP.NET Interview Questions
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.
Labels: ASP.NET Interview Questions
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.
Labels: ASP.NET Interview Questions
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.
Labels: ASP.NET Interview Questions
Make HTML textbox readonly
to make html textbox readonly follow below steps:
make Html textbox runat="server"
and in codding write
txtname.Disabled = True
Labels: ASP.NET
Make HTML textbox readonly
to make html textbox readonly follow below steps:
make Html textbox runat="server"
and in codding write
txtname.Disabled = True
Labels: ASP.NET
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
Labels: VB.NET
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
Labels: VB.NET
Improve Query Performance using "With" Clause
Using with clause we can improve query performance.
Read complete Article
Labels: SQL , SQL Interview Questions
Improve Query Performance using "With" Clause
Using with clause we can improve query performance.
Read complete Article
Labels: SQL , SQL Interview Questions
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)'/ >
Labels: java script
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)'/ >
Labels: java script
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:
Labels: CSS