DropDownList data binding question

3 posts, 0 answers
  1. Neil
    Neil avatar
    3 posts
    Member since:
    Nov 2015

    Posted 22 Nov 2015 Link to this post

    Hi,

    in former WebForm projects I was using asp:DropDownList mostly in these kind of scenarios:

    1) The DL was fully rendered server side and the selectable values have been populated using Object/SQL/LinqDataSource on the server.

    2) The DL was two-way-bound (by the Bind or Eval statement) to a property of an arbitrary data model, e.g. in the context of a ListView or FormView.

    To give you an example of the use case: Say a "status" property in a model need to have values like "On", "Off", "Unknown" and nothing else. An ObjectDataSource ensured, that the DL only contained the values for selection. Then the real model was queried in order to find the selected value and that was selected after Page_Load automatically. Once the user changed the selected value in the "status" DL, the new value was posted back to the server.

    That worked fine.

    I know how to achieve 1) in the "Kendo World", but I'm wondering, how I could simultaneously "two-way-bind" the DL to another model in order to set the "SelectedItem" form another data model as well as to POST finally changes made by the user.

    Any pointer welcome

    TIA

  2. Neil
    Neil avatar
    3 posts
    Member since:
    Nov 2015

    Posted 24 Nov 2015 in reply to Neil Link to this post

    Oh... too weird?:)
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Neil
    Neil avatar
    3 posts
    Member since:
    Nov 2015

    Posted 24 Nov 2015 in reply to Neil Link to this post

    I realized that I can easily achieve that by using ordinary Razor "....For" elements

    Closed

Back to Top