Odd DataBinding Problem

Odd DataBinding Problem

Old forum URL: forums.lhotka.net/forums/t/3128.aspx


jason2000 posted on Tuesday, July 03, 2007


1. In order to operate coventiently, a listbox is added to the Form ProjectEdit. The datasource  of the listbox is ProjectList. The SelectedValueChanged event handler is implemented as follows.

      private ProjectList _projectList = ProjectList.GetProjectList();
      private void projectInfoListBox_SelectedValueChanged(object sender, EventArgs e)
      {
          if (projectInfoListBox.SelectedValue != null)
          {
              _project = ProjectTracker.Library.Project.GetProject(new Guid(projectInfoListBox.SelectedValue.ToString()));
              this.roleListBindingSource.DataSource = RoleList.GetList();
              this.projectBindingSource.DataSource = _project;
              ApplyAuthorizationRules();
          }
      }

2 .Updated AddAuthorizationRules() in Project like this

    protected override void AddAuthorizationRules()
    {
      AuthorizationRules.AllowWrite("Name", "Administrator");
      AuthorizationRules.AllowRead("Name", "Administrator");
      AuthorizationRules.AllowWrite("Started", "ProjectManager");
      AuthorizationRules.AllowWrite("Ended", "ProjectManager");
      AuthorizationRules.AllowWrite("Description", "ProjectManager");
    }

3.Log in as pm/pm

4.select a project and Edit it,the project name dosen't display as expected.

5.log out and then log in as rocky/lhotka

6.Some upsetting oddity happens:the project name dosen't display although editable.

7. Clicking  the items of the ProjectListBox  for several times,  the project name displays finally.

 

Copyright (c) Marimer LLC