27 June, 2009

Dot Net Interview Questions - Intermediate

23 . How to change the Page Title dynamically
//Declareprotected System.Web.UI.HtmlControls.HtmlGenericControl Title1 ;
//In Page_LoadTitle1.InnerText ="Page 1" ;
24 . Why do I get the error message "Object must implement IConvertible". How can I resolve it?
The common cause for this error is specifying a control as a SqlParameter's Value instead of the control's text value.For example, if you write code as below you'll get the above error:
SqlParameter nameParameter = command.Parameters.Add("@name", SqlDbType.NVarChar, 50);nameParameter.Value = txtName ;
To resolve it, specify the control's Text property instead of the control itself.
nameParameter.Value =txtName.Text;
25 . Why is default.aspx page not opened if i specify http://localhost. I am able to view this page if i hardcode it as http://localhost/default.aspx?
If some other default page comes higher in the list, adjust the default.aspx to be the number one entry inside the IIS configuration. If you have multiple websites inside IIS, make sure the configuration is applied on the right website (or on all websites by applying the configuration on the server-level using the properties dialog, configure WWW service).
26 . Can ASP.NET work on an NT server?
No. For more details refer ASP 1.1 version
27 . Is it possible to migrate Visual InterDev Design-Time Controls to ASP.NET?
Refer INFO: Migrating Visual InterDev Design-Time Controls to ASP.NET
28 . How to automatically get the latest version of all the asp.net solution items from Source Safe when opening the solution?
In VS.NET you can go to Tools > Options > Source Control > General and check the checkbox for Get everything when a solution opens.This retrieves the latest version of all solution items when you open the solution.
29 . How to make VS.Net use FlowLayout as the default layout rather than the GridLayout?
For C#, go to path C:\Program Files\Microsoft Visual Studio .NET 2003\VC#\VC#Wizards\CSharpWebAppWiz\Templates\1033Change the following line in the existing WebForm1.aspx
Note:Before changing any templates it's a good idea to make backup copies of themOr rather than above approach you can change the behavior for new files on a per project basis in Visual Studio by:
1. Right clicking on the project name (Ex: "WebApplication1)" in Solution Explorer, and select "Properties".2. From project properties window, under Common Properties>Designer Defaults>Page Layout change "Grid" to "Flow".
30 . Can I use a DataReader to update/insert/delete a record?
No. DataReader provides a means of reading a forward-only stream of rows from a database.
31 . How to format a Telphone number in the xxx-xxx-xxxx format?
double Telno= double.Parse(ds.Tables[0].Rows[0]["TelNo"].ToString());Response.Write(Telno.ToString("###-###-####"));32 . Can two different programming languages be mixed in a single ASPX file?
No. ASP.NET uses parsers to strip the code from ASPX files and copy it to temporary files containing derived Page classes, and a given parser understands only one language
33 . Can I use custom .NET data types in a Web form?
Yes. Place the DLL containing the type in the application root's bin directory and ASP.NET will automatically load the DLL when the type is referenced. This is also what happens when you add a custom control from the toolbox to your web form.

No comments: