By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,725 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,725 IT Pros & Developers. It's quick & easy.

CompositeControl's children are interleaving with other controls on the page

P: n/a
Hello,

I've developed a CompositeControl in C# for ASP.NET 2.0. In this
control I am simulating Edit and View modes by hiding or showing
appropriate controls (setting Control.Visible). Basically I'm
simulating the functionality of the DetailsView or a GridView cell,
except that my data is dynamic (variable number of fields), so I can't
just use those. So I have custom edit and view controls for this
dynamic data and I render one of those two based on the current mode of
the control. I also render an "Edit" button in view mode and "Cancel"
and "Save" buttons in edit mode. As I said I just change the visibility
of controls appropriately, so I just render them all in the overrie of
RenderContents() like so:

this.ViewControl.RenderControl(writer);
this.EditorControl.RenderControl(writer);
writer.WriteBreak();
this.EditButton.RenderControl(writer);
this.SaveButton.RenderControl(writer);
this.CancelButton.RenderControl(writer);

This works fine in view-mode, but when edit-mode is entered, the Save
and Cancel buttons are rendered BEFORE the EditorControl, and after
those another control from the page I'm testing on also appears before
the EditorControl. So not only is it reversing the order of the edit
buttons and control, but it is interleaving the rendering of another
control from the page, in-between children from this control.
Otherwise, all of the individual child controls work and do what
they're supposed to, successfully editing my dynamic data, but the
rendering order is sure to confuse users.

Has anybody seen anything like this and/or have clues as to what may
fix it? Thanks.

Sep 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Ug, okay, so I should have looked into simpler aspects of this problem
before posting. The problem was just that I had neglected to close a
table row (</tr>) in the RenderContents method of the EditorControl.
I've been very busy so I had just abandoned the problem after that post
until today. So, moral of the story, don't neglect to check the HTML
(not just the code!) when layout or rendering is going bonkers...

shamefully yours
/S

es********@gmail.com wrote:
Hello,

I've developed a CompositeControl in C# for ASP.NET 2.0. In this
control I am simulating Edit and View modes by hiding or showing
appropriate controls (setting Control.Visible). Basically I'm
simulating the functionality of the DetailsView or a GridView cell,
except that my data is dynamic (variable number of fields), so I can't
just use those. So I have custom edit and view controls for this
dynamic data and I render one of those two based on the current mode of
the control. I also render an "Edit" button in view mode and "Cancel"
and "Save" buttons in edit mode. As I said I just change the visibility
of controls appropriately, so I just render them all in the overrie of
RenderContents() like so:

this.ViewControl.RenderControl(writer);
this.EditorControl.RenderControl(writer);
writer.WriteBreak();
this.EditButton.RenderControl(writer);
this.SaveButton.RenderControl(writer);
this.CancelButton.RenderControl(writer);

This works fine in view-mode, but when edit-mode is entered, the Save
and Cancel buttons are rendered BEFORE the EditorControl, and after
those another control from the page I'm testing on also appears before
the EditorControl. So not only is it reversing the order of the edit
buttons and control, but it is interleaving the rendering of another
control from the page, in-between children from this control.
Otherwise, all of the individual child controls work and do what
they're supposed to, successfully editing my dynamic data, but the
rendering order is sure to confuse users.

Has anybody seen anything like this and/or have clues as to what may
fix it? Thanks.
Sep 29 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.