Some times we have more matter to write on Asp.net Button and the button becomes longer in width.. if we make its width small then text will be truncated (complete text will not be visible). so to do this here is solution:
Lets say you want to write following line on page in this way:
Submit here if you are an
Engineer
to write text in above format in asp button write it in below format:
Submit here if you are an 
 Engineer
so the answer is use : 
 to new line in asp button
ASP.net button text to wrap to second line
Labels: ASP.NET , ASP.NET Interview Questions
ASP.net button text to wrap to second line
Some times we have more matter to write on Asp.net Button and the button becomes longer in width.. if we make its width small then text will be truncated (complete text will not be visible). so to do this here is solution:
Lets say you want to write following line on page in this way:
Submit here if you are an
Engineer
to write text in above format in asp button write it in below format:
Submit here if you are an 
 Engineer
so the answer is use : 
 to new line in asp button
Labels: ASP.NET , ASP.NET Interview Questions
Multiple Active Result Sets (MARS) in SQL Server 2005
MARS is newly added future in SQL 2005. In earlier version from sql2005 user are not allowed to run more than one SQL batch on an open connection at the same time but sql2005 allows the user to run more than one SQL batch on an open connection at the same time.
private void MARS_Off()
{
SqlConnection conn = new SqlConnection("Server=serverName;
Database=adventureworks;Trusted_Connection=yes;");
string sql1 = "SELECT * FROM [Person].[Address]";
string sql2 = "SELECT * FROM [Production].[TransactionHistory]";
SqlCommand cmd1 = new SqlCommand(sql1, conn);
SqlCommand cmd2 = new SqlCommand(sql2, conn);
cmd1.CommandTimeout = 500;
cmd2.CommandTimeout = 500;
conn.Open();
SqlDataReader dr1 = cmd1.ExecuteReader();
// do stuff with dr1 data
conn.Close();
conn.Open();
SqlDataReader dr2 = cmd2.ExecuteReader();
// do stuff with dr2 data
conn.Close();
}
Labels: SQL Interview Questions , sqlserver
Multiple Active Result Sets (MARS) in SQL Server 2005
MARS is newly added future in SQL 2005. In earlier version from sql2005 user are not allowed to run more than one SQL batch on an open connection at the same time but sql2005 allows the user to run more than one SQL batch on an open connection at the same time.
private void MARS_Off()
{
SqlConnection conn = new SqlConnection("Server=serverName;
Database=adventureworks;Trusted_Connection=yes;");
string sql1 = "SELECT * FROM [Person].[Address]";
string sql2 = "SELECT * FROM [Production].[TransactionHistory]";
SqlCommand cmd1 = new SqlCommand(sql1, conn);
SqlCommand cmd2 = new SqlCommand(sql2, conn);
cmd1.CommandTimeout = 500;
cmd2.CommandTimeout = 500;
conn.Open();
SqlDataReader dr1 = cmd1.ExecuteReader();
// do stuff with dr1 data
conn.Close();
conn.Open();
SqlDataReader dr2 = cmd2.ExecuteReader();
// do stuff with dr2 data
conn.Close();
}
Labels: SQL Interview Questions , sqlserver
Common Table Expressions in SQL Server (2005/2008)
Using Common Table Expressions
A common table expression (CTE) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.
A CTE can be used to:
* Create a recursive query. For more information, see Recursive Queries Using Common Table Expressions.
* Substitute for a view when the general use of a view is not required; that is, you do not have to store the definition in metadata.
* Enable grouping by a column that is derived from a scalar subselect, or a function that is either not deterministic or has external access.
* Reference the resulting table multiple times in the same statement.
Using a CTE offers the advantages of improved readability and ease in maintenance of complex queries. The query can be divided into separate, simple, logical building blocks. These simple blocks can then be used to build more complex, interim CTEs until the final result set is generated.
CTEs can be defined in user-defined routines, such as functions, stored procedures, triggers, or views.
USE AdventureWorks;
GO
WITH Sales_CTE (SalesPersonID, NumberOfOrders, MaxDate)
AS
(
SELECT SalesPersonID, COUNT(*), MAX(OrderDate)
FROM Sales.SalesOrderHeader
GROUP BY SalesPersonID
)
SELECT E.EmployeeID, OS.NumberOfOrders, OS.MaxDate,
E.ManagerID, OM.NumberOfOrders, OM.MaxDate
FROM HumanResources.Employee AS E
JOIN Sales_CTE AS OS
ON E.EmployeeID = OS.SalesPersonID
LEFT OUTER JOIN Sales_CTE AS OM
ON E.ManagerID = OM.SalesPersonID
ORDER BY E.EmployeeID;
GO
Reference :
Labels: SQL Interview Questions
Common Table Expressions in SQL Server (2005/2008)
Using Common Table Expressions
A common table expression (CTE) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.
A CTE can be used to:
* Create a recursive query. For more information, see Recursive Queries Using Common Table Expressions.
* Substitute for a view when the general use of a view is not required; that is, you do not have to store the definition in metadata.
* Enable grouping by a column that is derived from a scalar subselect, or a function that is either not deterministic or has external access.
* Reference the resulting table multiple times in the same statement.
Using a CTE offers the advantages of improved readability and ease in maintenance of complex queries. The query can be divided into separate, simple, logical building blocks. These simple blocks can then be used to build more complex, interim CTEs until the final result set is generated.
CTEs can be defined in user-defined routines, such as functions, stored procedures, triggers, or views.
USE AdventureWorks;
GO
WITH Sales_CTE (SalesPersonID, NumberOfOrders, MaxDate)
AS
(
SELECT SalesPersonID, COUNT(*), MAX(OrderDate)
FROM Sales.SalesOrderHeader
GROUP BY SalesPersonID
)
SELECT E.EmployeeID, OS.NumberOfOrders, OS.MaxDate,
E.ManagerID, OM.NumberOfOrders, OM.MaxDate
FROM HumanResources.Employee AS E
JOIN Sales_CTE AS OS
ON E.EmployeeID = OS.SalesPersonID
LEFT OUTER JOIN Sales_CTE AS OM
ON E.ManagerID = OM.SalesPersonID
ORDER BY E.EmployeeID;
GO
Reference :
Labels: SQL Interview Questions
Inline & Code Behind code in Asp.net
Inline & Codebehind Code
Inline Code is mixing client and serverside code on the same page like HTMLandJavaScript. So precompilation is no need.
CodeBehind .aspx separately only for serverside code. So it provides good performance than inline code. Why because CodeBehind needs to be compile in advance.
Article Author: Rajesh Rolen.
Labels: ASP.NET , ASP.NET Interview Questions
Inline & Code Behind code in Asp.net
Inline & Codebehind Code
Inline Code is mixing client and serverside code on the same page like HTMLandJavaScript. So precompilation is no need.
CodeBehind .aspx separately only for serverside code. So it provides good performance than inline code. Why because CodeBehind needs to be compile in advance.
Article Author: Rajesh Rolen.
Labels: ASP.NET , ASP.NET Interview Questions
Check all Checkbox of HTML Table Using JQuery
Lets we have a HTML Table and we have checkbox in every row and we have a checkbox in Table Header.. now we want that when we click on checkbox of table header then all checkbox of table should be checked/unchecked according checked state of checkbox in table header.. using JQuery
eg:
< %@ Page Language="C#" AutoEventWireup="true" CodeFile="chkall.aspx.cs" Inherits="chkall" % >
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns="http://www.w3.org/1999/xhtml" >
< head runat="server" >
< title >Untitled Page< /title >
< script type="text/javascript" src="jquery.js" >< /script >
< script type="text/javascript" >
$(document).ready(function() {
$("#tableOne thead tr th:first input:checkbox").click(function() {
var checkedStatus = this.checked;
$("#tableOne tbody tr td:first-child input:checkbox").each(function() {
this.checked = checkedStatus;
});
});
});
< /script >
< /head >
< body >
< form id="form1" runat="server" >
< div >
< table id="tableOne" >
< thead >
< tr >
< th >< input type="checkbox" / >< /th >
< th >Name< /th >
< th >English< /th >
< th >Spanish< /th >
< th >Math< /th >
< th >History< /th >
< /tr >
< /thead >
< tbody >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Bob Smith< /td >
< td >80< /td >
< td >70< /td >
< td >75< /td >
< td >80< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >George Jones< /td >
< td >90< /td >
< td >88< /td >
< td >100< /td >
< td >90< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Rob Johnson< /td >
< td >85< /td >
< td >95< /td >
< td >80< /td >
< td >85< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Rick Stevens< /td >
< td >60< /td >
< td >55< /td >
< td >100< /td >
< td >100< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Jenn Gilbert< /td >
< td >68< /td >
< td >80< /td >
< td >95< /td >
< td >80< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Rachel Thompsen< /td >
< td >100< /td >
< td >99< /td >
< td >100< /td >
< td >90< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Rick Lopez< /td >
< td >85< /td >
< td >68< /td >
< td >90< /td >
< td >90< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >John Petersen< /td >
< td >100< /td >
< td >90< /td >
< td >90< /td >
< td >85< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Tad Young< /td >
< td >80< /td >
< td >50< /td >
< td >65< /td >
< td >75< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Marshall Washington< /td >
< td >85< /td >
< td >100< /td >
< td >100< /td >
< td >90< /td >
< /tr >
< /tbody >
< /table >
< /div >
< /form >
< /body >
< /html >
Article by: Rajesh Rolen the DotNet Developer
Check all Checkbox of HTML Table Using JQuery
Lets we have a HTML Table and we have checkbox in every row and we have a checkbox in Table Header.. now we want that when we click on checkbox of table header then all checkbox of table should be checked/unchecked according checked state of checkbox in table header.. using JQuery
eg:
< %@ Page Language="C#" AutoEventWireup="true" CodeFile="chkall.aspx.cs" Inherits="chkall" % >
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html xmlns="http://www.w3.org/1999/xhtml" >
< head runat="server" >
< title >Untitled Page< /title >
< script type="text/javascript" src="jquery.js" >< /script >
< script type="text/javascript" >
$(document).ready(function() {
$("#tableOne thead tr th:first input:checkbox").click(function() {
var checkedStatus = this.checked;
$("#tableOne tbody tr td:first-child input:checkbox").each(function() {
this.checked = checkedStatus;
});
});
});
< /script >
< /head >
< body >
< form id="form1" runat="server" >
< div >
< table id="tableOne" >
< thead >
< tr >
< th >< input type="checkbox" / >< /th >
< th >Name< /th >
< th >English< /th >
< th >Spanish< /th >
< th >Math< /th >
< th >History< /th >
< /tr >
< /thead >
< tbody >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Bob Smith< /td >
< td >80< /td >
< td >70< /td >
< td >75< /td >
< td >80< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >George Jones< /td >
< td >90< /td >
< td >88< /td >
< td >100< /td >
< td >90< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Rob Johnson< /td >
< td >85< /td >
< td >95< /td >
< td >80< /td >
< td >85< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Rick Stevens< /td >
< td >60< /td >
< td >55< /td >
< td >100< /td >
< td >100< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Jenn Gilbert< /td >
< td >68< /td >
< td >80< /td >
< td >95< /td >
< td >80< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Rachel Thompsen< /td >
< td >100< /td >
< td >99< /td >
< td >100< /td >
< td >90< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Rick Lopez< /td >
< td >85< /td >
< td >68< /td >
< td >90< /td >
< td >90< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >John Petersen< /td >
< td >100< /td >
< td >90< /td >
< td >90< /td >
< td >85< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Tad Young< /td >
< td >80< /td >
< td >50< /td >
< td >65< /td >
< td >75< /td >
< /tr >
< tr >
< td >< input type="checkbox" / >< /td >
< td >Marshall Washington< /td >
< td >85< /td >
< td >100< /td >
< td >100< /td >
< td >90< /td >
< /tr >
< /tbody >
< /table >
< /div >
< /form >
< /body >
< /html >
Article by: Rajesh Rolen the DotNet Developer