Monday, 29 August 2016

what is Stuff in SQL Server 2008?




  It is function used to replace the string between specified place i.e. we can replace string between two specified place with other string. It’s take four parameters i.e. string_exp1,start_position, no_of_character,string_exp2.

Syntax:-

STUFF(expression1 ,start_position,no_of_character,expresion2_wtih_replace)

Here expression1 in which we have to do replacement.
Start_position is start point of replacement.
No_of_character is how many character we have to replace.
expresion2_wtih_replace is value after replace 

Example:-

Select STUFF('abcdefgh',3,5,'123')

Ouput:-

ab123h

Wednesday, 3 August 2016

what is httphandler in asp.net?



Httphandler is used to handle specific request based on it’s extension. The most handler is asp.net page handler that process .aspx file. When user request an .aspx file, the request is processed by page through page handler. You can create your own http handler that render custom output to browser.

Types of httphandler:-

1.)   ASP.Net Page Handler (.aspx ):- The default handler for all asp.net page.
2.)   Web Service Handler(.asmx):- The default HTTP handler for Web service pages created as .asmx files in ASP.NET.
3.)   Generic Web Handler(.ashx) :- The default HTTP handler for all Web handlers that do not have a UI and that include the @ WebHandlerdirective.
4.)   Trace handler (trace.axd) :- A handler that displays current page trace information.

Note:- References from MSDN.

Friday, 29 July 2016

What will happen if you define page_load event in design page as well as in code behind in asp.net. which will execute ?



The page_load method which is defined in aspx page or design page will only run. Design page page_load method precedence is more.

What is the significance of AutoEventWireUp in asp.net?



Gets or sets a value indicating whether events for ASP.NET pages are automatically connected to event-handling functions.

If AutoEventWireUp attribute is true then asp.net apges automatically connected to event-handling function, otherwise not.

The default value of AutoEventWireUp id true.

When AutoEventWireup is true, ASP.NET does not require that you explicitly bind event handlers to a page event such as Load.

When AutoEventWireup is false, you must explicitly bind the event to a method. For example, if you have a Page_Load method in the code for a page, the method will be called in response to the Load event only if you write code like that in the following example.

Example:-

Here AutoEventWireUp attribute value is false.

protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = DateTime.Now.ToLongTimeString();
    }

For above example AutoEventWireup is false, so it will not show date on label control on web page.

Note:- 


  •   If you set AutoEventWireup to true, make sure that you do not also manually attach page event handlers to events. If you do, handlers might be called more than one time.

  • Automatic binding is performed only for page events, not for events for controls on the page.

  • As an alternative to binding events to handlers, you can override the Oneventname methods of the page or of controls.