CompositeControl design time GUI creation - asp.net

I don't know if this is a right question, but i need to understand how it works.
I want to create CompositeControl with design time support, the GUI of the design time support is rendered CreateChildControls().
My question is: When i drop this control on aspx page, what is actually happening in the background for gui to appear on design view?
Does it executes CreateChildControls()?
Is it possible to debug the gui creation process?

The CreateChildControls will be called in design surface. You can debug your control simply.
Set your control's class library as a start up project.
Open the class library's properties panel.
Hit the Debug tab.
Select the Start external program and browse your visual studio location.
%VSPath%\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe
Put a break point on the CreateChildControls.
And press F5.
Create a new web project and Add your control to the Toolbox.
And Drop it onto the page.
Break point will be called.

Related

Visual Studio 2013 will not show design view

I'm having a problem with Visual Studio 2013, the latest build off MSDN.
When in an ASP.Net application I cannot see the design view. When I switch to design view all I see is the message Loading Master Page... in the upper left hand corner.
Anyone else see this issue or have a work around?
It looks like you have added some controls which has come constructor logic failing due to some dependency that is causing your form not to open in design mode.
Try move your control from Form designer & add the control in code editor in Form Load event .
Also try to debug your code.
I'm facing the same problem, it actually does display in designer but takes a lot more time like mine took approx 10 minutes. In my case I'm using 2 ListViews and a nested listviews with their datasources and nested master pages. So I think it makes sense to take time in loading the designer.
At the solution explorer, right click on the file and select open with then select -Web Forms Editor- you can set it as default if you want. To see the code, right click on the file and select -View Mark Up - I hope it helps.

Drag and drop controls at runtime in ASP.NET

We have requirement in our application to create template pages at run time. For this we need to have a feature like form designer in ASP.NET to be built. Facility to drag the controls from toolbox and drop in the form at runtime should be made available to the user. Solution should be in pure ASP.NET. Silverlight is not being used in the application. Please suggest a best way to achieve this requirement.
Enable draggable functionality on any DOM element. Move the draggable object by clicking on it with the mouse and dragging it anywhere within the viewport.
http://jqueryui.com/draggable/

visual studio express see events in asp.net source mode

Is it just me...
I would really like to be able to add/access the events for a control when in the source mode of the GUI, rather than having to switch to design mode.
I know that I can just type in the event, but I do like the convenience of being able to double click the box in the properties window and have the event handler created automatically for me. Plus then I can see all associated properties available for the control.
If there is a setting/option to always show events I have not found it yet, did the community find this toggle?
In .Net Web development, you can use on the page AutoEventWireup and adjust to true
This functionality associate delegate to event by reflection
Link : http://msdn.microsoft.com/fr-fr/library/system.web.configuration.pagessection.autoeventwireup(v=vs.80).aspx
Nota : you don't need associate event to your delegate

How can I get Visual Studio to auto-stub delegates to control events in ASP.NET?

So in a WinForm app, the Properties tab has an event button. It shows me all the possible events I can wire up to a delegate for the control that has focus. Then, all I have to do is double-click my event of choice and VS will auto-stub the delegate for me with the appropriate EventArgs type and everything. It'll then automagically take me to that delegate in the class.
How can I do the same thing in ASP.NET? For example, where can I click or double-click to have VS auto-stub in lifecycle Page events such as OnInit or OnUnload and then take me to the newly stubbed delegate? Surely this isn't always a manual process?
The Event tab in the property grid requires that Design View be up to date (synchronized) to work. For this to happen, you either need to be in design view, or have just left it without making changes to the document (or be in split view, so you can refresh the designer easily at will).
See also: Events tab randomly appears and disappears in VS 2008
Adding information from the comments:
Currently (VS2010), the only stubbing support for event handler generation using WebForms is for server control events. There isn't any tooling out-of-the-box to create event handlers for the Page itself (e.g. OnInit, OnUnload) if you're using code-behind files. However, if you are using single file webforms (i.e. no code behind) you can generate these via the Navigation Bar (disabled by default in VS2010, but enabled in previous versions).
Just select the element, go to event tab in property grid. Then double click the event you want.
Also make sure you are using "runat=server" and ASP.NET WebControls. In other words, not HTML controls.
As an addendum to the question: Please see Jimmy's comments above. Looks like everything else works fine but there's no method of auto-wiring up Page-type-specific events.

How do I build a popup dialog in asp.net

I am building a Web Application using asp.net (C#). I come from windows forms development and find myself in a hard spot. Im making an application where the user should edit some simple information about himself, and thus i need to create a new dialog. How do I do that in asp.net? I have a button which event is handled serverside, and when i click lthis button i want to popup a dialog where i can show my custom web control (or any web control, lets make it generic from the start). How do I go about with doing so?
I got some part of the way by looking at the internet, that i need to make a section and set the z-index to 1000, but how do i make it visible (block)? Please help here as i am completely lost...
/H4mm3rHead
If you're not concerned about using a library, try Microsoft ASP.NET AJAX Control Toolkit, they have several controls that can create something you want (the ModalPopup control).
The AJAX Control Toolkit has a ConfirmButton extender which will do exactly what you are looking for.
I used to do the following:
1. my new pop up is just a new aspx page like any other page
2. add a button (or just a link) that fires a client side java script function
3. in the function I use window.open and put params to open my popup page with no toolbars or scrollbars and proper size to its content
check this for more info on #3

Resources