Thursday, November 15, 2007

Dot Net Interview Questions - Part 13

  1. How to implement DataGrid in .NET? How would u make a combo-box appear in one column of a DataGrid? What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for DataGrid methods, what is the access specifier used for that methods in the code behind file and why?
  2. How can we create Tree control in asp.net?
  3. Write a program in C# for checking a given number is PRIME or not.
  4. Write a program to find the angle between the hours and minutes in a clock
  5. Write a C# program to find the Factorial of n
  6. How do I upload a file from my ASP.NET page?
    In order to perform file upload in your ASP.NET page, you will need to use two classes: the System.Web.UI.HtmlControls.HtmlInputFile class and the System.Web.HttpPostedFile class. The HtmlInputFile class represents and HTML input control that the user will use on the client side to select a file to upload. The HttpPostedFile class represents the uploaded file and is obtained from the PostedFile property of the HtmlInputFile class. In order to use the HtmlInputFile control, you need to add the enctype attribute to your form tag as follows:

    Also, remember that the /data directory is the only directory with Write permissions enabled for the anonymous user. Therefore, you will need to make sure that the your code uploads the file to the /data directory or one of its subdirectories.
    Below is a simple example of how to upload a file via an ASP.NET page in C#.
    <%@ Import Namespace="System" %>
    <%@ Import Namespace="System.Web" %>
    <%@ Import Namespace="System.Web.UI.HtmlControls" %>
    <%@ Import Namespace="System.IO" %>
    <%@ Import Namespace="System.Drawing" %>


    upload_cs








    OnClick="UploadFile">




    uploaded

    bytes





  7. How do I send an email message from my ASP.NET page?
    You can use the System.Web.Mail.MailMessage and the System.Web.Mail.SmtpMail class to send email in your ASPX pages. Below is a simple example of using this class to send mail in C# and VB.NET. In order to send mail through our mail server, you would want to make sure to set the static SmtpServer property of the SmtpMail class to mail-fwd.

    <%@ Import Namespace="System" %>
    <%@ Import Namespace="System.Web" %>
    <%@ Import Namespace="System.Web.Mail" %>


    Mail Test






  8. Write a program to create a user control with name and surname as data members and login as method and also the code to call it. (Hint use event delegates) Practical Example of Passing an Events to delegates
  9. How can you read 3rd line from a text file?

No comments: