Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
725
Layout problem
posted

Hi,

I have an issue with a layout : i attached an example 

Load my exampe and click Go Button. after that clic the save Button to save the current layout.

Go in the source code and remove the commentted lines : 

  1. in the Get employees() function    // lstEmpl.Add(new Employee() { ID = 3, EmplName = "Gareth Bale", TypeID = 4 });

 2. in the GetTypes() function      //lstEmpl.Add(new eType() { ID = 4, name = "Nice" });

reExecute the program  clic on the Go button and click the  load button to load the saved layout.....

look at the third row at the TypeID column you will saw the number 4 instead of the Nice  string .

I can't find what happen with this. i have to see the type name of type not the ID..

 can you help me to resolve this.

thx

WindowsFormsApplication1.rar
  • 469350
    Offline posted

    Hi,

    When you save the layout, it includes the ValueList. So when you load the app the second time, with the new data, you are populating the ValueList and connecting it to the column. Then you load the layout and it loads the ValueList from the layout, which only includes 3 items instead of 4.

    So if you are going to need to change the data in the list, you will have to re-populate the ValueList after you load the layout. Another option might be to bind the Layout to a DataSource, instead of populating it manually. If you do that, the data will not be included in the layout, and thus when you load the layout, the data source will still have all of the correct items.