Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Item vs BindItem: Data Binding in ASP.NET 4.5

ASP.NET 4.5 introduces strongly typed data controls.

From what I could gather there are two options how to access the data item

<%# Item %>

and

<%# BindItem %>

I don't quite understand though, what exactly is the difference between those two? Is this just a matter of naming? Can they be used interchangeable?

like image 339
magnattic Avatar asked Sep 03 '12 14:09

magnattic


People also ask

Which are two types of ASP.NET data binding?

There are two types of data-binding in ASP.NET namely, simple data-binding and declarative data binding.

What are the advantages of strongly typed data binding?

The benefit of this feature is that we can bind the data to the display controls with strong types and we can avoid the exceptions caused by the function Eval(expression) if the expression is not evaluated to a proper value.

Which property of the control needs to be set so that strongly typed data binding can be enabled for an ASP.NET control?

NET 4.5 provides ability to enable strongly-typed data templates. To enable them the ItemType property needs to be set on the data bound control.

What is data binding in AWP?

Data binding forms the link to synchronize data between the data provider (data source) and the data consumer (UI displaying data), enabling two-way connection between visual elements and the data source.


1 Answers

This is the case:

Item: for one-way binding expressions.

BindItem: for two-way data-binding expressions.

like image 160
Erwin Avatar answered Sep 18 '22 01:09

Erwin