Tuesday, 11 December 2012








-->
DEFINE CONNECTED AND DISCONNECTED DATA ACCESS IN ADO.NET?
Connected data access through the DataReader objects of data provider. This object requires exclusive use of the connection object. It can provide fast and forward-only data access. It doesn't allow editing.  Disconnected data access is achieved through the DataAdapter object. This object establishes connection, executes the command, load data in the DataSet. The dataset works independent of database. It contains data in the memory and can edit the data. The changes in the data can be transmitted to the database using Update method of DataAdapter object. 
1. Connected environment needs a constantly connection of user to data source while performing any operation. Dissconnected environment does not need any connection. 2. Only one operation can be performed at a time in connected environment while in dissconnected multiple operations can be performed. 3. DataReader is used in connected environment. DataSet is used in dissconnected environment. 4. Connected environent is slower in speed. Disconnected environment has a good speed. 5. We get updated data in connected environment In disconnectes environment,thereis a problem of dirty read.
DIFFERENCE BETWEEN DATA GRID AND REPEATER
Difference between Datagrid and Repeater 1. Datagrid has paging while Datalist doesnt. 2. Datalist has a property called repeat. Direction = vertical/horizontal. (This is of great help in designing layouts). This is not there in Datagrid. 3. A repeater is used when more intimate control over html generation is required. 4. When only checkboxes/radiobuttons are repeatedly served then a checkboxlist or radiobuttonlist are used as they involve fewer overheads than a Datagrid. The Repeater repeats a chunk of HTML you write, it has the least functionality of the three. DataList is the next step up from a Repeater; accept you have very little control over the HTML that the control renders. DataList is the first of the three controls that allow you Repeat-Columns horizontally or vertically. Finally, the DataGrid isthe motherload. However, instead of working on a row-by-row basis, you’re working on a column-by-column basis. DataGrid caters to sorting and has basic paging for your disposal. Again you have little contro, over the HTML. NOTE: DataList and DataGrid both render as HTML tables by default. Out of the 3 controls, I use the Repeater the most due to its flexibility w/ HTML. Creating a Pagination scheme isn't that hard, so I rarely if ever use a DataGrid. Occasionally I like using a DataList because it allows me to easily list out my records in rows of three for instance.
********************** Ajax **************************
CAN YOU NEST UPDATEPANEL WITHIN EACH OTHER?
Yes, you can do that. You would want to nest update panels to basically have more control over the Page Refresh.
CAN WE USE MULTIPLE SCRIPTMANAGER ON A PAGE?
No. You can use only one ScriptManager on a page.
WHAT IS THE ROLE OF A SCRIPTMANAGERPROXY?
A page can contain only one ScriptManager control. If you have a Master-Content page scenario in your application and the MasterPage contains a ScriptManager control, then you can use the ScriptManagerProxy control to add scripts to content pages.
Also, if you come across a scenario where only a few pages in your application need to register to a script or a web service, then its best to remove them from the ScriptManager control and add them to individual pages, by using the ScriptManagerProxy control. That is because if you added the scripts using the ScriptManager on the Master Page, then these items will be downloaded on each page that derives from the MasterPage, even if they are not needed, which would lead to a waste of resources.
WHAT IS ASP.NET AJAX?
ASP.NET AJAX’ is a terminology coined by Microsoft for ‘their’ implementation of AJAX, which is a set of extensions to ASP.NET. These components allow you to build rich AJAX enabled web applications, which consists of both server side and client side libraries.
HOW WILL YOU INVOKE A WEB METHOD IN AJAX?
Set EnablePageMethods property of ScriptManager to "true"  And inside Javascript we can directly use  window.PageMethods.METHODNAME()
WHAT IS BENIFIT OF AJAX OVER JAVA APPLETS?
The following are the benefits of AJAX over Java applet: AJAX applications are loaded in seconds, where as Applets takes longer time. The reason is, Applet applications are tend to load large libraries
WHAT IS THE DISADVANTAGE OF AJAX?
The disadvantages of AJAX are:
  •   Search engines would not be able to index an AJAX
    application.

  • The server information can not be accessed
    within AJAX.

  • AJAX is not well integrated with any browser.

  • ActiveX requests are enabled only in IE 5 and IE6

  • Data of all requests is URL-encoded, which increases the size of the
    request
********************** ADO.Net **************************
WHAT IS DATAVIEW MANAGER?
DataViewManager is used to manage view settings of the tables in a DataSet. A DataViewManager is best suited for views that consist of a combination of multiple tables. The properties like ApplyDefaultSort, Sort, RowFilter, and RowStateFilter are referenced using DataViewSetting
Data view manager is used for creation of data view between table and it provide schema type information about table and it show the all operation like insert,delete etc as alias type.
JSCRIPT
WHAT LOOPING STRUCTURES ARE THERE IN JAVASCRIPT?
for, while, do-while loops, but no foreach.
BASIC METHODS FOR OPENING POPUP WINDOW IN JAVASCRIPT?
There are two basic way to open new window 1) Using Window.Open() and  2) Using Window.showModalDialog()  The Syntax for using these methods are  . Window.Open(URL,WindowName,Window Features)  Example: window.open ("http://www.dotnetfunda.com","mywindow","status=1,toolbar=1");  . window.showModalDialog(URL,WindowName,ModalDialog Features) for example: window.showModalDialog("http://www.mindstick.com", "mywindow","dialogWidth:400px;dialogHeight:395px");
WHAT IS EVAL() IN JAVASCRIPT?
The eval() method is incredibly powerful allowing us to execute snippets of code during execution in JavaScript. Example: <script type="text/javascript"> var USA_Texas_Austin = "521,289"; document.write("Population is "+eval("USA_"+"Texas_"+"Austin")); </script> Output: Population is 521,289
NAME THE NUMERIC CONSTANTS REPRESENTING MAX, MIN VALUES?
Number.MAX_VALUE //it returns the max value Number.MIN_VALUE //it returns the min value
HOW CAN WE SEND MAIL USING JAVASCRIPT?
No. There is no way to send emails directly using JavaScript.  But you can use JavaScript to execute a client side email program send the email using the "mailto" code. Here is an example:  function functioname(form) { tdata=document.myform.tbox1.value; location="mailto:emailid@domain.com?subject=..."; return true; }
WHICH CLASS AND METHOD OF SYS.NET NAMESPACE DO WE USE TO MAKE AN ASYNCHRONOUS REQUEST IN JAVASCRIPT?
Sys.Net.WebRequest class  And invoke method
HOW TO CREATE A DATE OBJECT IN JAVASCRIPT?
We create  a data object in javascript as:  dateObjectName = new Date([parameters]) Create a direct instance of an object forexample: dateObjectName = new Date([parameters]) The syntax for accessing a property of an object is: dateObjectName.propertyname
HOW TO SET THE FOCUS IN AN ELEMENT USING JAVASCRIPT?
<script> function setFocus() { if(focusElement != null) { document.forms[0].elements["myelementname"].focus(); } } </script
HOW TO SETTING A COOKIE WITH THE CONTENTS OF A TEXTBOX ?
Values stored in cookies may not have semicolons, commas, or spaces. You should use the handy "escape()" function to encode the values, and "unescape()" to retrieve them. //Sets cookie of current value for myTextBox function TextBoxOnchange() { var myBox = window.document.getElementById(myTextBox"); document.cookie = "myTextBox="+ escape(myBox.value) + getExpirationString(); } //return a string like ";expires=Thu, 5 Jan 2006 16:07:52 UTC" function getExpirationString() { var exp = new Date(); var threemonths = exp.getTime()+(120*24*60*60*1000); exp.setTime(threemonths); return ";expires="+exp.toGMTString(); } This is called from the event handler in the HTML. <input name="myTextBox" type="text" id="myTextBox" onchange="javascript:TextBoxOnchange()" />
WHERE ARE COOKIES ACTUALLY STORED ON THE HARD DISK?
This depends on the user's browser and OS. In the case of Netscape with Windows OS,all the cookies are stored in a single file called cookies.txt  c:\Program Files\Netscape\Users\username\cookies.txt
HOW TO SUBMIT FORM WITHOUT SUBMIT BUTTON?
With this method, you can cause a form to be submitted when the user clicks on a regular link, which can be a text link or an image link. This requires two steps. First step, the form Give your form a name. This is done in the FORM tag itself: <form name="MyForm" method="POST" action="/cgi-bin/script.cgi"> Second step, the JavaScript Create a link containing the submit command <a href="javascript:document.MyForm.submit();"> Click to submit the form </a> Optional third step You can remove the submit button or, to be kind to the few non-JavaScript browsers that visit your site, put it between NOSCRIPT tags: <noscript> <input type="submit" name="Click here"> </noscript> The above will display the submit button only when non-JavaScript browsers visit the page.
HOW TO SET ALL CHECKBOXES TO TRUE USING JAVASCRIPT?
//select all input tags function SelectAll() { var checkboxes = document.getElementsByTagName("input");
for(i=0;i<checkboxes.length;i++) { if(checkboxes.item(i).attributes["type"].value == "checkbox") { checkboxes.item(i).checked = true; } } }
HOW TO RELOAD THE CURRENT PAGE?
we use following syntax: window.location.reload(true);
WHAT IS THE WAY TO APPEND A VALUE TO AN ARRAY?
way to append a value in array  for example: arrName[arrName.length]=value;
Functions  ---------- 1) can be used with Select statement 2) Not returning output parameter but returns Table variables 3) You can join UDF 4) Cannot be used to change server configuration 5) Cannot be used with XML FOR clause 6) Cannot have transaction within function Stored Procedure ----------------- 1) have to use EXEC or EXECUTE 2) return output parameter 3) can create table but won’t return Table Variables 4) you can not join SP 5) can be used to change server configuration 6) can be used with XML FOR Clause 7) can have transaction within SP Although both functions and sp's are prcomiled sql statements there exists some differences between them. 1. Functions must return a value(scalar,inline table or multi statement table) whereas stored proc may or may not retun a value. 2.Functions can return a table whereas stored procs can create a table but can't return table. 3. Stored procs can be called independently using exec keyword whereas function are called using select statements. 4. Stored procs can be used to change server configuration(in terms of security-i.e. setting granular permissions of user rights) whereas function can't be used for this 5. XML and output parameters can't be passed to functions whereas it can be with sp's. 6.transaction related statement can be handled in sp whereas it can't be in function. 7. stored procedures can call a funtion or another sstored proc similarly a function can call another function and a stored proc.The catch with function is that no user defined stored proc can be called.Only extended/system defined procs can be called.
<![if !supportLists]>1.  <![endif]>Functions are compiled and executed at run time. Stored procedures are stored in parsed and compiled format in the database. 2. Functions cannot affect the state of the database which means we cannot perform insert,delete,update and create operations on the database. Stored Procedures can affect the state of the database by using insert,delete,update and create operations. 3 Functions are basically used to compute values. We passes some parameters to functions as input and then it performs some operations on the parameter and return output. Stored procedures are basically used to process the task. 4.Function can not change server environment and our operating system environment. Stored procedures can change server environment and our operating system environment. 5.Functions can not be invoked from SQL Statements. Execute. SELECT operating system can be invoked from SQL Statements. Execute. SELECT 6.Functions can run an executable file from SQL SELECT or an action query. operating system use Execute or Exec to run  <![if !supportLineBreakNewLine]> <![endif]>
Functional testing is a type of black box testing that bases its test cases on the specifications of the software component under test. Functions are tested by feeding them input and examining the output, and internal program structure is rarely considered (Not like in white-box testing).[1]
Functional testing differs from system testing in that functional testing "verif[ies] a program by checking it against ... design document(s) or specification(s)", while system testing "validate[s] a program by checking it against the published user or system requirements"(Kaner, Falk, Nguyen 1999, p. 52).
Functional testing typically involves five steps[citation needed]:
<![if !supportLists]>1.    <![endif]>The identification of functions that the software is expected to perform
<![if !supportLists]>2.    <![endif]>The creation of input data based on the function's specifications
<![if !supportLists]>3.    <![endif]>The determination of output based on the function's specifications
<![if !supportLists]>4.    <![endif]>The execution of the test case
<![if !supportLists]>5.    <![endif]>The comparison of actual and expected outputs
-->

Delegates

Delegates are the ultimate function pointer. Developers familiar with C and C++ are very familiar with function pointers and their lack of instance-based knowledge. A delegate can be thought of as a call back mechanism, essentially saying, "Please invoke this method for me when the time is right."
Consider the following scenario: Your department has just hired a new employee. Human Resources needs to be notified when a new employee is hired so they can put them to sleep with endless paper work and boring drivel about company policies and practices. This type of interaction is a perfect example of a delegate. Basically, Human Resources is requesting a notification when a new employee is hired and provides a method to be invoked.
Listing 2.1.32 Using Delegates shows the basic use of delegates.
Listing 2.1.32 Using Delegates
 1: //File        :part02_31.cs
 2: //Author    :Richard L. Weeks
 3: //Purpose    :Demonstrate the use of delegates
 4:
 5: using System;
 6:
 7: //Define a person struct
 8: public struct Person {
 9:     public string FName;
10:     public string LName;
11: }
12:
13: //Define a delegate
14: public delegate void OnNewHire( Person person );
15:
16: //The HR Class
17: public class HR {
18:
19:     //Implement the delegate to be called when a new person is hired
20:     public void OnNewHire( Person person ) {
21:         Console.WriteLine( "HR is in the process of putting {0}  to sleep", 
graphics/ccc.gifperson.FName );
22:     }
23: }
24:
25: //Create a department
26: public class Department {
27:
28:     //Who to notify
29:     private OnNewHire    m_OnNewHireDelegate = null;
30:
31:     //set the OnNewHire delegate
32:     public void AddOnNewHireDelegate( OnNewHire onh ) {
33:         m_OnNewHireDelegate = onh;
34:     }
35:
36:
37:     public void HirePerson( Person p ) {
38:         //do we need to notify someone?
39:         if( m_OnNewHireDelegate != null )
40:             m_OnNewHireDelegate( p );
41:     }
42: }
43:
44:
45: public class DelegateTest {
46:
47:     public static void Main( ) {
48:
49:         HR hr = new HR( );
50:         Department dept = new Department( );
51:
52:         //Register the OnNewHire Delegate
53:         dept.AddOnNewHireDelegate( new OnNewHire( hr.OnNewHire ) );
54:
55:         //Create a person
56:         Person me; me.FName = "Richard"; me.LName = "Weeks";
57:
58:         //Hire ME!!!
59:         dept.HirePerson( me );
60:     }
61: }
Listing 2.1.32 implements the HR scenario and makes use of a delegate to notify HR when a new person has been hired. The delegate OnNewHire is defined on line 14. Notice the use of the delegate keyword to denote what is being declared. Remember that C# does not allow for global methods, so C# would issue an error without the delegate keyword.
The HR class provides a handler for the delegate. The method name does not have to be the same as the name of the delegate; this was done to make it easier to follow. The Department class provides a method AddOnNewHireDelegate to handle the "hooking-up" of the delegate with the intended handler. Notice the call on line 53 that actually adds the HR handler to the Department. A delegate is a type in C# and requires an instance, hence the use of the new keyword to create a new delegate.
I would encourage any developer to explore delegates in detail because their use in .NET is prolific, especially in Windows Forms development.