ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories >> Software >> Microsoft-Related
 
  Visual-Basic (595)  C-Sharp (528)  ASP.NET (1113)  VB.NET (112)  COM+ (37)
  ADO.NET (173)  IIS (64)  MTS (2)  Crystal-Reports (48)  BizTalk (17)
  Exchange-Server (75)  SharePoint (2)  Microsoft-Related-AllOther (41)
 


 

Back to Questions Page
 
Question
difference between writing connection string in web.config 
through connection string and appsettings
Rank Answer Posted By  
 Question Submitted By :: Swapna
This Interview Question Asked @   iSoft
I also faced this Question!!   © ALL Interview .com
Answer
Introduction

In many cases, we need to use some data string throughout
the application, database connection string is the best
example of it. Instead of writing the connection string
wherever we are creating a connection, its good practice
(and easy to maintain too) to store it into web.config file
and get it at desired place.

Places to store data into Web.Config file

There are two places where we can store data into our
web.config file. These are appSettings and
connectionStrings. Following is the code snippet from the
web.config file where we can store data and retrieve at
later point of time.

<configuration>

<appSettings>

<add key="ConnStr" value="Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\MyData\App_Data\Database.mdf;Integrated
Security=True;User Instance=True"/>

</appSettings>

<connectionStrings>

<add name="ConnStr" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\MyData\App_Data\Database.mdf;Integrated
Security=True;User Instance=True"/>

</connectionStrings>

</configuration>

 

Here appSettings is meant for any data string that can be
stored while connectionString is meant for storing the
database connection strings only.

 
How to Get data from Web.Config

Getting data from web.config file is simple. If you want to
get data from appSettings tag then you need to write
following code

string connStr =
System.Configuration.ConfigurationManager.AppSettings["ConnStr"].ToString();

To get data from web.config file stored under
connectionStrings tag, you need to write following code

string connStr =
System.Configuration.ConfigurationManager.ConnectionStrings["ConnStr"].ToString();

 
Getting connectionStrings value into .aspx page

If for some reason you want to access the string stored in
connectionStrings tag into .aspx page (You may need this
while using SqlDataSource control), you need to write
following code (Notice the code in the pink color <%$
ConnectionStrings:ConnStr %>).

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString='<%$ ConnectionStrings:ConnStr %>'

SelectCommand="Select * FROM SampleForTutorials ORDER BY
[Name]" DataSourceMode="DataSet">

</asp:SqlDataSource>

 
Conclusion

Web.Config file is the best place to store small and simple
string that can be used throught the application. Using
System.Configuration.ConfigurationManager class that exists
in System.Configuration namespace, we can retrive them
wherever we need.
 
5
Ramesh P
 
 
Answer
 both section are used for describing database strings and
values .This is used throughout our project if we using web
applications. 
 
0
Bathirasamy
 
 
Question
Interface have Default Modifier Is 'Public'.Where We Will 
Use The KeyWord In Interface?
Rank Answer Posted By  
 Question Submitted By :: Als.senthur Ganesh
This Interview Question Asked @   Phoenix-Technologies
I also faced this Question!!   © ALL Interview .com
Answer
when we want to implement multiple inheritance in c# then 
we use these keyword.inteface means purly abstract class
 
0
Shilpa
 
 
 
Answer
Interface is Implements but never create instant of object
 
0
Sandeep
 
 
Answer
When u create an interface then u can delclare with Public 
Key word.Like

Public Interface WorkOrder
{
  //Decleare Method here.
}
 
0
Surya Narayana Panda
 
 
Question
Is It Possible For Whole Page is Saved In View State?
What Is View State?
Rank Answer Posted By  
 Question Submitted By :: Als.senthur Ganesh
This Interview Question Asked @   Phoenix-Technologies , NetWorth, Phoinix
I also faced this Question!!   © ALL Interview .com
Answer
When a form is submitted in classic ASP, all form values are
cleared. Suppose you have submitted a form with a lot of
information and the server comes back with an error. You
will have to go back to the form and correct the
information. You click the back button, and what
happens.......ALL form values are CLEARED, and you will have
to start all over again! The site did not maintain your
ViewState.

When a form is submitted in ASP .NET, the form reappears in
the browser window together with all form values. How come?
This is because ASP .NET maintains your ViewState. The
ViewState indicates the status of the page when submitted to
the server. The status is defined through a hidden field
placed on each page with a <form runat="server"> control.
The source could look something like this:

<form name="_ctl0" method="post" action="page.aspx" id="_ctl0">
<input type="hidden" name="__VIEWSTATE"
value="dDwtNTI0ODU5MDE1Ozs+ZBCF2ryjMpeVgUrY2eTj79HNl4Q=" />

.....some code

</form>
 
4
Ranjith
 
 
Answer
View State is nothing but to store peace of information 
in the form of hidden field

Yes. It is Possible For Whole Page is Saved In View State
 
0
Sandeep
 
 
Question
Is It Possible for Static Variables access normal variable? 
and Normal Varialbe Access the static Variables?
Rank Answer Posted By  
 Question Submitted By :: Als.senthur Ganesh
This Interview Question Asked @   Phoenix-Technologies
I also faced this Question!!   © ALL Interview .com
Answer
static variables can access using this keyword. and the 
normal variables can access the static variables using 
class.variable_name.
 
0
Srinu
 
 
Question
Difference Between ReadOnly and Constant Variable in 
compile time and Run Time.
Rank Answer Posted By  
 Question Submitted By :: Als.senthur Ganesh
This Interview Question Asked @   Phoenix-Technologies
I also faced this Question!!   © ALL Interview .com
Answer
readonly variables are can be initilized at compile time
but we can assign values to readonly varialble at once 
through functions or constructors

but in case of constant variables once assign a value we 
can't change value and must assign value to constant 
variables at the time of declarition
 
0
Kamlesh Sharma
 
 
Answer
I am adding another point to the above answer.

as the constant variable is constant over the class,that 
means,all the objects created for that class have the same 
value.
but in case of readonly variables,we can assign different 
values in the different instances of the class it contains.
 
0
Karna
 
 
Answer
readonly is compile time constant.
constant is runtime constant.

constatnt field is used to initialize at the declaration of 
the field.
readonly field is used at the declaration or constructor of 
the field.
 
0
Saiish Bhat
 
 
Question
What Are The Difference Between AutoEventWireup="true" and 
AutoEventWireup="False"
Rank Answer Posted By  
 Question Submitted By :: Als.senthur Ganesh
This Interview Question Asked @   Phoenix-Technologies
I also faced this Question!!   © ALL Interview .com
Answer
if the AutoEventWireup="true" propety in dropdown when 
index changed automatically post back to the server.

if the AutoEventWireup="true" propety in dropdown when 
index changed will not  post back to the server.
 
0
Rafiq
 
 
Answer
When you set the value of the AutoEventWireup attribute to 
false, you must manually hook up events to event handlers. 
such as Page_Load() etc.

When you set the value of the AutoEventWireup attribute to 
true, the ASP.NET page framework can automatically raise 
events.
such as Page_Load() etc.
 
0
Navneet
 
 
Answer
Sorry in the above example is small mistake 


if the AutoEventWireup="true" propety in dropdown when 
index changed automatically post back to the server.

if the AutoEventWireup="false" propety in dropdown when 
index changed will not  post back to the server.
 
0
Navneet
 
 
Answer
I guess what you mean is AutoPostBack="true" in which the 
index change of a drop down box will be posted back to 
server.
Please correct me if I am wrong.

To know the difference between autoEventWireup="true" and 
autoEventWireup="false" please refer the below link:

http://support.microsoft.com/kb/324151

Regards,
Meganadha Reddy K.
 
0
Meganadha Reddy K.
 
 
Answer
When you set the value of the AutoEventWireup attribute to 
false, you must manually hook up events to event handlers. 

When you set the value of the AutoEventWireup attribute to 
true, the ASP.NET page framework can automatically raise 
events.
 
5
Vishnu Prasad.c
 
 
Answer
The default value for AutoEventWireup is true for a C# web 
form, and false for a VB.NET web form. The IDE adds the 
default values to the @ Page directive for a new web form. 
The difference in defaults is partly because VB.NET has a 
mechanism for defining an event handler and subscribing to 
an event in one graceful motion (the Handles keyword). 


Protected Sub Page_Load(ByVal sender As Object, _
                        ByVal e As System.EventArgs) _
                        Handles Me.Load
    ' ...

End Sub


An easy way to generate the above code is to use the drop 
down controls that sit just above the editor. Note: C# 
doesn t make the dropdown list of events available when 
editing a code-beside file, but the dropdown is available 
when writing in-line code. 

There is no equivalent to the Handles keyword in C# 
(anonymous event handlers are arguably close, but just not 
the same). When AutoEventWireup is true, all we need to do 
is follow the method naming convention of 
Page_EventToHandle. The ASP.NET runtime will automatically 
find and fire the method for the appropriate event. 


protected void Page_Load(object sender, EventArgs e)
{

}


Once Again, In Reverse
If we switch to AutoEventWireup= true  for a VB.NET web 
form, we can use the magic Page_EventName approach. The 
only change to the earlier VB.NET code would be to drop the 
Handles clause, and the events fire correctly. 

If we switch to AutoEventWireup= false  for a C# web form, 
there is a little extra work to do. Somewhere we need to 
explicitly wire up events. Here is one approach. 


public partial class _Default : Page
{
   public _Default() // ctor
   {
      Load += new EventHandler(Page_Load);
      PreInit += new EventHandler(Page_PreInit);         
   }

    protected void Page_Load(object sender, EventArgs e)
    {
       // ...
    }

   protected void Page_PreInit(object sender, EventArgs e)
   {
      // ...
   }
}
 
0
Vinodh Reddy
 
 
Answer
First of all the above answer that default value for auto
eventwireup=true is false bcoz the default value of
autoeventwireup=false in c#

A false value indicates that you must explicitly write a
code to bind events related to a page ,such as the load
event of a page

and true value indicates that events will be generated
automatically
 
0
Ruchika Garg
 
 
Answer
here is the proper valid answer
AutoEventWireup attribute
AutoEventWireup is a Boolean attribute that indicates
whether events of a Web Forms page are autowired.The default
value for AutoEventWireup is TRUE.

In Visual Basic .NET or in Visual Basic 2005, the designer
performs this binding using the Handles keyword in the
declaration of the event-handler method.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load

The ASP.NET page framework supports an alternative mechanism
that uses the AutoEventWireup attribute of a Web Forms page
to automatically associate page events and event-handler
methods. If the AutoEventWireup attribute of the @ Page
directive is set to TRUE (or if it is not specified because
its default value is TRUE), the ASP.NET page framework
automatically calls page event-handler methods.

For example, the Page_Init and Page_Load event-handler
methods are explicitly called by the ASP.NET page framework,
without using the Handles keyword or an explicit event delegate.

Conclusion
When you explicitly set AutoEventWireup to TRUE, Visual
Studio .NET or Visual Studio 2005, by default, generates
code to bind events to their event-handler methods. At the
same time, the ASP.NET page framework automatically calls
the event-handler methods based on their predefined names.
 
0
Anil Jadhav
 
 
Answer
Dont read all the those things simply understand

actually AutoEventWireup is written in page directive like 
this 

<%@ Page Language="C#" AutoEventWireup="true" 
CodeFile="Default2.aspx.cs" Inherits="Default2" %>

by default it is "true", that means all the events that are 
automatically rises when page is loading


if AutoeventWireUp=false then we have to manually write 
events and delegates  like this




 public _Default() // ctor
   {
      Load += new EventHandler(Page_Load);
      PreInit += new EventHandler(Page_PreInit);         
   }

    protected void Page_Load(object sender, EventArgs e)
    {
       // ...
    }

   protected void Page_PreInit(object sender, EventArgs e)
   {
      // ...
   }
 
0
Uma
 
 
Question
How To Call Outside Javascript File?
Example : Our Project File  Folder Name "Sample" Another 
Folder Name "Check".Check Folder Is Out Side Of Our 
Project ?Check Folder Have Verify.Js File. My Question Is 
How To Call Verify.Js File.
Rank Answer Posted By  
 Question Submitted By :: Als.senthur Ganesh
This Interview Question Asked @   Phoenix-Technologies , Consagous
I also faced this Question!!   © ALL Interview .com
Answer
You can call in header section with following code.
<script src="myJavaScript.js" 
type="text/javascript"></script>
 
0
Sanjay
 
 
Answer
Assuming the following directory structure:

~/Sample/project.html
~/Check/verify.js

to use the javascript file in project.html insert the below 
code between the <head> and </head>:

<script src="../Check/verify.js" type="text/javascript">
</script>
 
0
Vikas
 
 
Question
how can i connect the samble database that comes with  vb-6
(biblio.mdb) to a datagrid using code?

ie what code i have to put in load event
Rank Answer Posted By  
 Question Submitted By :: Ranjith
I also faced this Question!!   © ALL Interview .com
Answer
make the adodc connection with database from its property
connection string & connect datagrid with adodc & write the code


  adodc_.recordsource = "select * from table name"
  datagrid.refresh
  adodc.refresh
 
0
Karan Munjal
 
 
Question
When a dropdownlist has been added by some records and it
has been binded why it is not executing i'm facing this
error pls help me ?

if (is!pageposback)

{
arraylist books = new arraylist;
books.add ("gone with the wind");
books.add ("rahulsriramprakash");
books.add ("vishal");
dropdowndisplay.datasource=books;
dropdowndisplay.databind();
}

The error is :

1) The dropdowndisplay does not exist.
Rank Answer Posted By  
 Question Submitted By :: Rahul
This Interview Question Asked @   Netsweeper
I also faced this Question!!   © ALL Interview .com
Answer
make sure that dropdownlist is there in the webform
 
0
Rajesh
 
 
Answer
Even i tried with that even it's saying the same error.
 
0
Rahul
 
 
Answer
though u have the control in the web form some times is
shows like that onle,
the solutions is u better delete the control and add it
again u will get it
 
0
Vyas Pyk
 
 
Answer
if (!IsPostBack)
        {
            ArrayList books=new ArrayList();
            books.Add("gone with the wind");
            books.Add("rahulsriramprakash");
            books.Add("vishal");
            dropdowndisplay.DataSource = books;
            dropdowndisplay.DataBind();
        }
 
0
Sujit Biswas
 
 
Question
please give a brief knowledge about these events ?

page_render()
page_prerender()
page_unload
page_loadcomplete
page_preinit

Rank Answer Posted By  
 Question Submitted By :: Rahul
This Interview Question Asked @   Netsweeper
I also faced this Question!!   © ALL Interview .com
Answer
page_render(): Outputs content of a page to a provided
HtmlTextWriter object and stores tracing information about
the control if tracing is enabled.

page_prerender(): Occurs when a page is about to render its
content
page_unload():occurs when a page is unloaded from memory
page_loadcomplete():Raises the load event
page_preinit():raises the init event
 
0
Kowledgenet
 
 
Question
what are design patterns in .net....?
Rank Answer Posted By  
 Question Submitted By :: Dotnet
I also faced this Question!!   © ALL Interview .com
Answer
set of rules for programmers to write set of instructions 
to program. there are few famous in-use practices available 
like singleton and design patterns have their own 
advantages and disadvantages.
 
0
Saqib
 
 
Answer
Creational, Structural and behavioral patterns are the .net
design patters.
 
0
Rakesh.b
 
 
Question
what is AGILE SCRUM methodoly....?
Rank Answer Posted By  
 Question Submitted By :: Dotnet
I also faced this Question!!   © ALL Interview .com
Answer
In this method we dont have standard design document which 
describes the business objects and business 
interfaces.Based on the requirements codes are written 
without refering any high level design documents.
 
0
Satya Narayan Sahoo
 
 
 
Back to Questions Page
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com