1.
What is event bubbling ?
A)
Server controls like Datagrid ,
DataList , Repeater can have other child controls inside them.Example DataGrid can have combo box
inside datagrid.These child control do not raise there events by themselves ,
rather they pass the event to the container parent (which can be a datagrid ,
datalist , repeater) , which passed to the page as “Item Command” event.
2.
How can you enable automatic paging in DataGrid ?
A)
Following are the points to be done in
order to enable paging in Datagrid :-
Set the “AllowPaging” to true.
In PageIndexChanged event set the current
pageindex clicked.
3.
How will decide the design consideration to take a Datagrid , datalist or
repeater ?
A)
Many make a blind choice of choosing datagrid directly , but that's not the
right way.
Datagrid provides ability to allow the
end-user to sort, page, and edit its data .But it comes at a cost of speed.
Second the display format is simple that is in row and columns. Real life
scenarios can be more demanding that With its templates, the DataList provides
more control over the look and feel of the displayed data than the DataGrid .
It offers better performance than datagrid.
Repeater
control allows for complete and total control. With the Repeater, the only HTML
emitted are the values of the databinding statements in the templates along
with the HTML markup specified in the templates—no "extra" HTML is
emitted, as with the DataGrid and DataList. By requiring the developer to
specify the complete generated HTML markup, the Repeater often requires the
longest development time. But repeater does not provide editing features like
datagrid so everything has to be coded by programmer .
However, the Repeater does boast the best
performance of the three data Web controls. Repeater is fastest followed by
DataList and finally datagrid.
4)What’s
difference between Datagrid , DataList and repeater ?
A)
A Datagrid, DataList and Repeater are
all ASP.NET data Web controls.
They have many things in common like
DataSource Property , DataBind Method ItemDataBound and ItemCreated.
When you assign the DataSource Property of a
Datagrid to a DataSet then each DataRow present in the DataRow Collection of
DataTable is assigned to a corresponding DataGridItem and this is same for the
rest of the two controls also.But The HTML code generated for a Datagrid has an
HTML TABLE <ROW> element created for the particular DataRow and its a
Table form representation with Columns and Rows.
For a Datalist its an Array of Rows and based
on the Template Selected and the RepeatColumn Property value We can specify how
many DataSource records should appear per HTML <table> row.
In short in datagrid we have one record per
row, but in datalist we can have five or six rows per row. For a Repeater
Control,The Datarecords to be displayed depends upon the Templates specified
and the only HTML generated is the due to the Templates.
In addition to these , Datagrid has a in-built
support for Sort,Filter and paging the Data ,which is not possible when using a
DataList and for a Repeater Control we would require to write an explicit code
to do paging.
5)
From performance point of view how do
rate datagrid,repeater and
datalist ?
A)
Repeater is fastest followed by
DataList and finally datagrid.
6)
What’s the method to customize columns in DataGrid?
A)
Use the template column.
7)
How can we format data inside DataGrid?
A)
Use the DataFormatString property.
8. What does the Orientation property do in a Menu control?
A) Orientation property of the Menu control sets the
horizontal or vertical display of a menu on a Web page. By default, the
orientation is vertical.
9. Make a list of all
templates of the Repeater control.
A) The Repeater control contains the
following templates:
·
Item
Template
·
AlternatingltemTemplate
·
SeparatorTemplate
·
HeaderTemplate
·
FooterTemplate
10. Explain the AdRotator
Control.
A) The AdRotator is an ASP.NET control that is used
to provide advertisements to Web pages. The AdRotator control associates
with one or many advertisements, which randomly displays one by one at a time
when the Web page is refreshed. The AdRotator control advertisements are
associated with links; therefore, when you click on an advertisement, it
redirects you to other pages. The AdRotator control is associated with a data source, which is normally an xml file or a database table. A data source contains all the information, such as advertisement graphics reference, link, and alternate text. Therefore, when you use the AdRotator control, you should first create a data source and then associate it with the AdRotator control.
11. Which class is
inherited when an ASP.NET server control is added to a Web form?
A) The System.Web.UI.WebControls
class is inherited when an ASP.NET server control is added to a Web form.
12.What are child
Controls?
A) In any databound control we can
create other asp.net standard controls.These controls created with in the databound control are called as
child controls.
13 .When is
itemcommand Event fires?
A) This event will be fired whenever
command event is fired with any child
control with in the databound control.
14. What is Bubbled event?
A)Calling a parent control event from
its child controls is known as "Event Bubblung".
15. What are the XML
predefined tags used in AdRotator Control?
A)·
<Advertisements>
·
<Ad>
·
<ImageUrl>
·
<NavigateUrl>
·
<Impressions>
16. What are the
steps we have to follow to work with any data bound control?
A)·
Designing
the data bound control
·
Preparing
Data Source.
·
Attach
data source to data bound Control.
17. What property must
be set and what method must be called in your code to bind the data from some
data source to the repeater control?
A) You must set the DataSource property
and call the DataBind() method.
18) .Which properties
are used to bind a DataGridView Control?
A) The DataSource property and the
DataMember Property are used to bind a DataGridView control.
19). What are the
Fields using with GridView?
A) The GridView control supports the following
types of fields:
. BoundField—Enables you to display the value of a data item as text.
. CheckBoxField—Enables you to display the value of a data item as a check box.
. CommandField—Enables you to display links for editing, deleting, and selecting
rows.
. ButtonField—Enables you to display the value of a data item as a button
(imagebutton, link button, or push
button).
. HyperLinkField—Enables you to display the value of a data item as a link.
. ImageField—Enables you to display the value of a data item as an image.
. TemplateField—Enables you to customize the appearance of a data item.
20) What are the formatting properties used when formatting a GridView with
Cascading Style Sheets?
A)GridLines—Renders borders around table cells. Possible values are Both,
Vertical,
Horizontal, and None.
. ShowFooter—When True, renders a footer row at the bottom of the GridView.
. ShowHeader—When True, renders a header row at the top of the GridView.
21) Difference between the DetailsView and FormView?
A) The DetailsView control always renders each field in a separate
HTML table row.
The
FormView control, on the other hand, uses a template that enables you to
completely customize the user interface rendered by the control.
22)What are the
Control Events of Repeater Control?
A)
. DataBinding—Raised when the Repeater control is bound to its data source.
. ItemCommand—Raised
when a control contained in the Repeater control raises an event.
. ItemCreated—Raised
when each Repeater item is created.
. ItemDataBound—Raised when each Repeater item is bound.
23) What are the Two
properties used to modify the layout of
the HTML table rendered by the DataList control?
A) RepeatColumns—The number of columns to display.
RepeatDirection—The direction to render the cells. Possible values are Horizontal and Vertical.
24.What is datagrid?
A)The DataGrid Web server control is a
powerful tool for displaying information from a data source. It is easy to use;
you can display editable data in a professional-looking grid by setting only a
few properties. At the same time, the grid has a sophisticated object model
that provides you with great flexibility in how you display the data.
25.What’s
the difference between the System.Web.UI.WebControls.DataGrid and
and System.Windows.Forms.DataGrid?
A)The Web UI control does not inherently support master-detail data
structures. As with other Web server controls, it does not support two-way data
binding. If you want to update data, you must write code to do this yourself.
You can only edit one row at a time. It does not inherently support sorting,
although it raises events you can handle in order to sort the grid contents.
You can bind the Web Forms DataGrid to any object that supports the IEnumerable
interface. The Web Forms DataGrid control supports paging. It is easy to
customize the appearance and layout of the Web Forms DataGrid control as
compared to the Windows Forms one.
26.
How do you customize the column content inside the datagrid?
A)If you want to customize the content of a column, make the column a
template column. Template columns work like item templates in the DataList or
Repeater control, except that you are defining the layout of a column rather
than a row.
27.How
do you apply specific formatting to the data inside the cells?
A)You cannot specify formatting for columns generated when the grid’s
AutoGenerateColumns property is set to true, only for bound or template
columns. To format, set the column’s DataFormatString property to a
string-formatting expression suitable for the data type of the data you are
formatting.
28.
How do you hide the columns?
A)One way to have columns appear dynamically is to create them at design
time, and then to hide or show them as needed. You can do this by setting a
column’s Visible property.
29.How
do you display an editable drop-down list?
A)Displaying a drop-down list requires a template column in the grid.
Typically, the ItemTemplate contains a control such as a data-bound Label
control to show the current value of a field in the record. You then add a
drop-down list to the EditItemTemplate. In Visual Studio, you can add a
template column in the Property builder for the grid, and then use standard
template editing to remove the default TextBox control from the
EditItemTemplate and drag a DropDownList control into it instead.
Alternatively, you can add the template column in HTML view. After you have
created the template column with the drop-down list in it, there are two tasks.
The first is to populate the list. The second is to preselect the appropriate
item in the list — for example, if a book’s genre is set to “fiction,” when the
drop-down list displays, you often want “fiction” to be preselected.
30.How
do you check whether the row data has been changed?
A)The definitive way to determine whether a row has been dirtied is to
handle the changed event for the controls in a row. For example, if your grid
row contains a TextBox control, you can respond to the control’s TextChanged
event. Similarly, for check boxes, you can respond to a CheckedChanged event.
In the handler for these events, you maintain a list of the rows to be updated.
Generally, the best strategy is to track the primary keys of the affected rows.
For example, you can maintain an ArrayList object that contains the primary
keys of the rows to update.
31.what is
a data bound controls?
A)Data bound controls are controls that are bound to
data sources.
32.Data
bound controls are classified into how many types?
A) Simple Data Bound Controls,
Composite
DataBound Controls and
Hierarchical Data Bound Controls.
33.Data
Grid controls is supported in which version of Asp.net?
A)Asp.net 1.0
34.what is
the DataMember property and DataSource property ?
A)DataMember
property of the control selects the list of data that the control has to bind to
when the DataSource contains more than one list.
DataSource
indicates the source of the data it has to bind to.
35.What is
DataSourceid property?
A)DataSourceId
is the ID of the data source object used to retrieve data.
36.Explain
about BulletedList Control?
A)The
BulletedList control is a new addition to list controls in ASP.NET. It can be
used to create a list of formatted list items. Individual items can be
specified by defining a ListItem for each object. The bulleted lists are filled
in from the data source and receives the DataTable returned by a query. The
DataTextField property of the control selects the column to show and the
DisplayMode sets the display mode. The Hyperlink mode links the page directly
to an external URL and click is handled by the browser. The LinkButton mode
click is handled by the ASP.NET runtime and fires a server side event. The
OnClick handler will have to be defined in this instance. The Index property of
the BulletedListEventArgs class contains the base index of the clicked item.
The BulletStyle property controls the customization of the bullet styles.
37.Features
of ListView Control
A) Can
define our own template/Layout/Structure for the data display.
· Edit/Update/Delete
capabilities on the data displayed.
· Built-in
support for inserting new row.
· Built-in
support for sorting
· Supports
databinding via DataSource Controls including LINQ DataSource controls.
· Paging
via DataPager control, which can be part of ListView control or can be kept
outside the control. Means, DataPager can be kept at any part of page as
opposed to GridView where the built-in paging is packed with the control
itself.
38.In
which of asp.net Listview Control is introduced ?
A)Asp.net 3.5
39.what is
the difference between Data Aware Controls and Data Bound Controls?
A)The
Controls which are used for normal outputs and also for binding are called
"Data Aware Controls"
ex:
Dropdown List Control
The
Controls which are used only for databinding purpose are called "Data
bound Controls".
40.Explain
about datapaging in listview Control?
A)To add
pagination in the listview, you need to add an asp:DataPager control, better to
put this control inside LayoutTemplate at the end of the LayoutTemplate. DataPager
control has many options to show pagination and these are useful too.
for
example:
<asp:DataPager
ID="ItemDataPager" runat="server"
PageSize="5">
<Fields>
<asp:NumericPagerField
ButtonCount="2" />
</Fields>
</asp:DataPager>
41.Explain
about sorting in listview Control?
A)It is very
easy to sort data in ListView. Sort functionality is defined in the
CommandArgument property of the button that contains the columns to be sorted.
It occurs when a button with its CommandName property set to Sort is clicked.
And you need to make a call to the Sort method named
onsorting="ListView1_Sorting".
for
example:
// to
allow sort if click on the header of the table make
//table
header controls clickable
//and give
commandname and commandargument
<tr
style="background-color:#E5E5FE">
<th
align="left"><asp:LinkButton ID="lnkId"
runat="server"
CommandName="Sort"
CommandArgument="ID">Id</asp:LinkButton></th>
<th
align="left"><asp:LinkButton ID="lnkName"
runat="server"
CommandName="Sort" CommandArgument="FirstName">Name</asp:LinkButton></th>
<th
align="left"><asp:LinkButton ID="lnkType"
runat="server"
CommandName="Sort"
CommandArgument="ContactType">Type</asp:LinkButton></th>
<th></th>
</tr>
42.The
Common Reason why we use Listview
A)The most
common reason for using the ListView is to create an unusual layout. For
Example , to create a table that places more than one item in the same row, or
to break free from table based rendering altogether. When building a page to
display large amounts of data, ASP.NET developers usually turn to the GridView
first and use the ListView in most specialized scenarios.
It has
included styling with CSS, flexible pagination, and sorting, inserting,
deleting, and updating features.
43.Explain
about Features of Detailsview Control
A)DetailsView
The
DetailsView control is used to display a single record from a data source in a
table, where each field of the record is displayed in a row of the table. It
can be used in combination with a GridView control for master-detail scenarios.
The DetailsView control supports the following features:
Binding to
data source controls, such as SqlDataSource.
Built-in
inserting capabilities.
Built-in
updating and deleting capabilities.
Built-in
paging capabilities.
Programmatic
access to the DetailsView object model to dynamically set properties, handle
events, and so on.
Customizable
appearance through themes and styles.
44.Explain
about Treeview Control?
A)It is a
hierarichal data bound control.
The
TreeView control displays data in a tree-like structure. As with the Menu
control, it can be easily data bound to any hierarchical data source such as
the SiteMapDataSource.
the
TreeView lends itself well to handling large amounts of data. Therefore, in
addition to databinding to a SiteMapDataSource or XMLDataSource, the TreeView
is often data bound to a DataSet or other relational data.
No comments:
Post a Comment