ASP.NET Custom Server Control not refreshing in designer - c#

I have a written an ASP.NET Custom Server Control, which I have working. This control inherits from CompositeControl and has different views that it can show during its life time. The best analogy would be similar to a Tab control where one control has many user selectable views depending on which tab the user selected. Before someone asks, no, mine is not a Tab control, it's an analogy that everyone should be familiar with.
Anyway, I want to have the view to be selectable in the Visual Studio 2010 designer. To do this, I created a CompositeControlDesigner with actions (just a single combobox to select the view). All of this works just fine, I have even stepped through the code in the debugger and verified that everything is firing off as expected including CreateChildControls back in the main control, but Visual Studio is NOT refreshing the screen. It only appears to refresh the designer if a tag is added/removed/modified on the control (which will not happen in this case since it is an designer-only feature)
Does anyone have a clue as to how to force the designer to refresh?

Related

Visual Studio: Typing code vs. drag and drop from the control menu

I tried creating a gridview by typing code using another block of code on a different page as an example. I found that, when I ran the program and clicked the Edit button on a row, the fields did not change into textboxes for editing. I did have code to handle the Row Editing event.
In an earlier project I found that I had to double-click the Row Editing event in the Properties window for a gridview to create the event handling code. Typing in that code in the separate aspx.cs file did not work.
I am working with ASP.Net / C#.
What is going on with Visual Studio when I do drag and drop from the control menu as opposed to just typing in code? I am assuming it is adding something that I am missing when I am just typing.
Does anyone else have other examples that didn't work when they typed code that I should watch out for?
Even if you did a mighty good job copying the HTML, you likely still missed a few properties. That's because the GridView component comes with a bunch of so-called Design-Time properties that can (only) be configured from the Properties panel in Visual Studio.
I think you'll find that dragging a control from the toolbox onto your web form will set the control's design-time properties to a specific set of default values. This does not happen when you type the HTML by hand.

Composite Control has design time error in Certain Pages

I have a solution in ASP.Net 2008 (C#) with:
- A Project with a Composite control (with some buttons and textboxes).
- Another project (application) just to test the control.
I started to test the control inside a page or webform. It had some design time errors
so when I dragged the control to the page it showed the "Error Rendering Control" in design time. I corrected the errors, rebuild the project with the control,
and the control appears fine in design time.
But I added another webform, I dragged the control on it, and the "Error Rendering Control"
appears again. I added another webforms and drag the control on them and that error appears too.
Any help would be appreciated.
Sorry, because I have a lot of code in my composite control, I didn't noticed that I had a .FindControl sentence inside my composite control. I put that senrtence just for testing, but I forgot to delete it from my code.
So the page when it worked fine had the control specified in FindControl, the other pages
had not.

I can't click on Telerik controls in my WinForms application in Visual Studio

I’m having an issue w/ a WinForms app I built several months ago. I opened it yesterday for the first time in a few months, and I’m unable to click on any of the controls in the form (in Designer view). If I double-click any of the controls on the page, it opens up code for the Load event of the form, as if I double-clicked the form itself; it’s as if the form is on top of all other controls maybe? All of the controls on the form are Telerik controls. I've been working on this project in VS 2010 since its inception. I also tried opening it in VS 2012 this morning, but that didn't help.
If I drag a new Telerik control to the form, it vanishes instantly, as if it’s buried under all of the other controls. If I drag a non-Telerik control to the form (such as a standard textbox), it appears fine, and that control will respond to clicks (ie – the Properties window will populate w/ properties for that control).
After I noticed this issue yesterday, I reluctantly upgraded my Telerik WinForms controls to Q3 this morning, but that hasn’t helped anything.
For now, I was able to bypass the Designer view altogether, and I made changes via the Designer code class. However, I’ll be in trouble if I ever need to actually add a new Telerik control to this form. Any help is appreciated.
This seems like a missing design time assembly. Please have a look at the following articles for explanation and suggestions how to handle this: link link

Retrieve Visibility Of Design Controls On The Win Form

I have design winform with various controls on it like textbox/ComboBox and Panels on some days ago but now if I am trying to run the forms the forms is visible but the controls which are designed on it is not visible. I don’t know what is the reason or some mistake made by me in past with it. But the reality is that I am unable to retrieve the controls on the forms.
Form11.cs (code design ) file is available as well as form11Designer.cs file is also there in well coded format.
Don’t know where is the mistake and how to retrieve all the controls which I have designed on it?
Have a look at this post: Winforms usercontrol phenomenon : suddenly all items are away!
In the Visual Studio form designer, open the "Properties" view. At the top of it, there will be a drop-down list box of all the controls on the form. You should be able to find and select your control from that box. When a control is selected from that list box, it is also 'selected' in the form designer itself, so should get the selection rectangle around it. Your control might just be hiding behind another control...

How to hide the inner controls of a UserControl in the Designer?

I have a UserControl that contains a DropDownList and an ObjectDataSource. That control is used in the markup of my MasterPage.
In the Designer of a ContentPage that uses that MasterPage I can see the DropDownList and the ObjectDataSource. See for yourself.
I know that other controls (like ComponentArt:Grid) only show themself as outer container and hide the inner controls.
I guess that is somehow achievable with attributes. Which ones do I have to set?
I'm guessing that the control you refer to, ComponentArt:Grid, have an associated ControlDesigner which can do about anything, including designtime editable areas and custom action menus (the menu associated with the arrow in the upper right corner).
However, Visual Studio does not [last time I tried] execute the control designer for UserControls, so you can not easily control this. There's a lot of magic happening in the background in the UserControlDesigner including parsing the html code. However, I've never seen actual compilation of the codebehind file, where the ControlDesigner attribute would be specified.
You will need to rewrite your control as a server control for Visual Studio to check for the attribute, and allowing your custom designtime view.
I'm not very familiar with WebForms but the BrowsableAttribute might be what you are looking for. Also look at the DesignTimeVisibleAttribute.
The System.ComponentModel namespace has a number of other attributes that may do what you need.
Visual studio doesn't support this. The moment you specify the word "user control", the thing goes beserk and renders everything you put on it.
Fortunately you can influence how server controls are rendered. In other words, you can cheat the Visual Studio designer by making use of that. The code you need can be found here: http://www.codeproject.com/Tips/773145/Hiding-contents-in-ASP-Net-user-control-designer

Categories

Resources