Welcome Guest Search | Active Topics | Sign In | Register

Using combobox in Formview Options
Chris
Posted: Wednesday, September 7, 2016 10:29:45 AM
Rank: Newbie
Groups: Member

Joined: 9/7/2016
Posts: 3
I cannot find an example anywhere of how to bind data to an EO Combobox inside an ASP Formview. Is that possible?

I'm using eo.web 2011.

Thanks,
Chris
eo_support
Posted: Wednesday, September 7, 2016 1:01:41 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

If you just want to bind the ComboBox's Text property, you can just use a simple Eval expression. If you want to bind to the ComboBox's item list, then you can handle your FormView's DataBound event and then follow these steps:

1. Find the child control that you wish to data bind in the ComboBox's DropDownContainer property. For example, if you have a Grid inside the ComboBox's DropDownTemplate, you can use:

Code: C#
//Find the child control you wish to data bind
EO.Web.Grid grid = (EO.Web.Grid)ComboBox1.DropDownContainer.FindControl("Grid");


2. Once you find the specific control, you can then set the control's DataSource and then call its DataBind method to populate that control. For example:

Code: C#
//Populate the Grid
grid.DataSource = GetComboBoxDropDownDataSource();
grid1.DataBind();


You can use any control in the ComboBox's DropDownTemplate. For example, you may use a ListBox control. In that case you can simply replace "Grid" with "ListBox" in the above code and follow the steps to data binding a ListBox instead.

Hope this helps.

Thanks!
Chris
Posted: Wednesday, September 7, 2016 1:04:09 PM
Rank: Newbie
Groups: Member

Joined: 9/7/2016
Posts: 3
I just want to bind the ComboBox's Text property. Can you give me an example of where/how to do that?
eo_support
Posted: Wednesday, September 7, 2016 1:05:56 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You would just bind it the same way as you bind a regular ASP.NET control, such as a Label's Text property. Since there is no difference than other standard controls, we do not provide code samples on this.

Thanks!
Chris
Posted: Wednesday, September 7, 2016 1:11:05 PM
Rank: Newbie
Groups: Member

Joined: 9/7/2016
Posts: 3
See, this is my problem Essential Objects. Total lack of documentation.
eo_support
Posted: Wednesday, September 7, 2016 1:27:07 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Chris wrote:
See, this is my problem Essential Objects. Total lack of documentation.


You are not the first one trying to play finger pointing when we do not answer generic programming questions. Our position on this issue is very clear and consistent. If it is the same way as any other ASP.NET controls, then we consider it generic ASP.NET programming question and we will not provide support on such issues. If we were to answer such questions, it would encourage our users to run every generic programming questions through us, ranging from how to declare the control, how to handle an event, or even simple complier errors. For those issues, you will need to seek other channels. This has nothing to do with documentation, it's about who is responsible for what. It is not only unpractical, but also would be completely redundant if we were to create documentation that covers hundreds or even thousands different generic ASP.NET programming topics. Generic programming issues is your own responsibility.

In your case, not only your question is a generic programming question, but also your support period has expired long ago. So we are not obligated to answer any of your question at all. In practice, we do try our best to answer our user's question even if their tech support has expired as long as their questions are not abusive and excessive, so we would appreciate if you try to keep it that way.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.