:: Home     :: MS Dynamics CRM     :: .Net 1.1     :: .Net 2.0     :: Sharepoint Portal     :: Ajax


Asp.Net Interview Questions
Asp.Net 2.0/3.5 Sample Interview Questions and Answers. Interview Tips for a successful job Interview


Code Walkthroughs

Datagrid Formatting the Data
We are able to format the content of the datagrid cell by one of two simple methods, dependant upon whether the column is a bound column or whether it is a template column. In our example we shall format the column to have to digits after the decimal point , followed by a...

Datagrid Highlight a Row With Click Through
It is relatively easy to add alternating colours to the rows in your datagrid. However, when we move the mouse over the rows we may want to highlight this row, and possibly to add the option of a click through based on the row selected...

Add a Delete Button to a Datagrid
To add a delete button to a datagrid follows a similar process to adding an edit button. In the datagrid header...

Add an Edit Button to a Datagrid
The datagrid has a predefined editColumn for handling the editing of a datagrid. Adding this simple column definition to a datagrid adds a powerful feature. When a row is not in edit mode the column item shows the word...

Making a Datagrid Row Editable
Two of the most popular methods of editing a datagrid in asp.net are to either select the row and take the user off to a different presentation of the data, or to change the formatting of the row presented in the database with appropriate edit text boxes, checkboxes and...

Adding Tooltips to Datagrid Rows
Adding tooltips to datagrid rows is easy, assuming that you have already created the code for adding row highlighting. In this article I shall assume that you have already read the article entitled Datagrid Highlight a Row With Click Through...

Binding a Datagrid to an Access Database
This list covers the full lifecycle of a content management system, from initially creating the content, through to delivering it to end users...

Adding Data to a DropDownList
The aim of this article is to answer the question 'How do I add items to a DropDownList?' Initially as part of the declaration for the DropDownList we can also define a number of items, much in the same way as in classic ASP...

Getting Current Date Time
In classic ASP we had now() which would return the current date and time. For asp.net this no longer exists. So what should we use...

Test if File Exists
Sometimes, in order to reduce our chance of error, when working with the filesystem in ASP.NET, we need to determine wether a file exists before performing an action on it. The following short piece of code will enable us to test whether a file exists...

Using Javascript with ASP.NET Form Elements
Adding simple pieces of Javascript to an Asp.net page can be acheived by adding to the attributes of the particular imagebutton or linkbutton. if its normal ASP.Net Button then you can...

Regular Expressions
In the table below we list the characters used in .Net regular expressions, together with their meaning, But first...

Authentication in Asp.net
Forms authentication in ASP.Net is far more easier and safe than Asp 3. It is possible to place a web.config file in any directory of a web site.Therefore, we are able to make most of a web site public, whilst providing authentication on, say, one directory...

Discussion Forums

General ASP.NET

.Net Programming

cSharp Home

Sql Server Home

Javascript / Client Side Development

IT Jobs

Ajax Programming

Ruby on Rails Development

Perl Programming

C Programming Language

C++ Programming

Python Programming Language

Laptop Suggestions?

TCL Scripting

Fortran Programming

Scheme Programming

Asp.Net Frequently Asked Questions/Interview Questions Index

We welcome the opportunity to help raise awareness for issues and problems in the ASP.NET developer community. The Problems listed below have been collected through various forums, websites, blogs and other resources. We have included the references to the originators where we can but if you feel that you should be credited for a given problem please 

If you have a product or service that you would like to be included in the FAQ section, please contact us at   You can also submit your articles at Article Submission 

1. Development and Deployment Issues

   1.1 Why are Server control tags shown in the browser instead of the controls it represents?
   1.2 How To Repair ASP.Net IIS Mapping After You Remove and Reinstall IIS?
   1.3 Why do I get "HTTP 500" error (or "(DLL) initialization routine failed") in my browser?
   1.4 I have recently move my Web application from Windows 2k to Windows Server 2003. All works fine in Windows 2K but i am not able to view pages using Windows Server 2003?
   1.5 What are the Best practices for side-by-side execution of Framework 1.0 and 1.1?

2. Basic


   2.1 What is ASP.NET?
   2.2 Why does my ASP.NET file have multiple <form> tag with runat=server?
   2.3 How to find out what version of ASP.NET I am using on my machine?
   2.4 Is it possible to pass a querystring from an .asp page to aspx page?

3. Debugging and Error Handling


   3.1 Why do I get Error message "Unable to Start Debugging" Error Message When You Send Debug HTTP Request?
   3.2 Why do I get the error message "Unable to start debugging on the web server..." when I debug?
   3.3 When I Debug ASP.NET Applications I get error message "Access Is Denied. Check the DCOM Configuration Settings for the Machine Debug Manager"?
   3.4 On Trying to Debug an application, by the F5 key I get the error: "Error while trying to run project: Unable to start debugging on the web server. Catastrophic failure"?
   3.5 How to configure my project for debugging ASP Code?

4. Miscellaneous


   4.1 How to get the currently logged in user?
   4.2 How to specify a line break in a Label's Text?
   4.3 How to convert a string to HTML format?
   4.4 How do I determine if the user clicked a "Submit" button twice in the page?
   4.5 How to write date-time values of fields in a dataset into xml in a specific format?

5. Calendar


   5.1 How to display multiple dates selected in Calendar Control?
   5.2 How to reset the selected date in the calendar control?
   5.3 How to Customize Individual Days in a Calendar Web Server Control?
   5.4 Is there a way to click an image and let the calendar Control appear?
   5.5 How to Programmatically change backgroundcolor of a Calendar Control using Dropdown List?

6. User Controls


   6.1 How can I include an Asp.NET page in many other Asp.Net pages so that I don't need to rewrite the code?
   6.2 Is there anything similar to web templates in ASP that I can use in ASP.Net?
   6.3 Are there any settings on the application level to make certain elements appear on every page without having to manually insert code or insert UserControls?
   6.4 How to pass a parameter to a user control?
   6.5 How to add user control dynamically into another usercontrol?

7. DataList


   7.1 Why is the DataList not displayed on the web page?
   7.2 How to change the colors of a row to indicate its the Birthday of the Employee (for example) in a DataList?
   7.3 How to group the data in the DataList?
   7.4 Which control should I use when binding a multidimensional array?
   7.5 How to display data in multiple columns for a specific Column in a table in an ASP.NET page?

8. Repeater


   8.1 How to display alphabetically sorted data in Repeater?
   8.2 How to display the Directory names in the Repeater Control?
   8.3 How to define HeaderTemplate and ItemTemplate to the Repeater at runtime TBD?
   8.4 How to add a TemplateColumn dynamically to Repeater?
   8.5 How to implement sorting using Repeater?

9. Security


   9.1 What is the difference between authentication and authorization?
   9.2 How to implement authentication via web.config?
   9.3 How to run a Web application using the permission of an authenticated user?
   9.4 Which are the different ASP.NET authentication modes?
   9.5 How to determine the Windows User from a Web form Application?

10. CheckBox


   10.1 How to assign a text to Checkbox control and know which checkbox is selected?
   10.2 How to validate a CheckBox?

11. Client Side Scripting


   11.1 How to emit client-side javascript blocks from VB.NET/C#?
   11.2 How to open a new Window using javascript function from a Link button?
   11.3 Is there a JavaScript Quick Reference Guide?
   11.4 How to set the background color of a web page using code behind?
   11.5 How to resolve error message "String constants must end with a double quote."?

12. XML


   12.1 How to write the data from database into an XML file?
   12.2 How to read data from an XML file and display it in a DataGrid?
   12.3 How to read data from the XML file using FileStream and display it in a DataGrid?
   12.4 How to save an xml-string into an Xml document?
   12.5 How to use the <asp:xml> tag?

13. CheckBoxList


   13.1 How to retrieve the multiple selected items in a CheckBoxList?
   13.2 How to check if nothing is selected in a CheckBoxList without using a loop to parse through all the items?

14. AdRotator


   14.1 How to use an AdRotator in ASP.NET?
   14.2 Why do I get a blank image when I set the KeywordFilter property of the AdRotator?
   14.3 How to extract the information between the ImageUrl of an Advertisement file?

15. Files


   15.1 What is the best way to rename a file on the webserver in code?
   15.2 How to create a folder in ASP.NET?
   15.3 How to show the ASP.NET code to the users?
   15.4 How to read a html file in ASP.NET?
   15.5 How can I to get the path to the system area that holds temporary files?

16. ListBox


   16.1 How to make the listbox scroll down to show it's last entry when the page loads?
   16.2 How to check if an item already exists in a listbox?
   16.3 How to populate a listbox with the Column Names in a Table?
   16.4 How to clear all the items in a listbox?
   16.5 How to add items dynamically to a ListBox using an ArrayList?

17. Output Caching


   17.1 How can I remove the cache of a page (cached with VaryByParam) for certain request params in code?
   17.2 How can I set a page/control to be cached only for certain parameters?
   17.3 What is Output Caching?
   17.4 I want to Cache based on HTTP header .How can I do that?
   17.5 How to make a page expire immediately in such a way that a warning message "This page has expired."appears?

18. Mail


   18.1 How to send HTML mail in ASP.NET?
   18.2 How to send simple text mail in ASP.NET?
   18.3 What is the namespace used for sending mails?
   18.4 How do I configure a local SMTP server?
   18.5 Why do I get the error message "The transport failed to connect to the server "?

19. GDI+


   19.1 Why do I get the error message "CS0122: 'System.Drawing.Imaging.ImageFormat.jpeg' is inaccessible due to its protection level "?
   19.2 Why do I get the error message "A generic error occurred in GDI+."?
   19.3 How to draw strings vertically on a Bitmap?
   19.4 I am using GDI+ to write on a bitmap. I know how to make font Italic/Bold. What should be done to apply both Italic and Bold?
   19.5 How can I display image from a Sql Server database?

20. Collections and Lists


   20.1 How to bind an ArrayList to a DropDownList?
   20.2 How to check if the ArrayList is empty?
   20.3 I get the error message "DataGrid with id 'DataGrid1' could not automatically generate any columns from the selected data source" when I bind a HashTable to the DataGrid?
   20.4 How to sort ArrayList?
   20.5 How to sort the DataGrid using an ArrayList as the DataSource?

21. RadioButton


   21.1 How can I have the first item in the radiobuttonlist selected?
   21.2 What is the difference between a series of RadioButton controls and a series of Checkbox controls?
   21.3 How can I enforce that only one radiobutton gets selected among a list of Radiobutton controls?

22. Controls


   22.1 How to close the browser window on button control click?
   22.2 How to create server controls at runtime?
   22.3 How to change the text color of a linkbutton control?
   22.4 How to dynamically add validator controls?
   22.5 How to change the image button size during runtime?

23. Table Control


   23.1 How to create a table control dynamically to populate data?
   23.2 How to limit table cell size with long strings?
   23.3 How to use a Table control to display data vertically?
   23.4 Are there any IE specific performance imporvement possible with Table Layout?

24. CSS Styles


   24.1 Why does my page show up poorly in Mozilla based browsers like Netscape and Firefox?

25. DataGrid


   25.1 Why do I get the Columns twice in the datagrid. I am using BoundColumns and TemplateColumns in DataGrid?
   25.2 How to Format and display currency with n decimal points in a BoundColumn.
   25.3 How do I specify more than one parameter for my HyperlinkColumn?
   25.4 Why am I getting an 'AllowCustomPaging must be true and VirtualItemCount must be set for a DataGrid with ID MyDataGrid when AllowPaging is set to true and the selected datasource does not implement ICollection' Error?
   25.5 How do I use a "helper function" to change the column value as Boolean in database to be displayed as Yes/No in Datagrid?

26. Design Time Serialization


   26.1 Why doesn't my properties tagged with the PersistenceMode.InnerProperty attribute get saved in the aspx file?
   26.2 Why doesn't changes made to some of my properties don't get saved in the aspx file during design time?
   26.3 Why doesn't my Collection Properties get saved in the aspx file properly during design-time?

27. Custom Controls


   27.1 How do I insert custom @ Register tags into the aspx file from my custom control?

28. TextBox


   28.1 How to cast the value entered in a textbox to integer?
   28.2 How to allow only numeric values in a textbox using ASP.NET Validator control?
   28.3 Why does TextBox retain its values when posting inspite of having ViewState property disabled for TextBox,?
   28.4 I am running the query SQL="Select name from profile where proID=1"; and I am getting the result in Dataset dsdata. How can I read the text from the dataset and assign it to textbox1.text ?
   28.5 How to align the Text property of the Textbox Control?

29. Dropdownlist


   29.1 I have 3 DropDownLists on the page : one for a Month, second one for a Day, and the last one for a Year. How can I let the user choose the data and enter it to 'datetime' column in the database.
   29.2 How to apply css style to each item of the dropdownlist or listbox control?
   29.3 How to concate and display 2 fields in a dropdownlist?
   29.4 I have a page with a Dropdownlist and some simple code for the SelectedIndexChanged but it does not do a postback?
   29.5 How to add an extra item to the DropDownList filled with data from a database?

30. Config files


   30.1 What is the best place to store Database connection string?
   30.2 My web.config gives error "Unrecognized attribute 'verb'."?
   30.3 Can I use IIS as an alternative way of configuring Custom error pages?



   31.1 What is the Performance comparison between DataSet and DataReader?
   31.2 How to get the count of records in the Database table using the DataSet?
   31.3 How to check if the Dataset has records?
   31.4 How to retrieve value of a field in a dataset?
   31.5 How to filter the data in the DataView and display it in some DataControl?

32. Session


   32.1 How to print out all the variables in the Session?
   32.2 Why isn't session state available?
   32.3 Can I share session state between ASP.NET and ASP pages?
   32.4 Can I share session state between web applications (i.e. "virtual directories" or "applications" in IIS)?
   32.5 What is the difference between Session.Abandon() and Session.Clear()?
Copyright 2005-2015, Megasolutions Ltd  |   Privacy Policy