开发者

Different techniques to bind the Data Controls - ASP.net

开发者 https://www.devze.com 2022-12-24 01:57 出处:网络
开发者_如何学运维Recently I wasasked the following question at interview. \"What are the different way to bind a Data Control in ASP.Net\".
开发者_如何学运维

Recently I was asked the following question at interview.

"What are the different way to bind a Data Control in ASP.Net".

I have answered

  1. Typed DataSet

  2. Collections

  3. Stored Procedure.

The interviewer expecting a lot more. Can anyone explain me the different way that we can bind the data controls?


It's difficult to answer this question without knowing the context in which it was asked.

For instance, you can bind a datasource to a control in your markup or in the codebehind file.

You can refer to a control to bind explicitly, or use reflection to find it.

You can provide a datasource derived from a database call (for instance, from a stored proc, but that should really happen far, far away from the .aspx/.aspx.cs in your data access layer)

You can provide a collection of objects that are in no way tied to a database.

Blah. Blah. Blah.

It really depends on what sort of answer they're looking for. I've found that most technical interviewers are pretty open about their expectations - for instance, do they want to know what types of data sources can be used, where they can be assigned, or what? The question is vague.


You can bind to an IListSource or an IEnumerable

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号