Archive for October, 2008

Confirmation box in c# windows application

To make a confirmation box in c# windows application we can use

MessageBox.Show(string text,string caption,MessageBoxButtons buttons)

Coding :

if (MessageBox.Show(”Do you want to delete?”, “Confirm delete”,MessageBoxButtons.YesNo) == DialogResult.Yes)
{
MessageBox.Show(”Deleted”);
}

In the above coding when a button delete is clicked a condition is checked and confirmation box “Do you want to delete” is arised with two buttons ‘Yes’ and ‘No’.If ‘Yes’ is clicked then another message box “Deleted” is showed.

Popularity: 12% [?]

Dot Net Interview Questions – Part 1

1.What method do you use to explicitly kill a users session?

Ans : Syntax: Session.Abandon()

Note : The Abandon method destroys all the objects stored in a Session object and releases their resources.If you do not call the Abandon method explicitly, the server destroys these objects when the session times out.

2.What methods are fired during the page load?

Ans : Init() ,Load(),PreRender(),Unload().

3.What data type does the RangeValidator control support?

Ans : Integer,String and Date.

4.Which method do you invoke on the DataAdapter control to load your generated dataset with data?

Ans : Fill() method.


5.Which control would you use if you needed to make sure the values in two different controls matched?

Ans : CompareValidator Control


6.What base class do all Web Forms inherit from?

Ans : The Page class.

7.Explain the differences between Server-side and Client-side code?

Ans : Server-side code executes on the server. Client-side code executes in the context of the clients’ browser.

8.do you store the information about the user’s locale?

Ans : System.Web.UI.Page.Culture

9.Can you edit data in the Repeater control?

Ans : No, it just reads the information from its data source.

10.Which template must you provide, in order to display data in a Repeater control?

Ans : ItemTemplate.

11.How can you provide an alternating color scheme in a Repeater control?

Ans : AlternatingItemTemplate.

12.Name two properties common in every validation control?

Ans : ControlToValidate property and Text property.

13.Is String is Value Type or Reference Type in C#?

Ans : String is an object (Reference Type).

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

Ans : 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.

15.What is the Global.asax used for?

Ans : The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.

16.How many classes can a single .NET DLL contain?

Ans : It can contain many classes.


17.What is portable executable (PE)?

Ans : The file format defining the structure that all executable files (EXE) and Dynamic Link Libraries (DLL) must use to allow them to be loaded and executed by Windows. PE is derived from the Microsoft Common Object File Format (COFF). The EXE and DLL files created using the .NET Framework obey the PE/COFF formats and also add additional header and data sections to the files that are only used by the CLR.


18.What is strong name?

Ans : A name that consists of an assembly’s identity—its simple text name, version number, and culture information (if provided)—strengthened by a public key and a digital signature generated over the assembly.


19.What is Code Access Security (CAS)?

Ans : CAS is the part of the .NET secur
ity model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running. For example, it is CAS that will prevent a .NET web applet from formatting your hard disk.

20.What are the different types of assemblies?

Ans : Private, Public/Shared, Satellite

21.Which namespace is the base class for .net Class library?

Ans : system.object

22.How do you create threading in .NET? What is the namespace for that?

Ans : System.Threading.Thread .


23.What is the difference between ref & out parameters?

Ans : An argument passed to a ref parameter must first be initialized. Compare this to an out parameter, whose argument does not have to be explicitly initialized before being passed to an out parameter.


24.What are indexers?

Ans : Indexers are similar to properties, except that the get and set accessors of indexers take parameters, while property accessors do not.

25.What are the access-specifiers available in c#?

Ans : Private, Protected, Public, Internal, Protected Internal.


Popularity: 4% [?]

Set textbox background color when clicked

To set the background color of the textbox, use the ‘backgroundColor’ property.
eg.

<input type="text" style='background:#fce09a' value='www.fordevs.com'>

If you want to set the background color on text focus then use the ‘onfocus’ event.

The following example illustrates you how to set the color in ‘onfocus’ event. When the texbox loses the focus then normal background color is retained.

<html>
<body>
<br><input class="searchInput" id="searchtextbox" onblur="this.style.backgroundColor='#ffffff';"
onfocus="this.style.backgroundColor='#fce09a';value=''" accesskey="s" value="[Enter your name]" name="searchtextbox" autocomplete="off"> <br>
<br>
</html>

Demo link

Popularity: 3% [?]

How to Text Over a SWF?

To text over a SWF,we should use the “wmode” in object embed tab as “opaque”.By doing this we get the html text overlapping the swf content in the page at same position.

Coding :

<object classid=”clsid:d27cdb6e-ae6d-11cf-96b8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0″ width=”300″ height=”150″ id=”s” align=”middle”>
<param name=”allowScriptAccess” value=”sameDomain” />
<param name=”allowFullScreen” value=”false” />
<param name=”movie” value=”s.swf” />
<param name=”quality” value=”high” />
<param name=”bgcolor” value=”#370037″ />
<param name=”wmode” value=”opaque” />
<embed wmode=”opaque” src=”s.swf” quality=”high” bgcolor=”#370037″ width=”300″ height=”150″ name=”s” align=”middle” allowScriptAccess=”sameDomain” allowFullScreen=”false” type=”application/x-shockwave-flash” pluginspage=”http://www.macromedia.com/go/getflashplayer” />
</object>

Demo Link

Popularity: 2% [?]

How to make DIV position same for different resolution?

To make DIV position same for different resolution, we should make the div style property position to absolute.
zzz
Ex :

<div style=”position:absolute; top:100px; left:200px; background-color:Gray; font-size:12px; color:White; font-family:Arial; height:45px”>
….
….
</div>

Popularity: 1% [?]

Designed by: Business Web Hosting | Thanks to Buy Icons, travel tips and Used Cars