We are providing online training of realtime Live project on Asp.Net MVC with Angular and Web API. For more information click here. If you have any query then drop the messase in CONTACT FORM

Wednesday, August 12, 2015

Inter view questions and answers in ASP.NET Data Bound Controls:

1. What is event bubbling?
Server controls like Datagrid, DataList, Repeater can have other child controls inside them. Example DataGrid can have a combo box inside Datagrid. These child controls do not raise their 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?
 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 page index clicked.

3. What is the difference between eval and bind?
Eval 
Eval is a one-way binding.
If we bind a value using Eval, it is like a read-only. we can only view the data.
Eval() is a one-way, "read-only" way to bind the values.

Bind 
Bind is two-way binding.
If we bind a value using Bind, and if we do some change on the value it will reflect on the database.

4)What’s the difference between Datagrid, DataList, and repeater?
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 we 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 the 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.

5) From a performance point of view, how do ratedatagrid, repeater, and datalist ?
A repeater is fastest followed by DataList and finally Datagrid.

6) What’s the method to customize columns in DataGrid?
Use the template column.

7) How can we format data inside DataGrid?
Use the DataFormatString property.

8. What is ItemCommand? Explain?
ItemCommand is an Event of DataBound control which is fired when a user Click on any button.

9. Make a list of all templates of the Repeater control.
The Repeater control contains the following templates:
  • Item Template
  • AlternatingltemTemplate
  • SeparatorTemplate
  • HeaderTemplate
  • FooterTemplate
10. A data-bound control connects to a data source control through its ___________ property?
DataSourceID

11. Which class is inherited when an ASP.NET server control is added to a Web form?
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?

In any data-bound control,, we can create other asp.net standard controls. These controls created within the data-bound control are called as child controls.

13. When is item command Event fires?
This event will be fired whenever the command event is fired with any child control within the data-bound control.

14. What is a Bubbled event?
Calling a parent control event from its child controls is known as "Event Bubbling".

15 A _____________ control bind to a data source control and automatically fetch data at the appropriate time in the page request lifecycle.

DataBound control.

16. What are the steps we have to follow to work with any data-bound control?

  • Designing the data-bound the 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?
We must set the DataSource property and call the DataBind() method.

18. Which properties are used to bind a DataGridView control?
The DataSource property and the DataMember property are used to bind a DataGridView control.

19. What are the Fields using with GridView?
 The GridView control supports the following types of fields:

  • BoundField—Enables we to display the value of a data item as text.
  • CheckBoxField—Enables us to display the value of a data item as a checkbox.
  • CommandField—Enables we to display links for editing, deleting, and selecting rows.
  • ButtonField—Enables we to display the value of a data item as a button (image button, link button, or push button).
  • HyperLinkField—Enables we to display the value of a data item as a link.
  • ImageField—Enables us to display the value of a data item as an image.
  • TemplateField—Enables us to customize the appearance of a data item.

20) What are the formatting properties used when formatting a GridView with Cascading Style Sheets?
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?
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 us to completely customize the user interface rendered by the control.

22)What are the Control Events of Repeater Control?

  • 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?

  • RepeatColumns—The number of columns to display.
  • RepeatDirection—The direction to render the cells. Possible values are Horizontal and Vertical.

24. What is Datagrid?
The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; we 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 us with great flexibility in how we display the data.

25. What’s the difference between the System.Web.UI.WebControls.DataGrid and System.Windows.Forms.DataGrid?
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 we want to update data, we must write code to do this our-self. we can only edit one row at a time. It does not inherently support sorting, although it raises events we can handle in order to sort the grid contents. we 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?
If we 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 we are defining the layout of a column rather than a row.

27. How do you apply specific formatting to the data inside the cells?
we 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?
One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. we can do this by setting a column’s Visible property.

29. . What is Cascading in DataBound controls?

Cascading in DataBound Controls Refer to the behavior of a control in accordance with the other i.e Data of one control is filtered by the other control.
Here Simple data binding plays a very important role as they have DisplayField and the value field.

30. What are the DataBound Controls that support Insertion?

Not all DataBound Controls support insertion in order to achieve this, the controls should

support 2-way binding so as to perform insertion into the DataSource. Here 2-way binding refers to Extracting and Inserting the data from and into the DataSource.
below is the list of such controls.

(i) FormsView

(ii) DetailsView

(iii)DataListView

Above controls support Grouping, Paging, Inserting, Editing and Deleting of the

data from the DataSource bonded to them.

31.what is a data-bound control?

Data bound controls are controls that are bound to data sources.

32. Data bound controls are classified into how many types?

Simple Data Bound Controls,
Composite DataBound Controls and
Hierarchical Data Bound Controls.

33. Data Grid controls are supported in which version of Asp.net?
Asp.net 1.0

34.what is the DataMember property and DataSource property?
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?

DataSourceId is the ID of the data source object used to retrieve data.

36. .______________ Controls enable rich capabilities for retrieving and modifying data, including querying, sorting, paging, filtering, updating, deleting, and inserting.
DataSource control.

37.Features of ListView Control
Can define our own template/Layout/Structure for the data display.

  • Edit/Update/Delete capabilities on the data displayed.
  • Built-in support for inserting a new row.
  • Built-in support for sorting
  • Supports data binding 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 the 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?
Asp.net 3.5

39.what is the difference between Data Aware Controls and Data Bound Controls?

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 data binding purpose are called "Data bound Controls".

40. how can we find the value of the control present inside the gridView cell?

To find the value of the Control we have to follow two steps

1. Identify the cell position in the grid
2. use the FindControl() method over in the cell position

41. . What is the RowDataBound Event? Explain?
RowDataBound is and the event of GridView Control that fires when the gridView is binding with the data. informally, while loading the data into the gridView this event fires

42.The Common Reason why we use Listview
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
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.what is an item template?
ItemTemplate: ItemTemplate defines how each item is rendered from the data source collection.

45.what is an AlternatingItemTemplate?
AlternatingItemTemplates is used to change the background color and styles of AlternatingItems in DataSource collection

46.what is a HeaderTemplate?
HeaderTemplate is used to display Header text for DataSource collection and apply different styles for header text.

47.what is a FooterTemplate?

FooterTemplate is used to display footer element for DataSource collection

48.what is a SeparatorTemplate?
The <SeparatorTemplate> element can be used to describe a separator between each record.

49. What is the Difference between the RowUpdating Event and RowUpdated Event?

  • The RowUpdated event is raised when a row's Update button is clicked but after the GridView control updates the row.
  • The RowUpdating event is raised when a row's Update button is clicked, but before the GridView control updates the row.

50. Can we bind data to a server control without writing code in .NET?
Yes, that is possible. ASP.NET 2.0 has the feature of declarative solution for data binding which

requires no code at all for the most common data scenarios, such as:

  • Selecting and displaying
  • Data Sorting
  • Paging and Caching
  • Data Updating
  • Inserting and Deleting Data

51. What is the New Advanced Data-bound Controls used with ASP.NET?

  • RadGrid
  • SqlDataSource: We can bind the data using Select, Insert, Update from database using SqlDataSource control without writing a single line of code


No comments: