[SOLVED] Detail view fields show up empty at first view

Answered Closed
0
0

Hi,

I have a Tabcontrol with several tabs, each tab containing a detail view of several fields of a single table. Imagine something like a Customer. In the first tab his personal details, second tab address/contact details, 3rd tab orders (master-detail view) etc. The way it used to work in VWG was to pass the customer id to the container tabcontrol and then this id was passed to each of the tabs, which then passed this id to the detail views in them. Each then called the database and filled the form.

The detail views on the tabs are not created until the first time their tab is clicked. At that point the detail view is created dynamically, added on the form and then the customer id is passed to the detail view so that it can be filled. In consequent tab changes the detail view is not created anymore, it is just filled.

This mechanism worked in VWG.

The problem now is that the detail view of the tab is empty the first time it becomes visible. When I say empty, I mean that the detail view controls have been created and show up, however they do not have values. When first my tab control shows up, the first tab has the controls on it (empty). When I switch to the second tab, I see the empty controls of the second tab. When I switch back to tab 1, it is now filled. When I switch to tab 2 it is filled. Switch to tab 3 with master detail, the grid containing the orders is filled, but the details of the first order are empty….

Any idea what could be wrong? Could this all be related to the discussion about binding in another thread? Is there some refresh that is triggered by the tab switching and should be called programmatically?

Best regards
Alex

 

  • You must to post comments
Best Answer
0
0

Update: this issue has been fixed. It’s WJ-7329 and will be in the next update.

  • You must to post comments
0
0

I contacted you directly.

  • You must to post comments
0
0

Hi Luca,

It would be good to solve it, so what is the webex session?

Alex

  • You must to post comments
0
0

Hi Alex,

I tried with up to two nested UserControl containers added to your test but cannot reproduce.

UserControl uc = new UserControl() {
    Size = new Size(300, 300),
    BorderStyle = BorderStyle.Solid
 };
 UserControl uc2 = new UserControl()
 {
    Size = new Size(300, 300),
    BorderStyle = BorderStyle.Solid
 };
 uc.Controls.Add(tabPages);
 uc2.Controls.Add(uc);
 sc.Panel2.Controls.Add(uc2);

I also tried to put the tabtxtID in a UserControl in a tab page in a TabControl in a UC in another UC in the SplitPanel in the SplitContainer… 🙂

The initial state is correct, only toplevel containers start with Visible=false. When they transition to visible the first time you get the creation, OnLoad, etc. If you create a standalone non-toplevel control it’s created when you call Show() or when it is added to a visible or created container.

Make sure that the Wisej.Web assembly is updated and that the project is not using a cache previous build. I’m also available to setup a remote webex session, if you are available please let me know directly.

Best,

Luca

  • You must to post comments
0
0

Hi Alex,

I tried with up to two nested UserControl containers added to your test but cannot reproduce.

UserControl uc = new UserControl() {
    Size = new Size(300, 300),
    BorderStyle = BorderStyle.Solid
 };
 UserControl uc2 = new UserControl()
 {
    Size = new Size(300, 300),
    BorderStyle = BorderStyle.Solid
 };
 uc.Controls.Add(tabPages);
 uc2.Controls.Add(uc);
 sc.Panel2.Controls.Add(uc2);

I also tried to put the tabtxtID in a UserControl in a tab page in a TabControl in a UC in another UC in the SplitPanel in the SplitContainer… 🙂

The initial state is correct, only toplevel containers start with Visible=false. When they transition to visible the first time you get the creation, OnLoad, etc. If you create a standalone non-toplevel control it’s created when you call Show() or when it is added to a visible or created container.

Make sure that the Wisej.Web assembly is updated and that the project is not using a cache previous build. I’m also available to setup a remote webex session, if you are available please let me know directly.

Best,

Luca

  • You must to post comments
0
0

Hi guys,

Well, unfortunately the problem is exactly as it was in my main project! 🙁 The toy project I sent you works indeed, but not my main project.

Since there I have a more complex structure of containers, all contained in a top Page, search whether this wrong initial state you discovered is correctly transferred to other container objects. I would suggest the UserControl, since I wrap my components in UserControls.

Sorry for that,
Alex

 

  • You must to post comments
0
0

No you always need it or it won’t compile.

  • You must to post comments
0
0

Frank, i will test tomorrow (already late in Greece!) and let you know.

Luca, to make it absolutely clear, if I’m not using the designer but create my controls at runtime, does this mean I do not need even the assembly reference?

Alex

  • You must to post comments
0
0

Hi Alex,

If you mean the assembly reference, we can’t remove it since we use the full winforms designer system in Visual Studio (and SharpDevelop), it’s a large beast and instead of writing a crippled one it was much better to reuse what works very well. Wisej controls create a window control when in design mode, that’s how we are able to paint pixel-perfect design surfaces.

Best,

Luca

  • You must to post comments
0
0

Hi Alex,

thanks again for your valuable input and test case.

We have just uploaded a new beta build #1.2.9 that resolves the binding issues.

Can you please retest and provide us feedback ?

Best regards
Frank

  • You must to post comments
0
0

So it was kind of lucky I’m using pages and not forms! 🙂 So, the tabcontrol (tabpages) follow the initial state of their top container, a page in this case. Thanks for your fast response and I appreciate the update!

The Wise.Data is the least problem! The main thing is to remove the System.Windows.Forms dependency. The rest is easy.

Thanks again,
Alex

  • You must to post comments
0
0

Hi Alex,

 

To keep you updated, the binding issue you have reported has been fixed. It was caused by the Page starting at creation with the visible state to true so there was no transition the first time it’s shown. That’s why the tab pages updated the binding after they were hidden/showns. Wisej.Web.Form instead has the right initial state. The same issue was fixed for Wisej.Web.Desktop: the three top level containers.

I can run your sample perfectly now.

The other issue with the namespace is also fixed. Now every reference and every data binding class is under Wisej.Data. The only problem when porting from WinForms is that you can’t replace System.Windows.Forms with Wisej.Web for the data binding classes but you need to change it to Wisej.Data. That’s because Wisej.Data is in Wisej.Core.dll which is shared with the Wisej.Mobile controls.

Frank will update the beta build and the issues list shortly.

Best,

Luca

  • You must to post comments
0
0

Hi,

If I may make another observation… as I was trying to find out what could be wrong with the binding, I discovered that in my VWG-converted code the Bindingsource object I had defined wasn’t very clear if they were Windows.Forms.BindingSource or Wisej.Data.Bindingsource. You need to find a way to get rid of the Windows.Forms namespace dependencies.

Best regards,

Alex

  • You must to post comments
0
0

Fantastic. Thank you! We should be able to iron out all binding issue within this week.

  • You must to post comments
0
0

Luca,

I’m attaching a test project. A page containing a splittcontainer with two textboxes in Panel1 and a TabControl in Panel2. Two tabpages, each with a textbox. All textboxes bound to properties of a simple customer object. When loaded, the two textboxes of Panel1 remain empty. Also empty is the textbox in the visible tab1. If you switch to tab2, you will wee the textbox there filled. By switching back to tab1 you will see the textbox filled too. The textboxes in Panel1 never get filled.

The strangest of all is that if I do the same with a form instead of a Page, the textboxes are filled from the beginning.

HTH,

Alex

Attachment
  • You must to post comments
0
0

Luca, they are databound. And the event I’m using is the tabcontrol.selectedtabchanged which I have seen it fires. The workflow is followed the same way it was followed in VWG from what I’ve seen from debugging. I’ll see what I can do with a test case.

Alex

  • You must to post comments
0
0

Are the controls data bound or filled by code? If filled by code, which event do you use to fill the controls in the tab?

Would it be possible to send a tiny test case with a tab control, a couple of tabs and a control in each using the same approach that is not working?

  • You must to post comments
Showing 17 results