Basic Dot Net Questions and Answers
Download Dot Net eBook

Download PDF Download Dot Net Questions eBook

Dot Net Questions and Answers: Submit Your Question

1 :: What should you do to store an object in a Viewstate?

Do serialization of convert the object to string
Is This Answer Correct?    3 Yes 1 No
Submit Your Answer

2 :: What should one do to make class serializable?

To make a class serializable is to mark it with the Serializable attribute as follows.
public class MyObject {
public int n1 = 0;
public int n2 = 0;
public String str = null;
Is This Answer Correct?    1 Yes 0 No
Submit Your Answer

3 :: What is Viewstate in .NET?

A server control’s view state is the accumulation of all its property values. In order to preserve these values across HTTP requests, ASP.NET server controls use this property, which is an instance of the StateBag class, to store the property values.
Is This Answer Correct?    1 Yes 0 No
Submit Your Answer

4 :: What is the use of ErrorProvider Control in .NET?

The ErrorProvider control is used to indicate invalid data on a data entry form. Using this control, you can attach error messages that display next to the control when the data is invalid, as seen in the following image. A red circle with an exclamation point blinks, and when the user mouses over the icon, the error message is displayed as a tooltip.
Is This Answer Correct?    0 Yes 0 No
Submit Your Answer

5 :: What is the Difference Between Response.write & response.output.Write?

In ASP.NET the Response object is of type HttpResponse and when you say Response.Write you’re really saying (basically) HttpContext.Current.Response.Write and calling one of the many overloaded Write methods of HttpResponse. Response.Write then calls .Write() on it’s internal TextWriter object:
public void Write(object obj){ this._writer.Write(obj);}
HttpResponse also has a Property called Output that is of type, yes, TextWriter, so:
public TextWriter get_Output(){ return this._writer; }
Which means you can to the Response whatever a TextWriter will let you. Now, TextWriters support a Write() method ala String.Format, so you can do this:
Response.Output.Write(”Scott is {0} at {1:d}”, “cool”,DateTime.Now);
But internally, of course, this this is happening:
public virtual void Write(string format, params object[] arg)
this.Write(string.Format(format, arg));
Is This Answer Correct?    2 Yes 0 No
Submit Your Answer

Place Your Question