usercontrols

parameter injection into dynamically created UserControls without specialization

What I would like to know is if there is a technique to inject parameters into the rendering HttpContext such that it would be available to the UserControl when its page life-cycle events (Page_Init, Page_Load) are called during rendering (during HttpContext.Current.Server.Execute())? Such a technique would allow injecting data into an...

WPF WindowsFormsHost sizing

I wanted to wrap a windows forms control in a wpf UserControl <UserControl x:Class="MVVMLibrary.ReportViewer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ws="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms" ...

Resizable table layout panel in c#

I find the table layout panel in c# (.net 2.0) to be very primitive. I wanted to allow my users to resize the columns in a table layout panel but there are no ready made options to do so. Is there a way atleast to find out whether the cursor is directly over any borders of a cell and if so, which cell is beneath it ?? May be having this ...

Using a BindingSource in a UserControl

I have a UserControl with multiple fields that I would like to have bound to a BindingSource. I would also like the UserControl to expose some BindingSource property so that it can be dropped on a Form and be bound to the BindingSource on the form. Is there an easy way to do this? I realize that I can rebind all of the controls of the...

Why does my form crash when I change my custom control?

I have created a custom control that is included in a control library that is referenced by a VB Forms application. When I modify the control, and have the application open in a VS window, VS usually asks me if I want to reload items that have changed. However, a couple of times, it has not asked me this, and when I go to open the form...

SliverLight AG_E_UNKOWN_ERROR UserControl Apps.xml Template

Ive created a simple usercontrol and even though the app runs ok applying the template to Im defining the Control Template here App.xaml <ControlTemplate x:Key="myWindowTemplate"> <Grid x:Name="myGrid" Background="Black" Width="50" Height="50"> <ContentPresenter Name="Content"></ContentPresenter> ...

Copy info from one dynamically created user control to another dynamically created user control

My ASP.NET WebForm has a place holder on it and user controls are dynamically added to it. The controls mostly have textboxes. Sometimes there are two user controls, sometimes there are ten. Everything is working as expected. My question is about how to implement a new feature. My customer has a new request to copy data from the fir...

Writing third-party controls for Office 2007 so properties are visible in Office Design View mode

I have a MS Word document in which are inserted a series of custom controls that maintain their own state and behaviors. I want the document designer to be able to set properties on these controls in design mode in Word (the designer doesn't have and shouldn't be required to have Visual Studio or be trusted with a compiler). When I use...

[ASP.NET] What are the differences between User Controls, Server Controls & Custom Controls?

I thought I had reasonable answers for this question at a recent interview, but I bombed it. :( What are the major differences between the three? If not obvious by the answer to the previous bullet, when would you choose one over the other? ...

asp.net usercontrol odd behaviour.

I have a usercontrol that I am trying to use in a project. If I do it like this (reference the sitemap in the control) <%@ Register TagPrefix="OS" Namespace="OS_Layouts" Assembly="OSControlLibrary, Version=0.0.0.0, Culture=neutral, PublicKeyToken=0831306e55dc1c27" %> <html><body> <OS:OSmenu runat="server" ID="men1" SiteMap="siteMapDat...

Designing WPF UserControl that gets its DataContext from outer controls: What is best practice to have some sample data in designer but use inherited DC at runtime?

Hi, I am designing a WPF user control which contains other user controls (imagine a WidgetContainer, containing different Widgets) - using M-V-VM architecture. During development, I have WidgetContainerView in a window, window (View) spawns a WidgetContainerViewModel as its resource, and in a parameterless constructor of WidgetContainer...

.net mvc ViewPage<T1> and ViewUserControl<T2> behaviour

I've got a viewpage with the inherits part looking like Inherits="System.Web.Mvc.ViewPage<User>" and a ViewUserControl with the inherits part looking like Inherits="System.Web.Mvc.ViewUserControl<Address> where User class (shortened) essentially looks like: class User { public virtual Address address { get; set; } } Now, if I t...

Asp.net error creating usercontrol from WebMethod

I'm referencing the article reference To create a UserControl dynamically and pass it back to a page via jQuery. When I just do a simple text in the UserControl "Hello World" everything works great... however, when I tried putting interactive controls on the control, I got the following message in my WebMethod (so the jQuery call stuff...

Let WPF UserControl delete itself and Data-Object which is bound to it?

Hello, I've placed in my MainWindow a StackPanel, which gets dynamically on runtime new UserControls (the UserControl is a row of TextBoxes and a button named "Delete"). This is about how I create the UserControls: PersonObject p = new PersonObject; List.Add(p); UserControlLine usrCtrlLine = new UserControlLine(); usrCtrlLine.DataCont...

Getting a User Control to fill its container

I've created a user control which contains a label and a progress bar. I've also created another user control which contains only a flow layout panel with the flow direction set to top down. When I add the former to the flow layout panel of the latter, I would like it to use the maximum amount of horizontal space available and the minimu...

WPF ItemsControl: Route TextChanged Event to all UserControl Items

Hello, I've placed in a ItemsControl Container (Template Stackpanel) my UserControls, which get dynamically added and removed while running the application. How can I route an Event (e.g. TextChanged or GotFocus) trough all elements in my UserControl (consists mainly of TextBoxes)? Is this where I should use "Delegates" or ICommand? I'm...

Interaction between two user controls

I'm on the verge of madness ... In the application I'm actually building, I'm dealing with two dynamically-added controls that need to interact with each other, but I've reduced the problem to an as-simple-as-I-can-make-it example with the controls being statically loaded, and it still presents the same problem: a NullReferenceException...

scriptmanager in masterpage and updatepanel in usercontrol. Partial postback not happening

hi, i have a master page with following scriptmanager tag: <asp:ScriptManager ID="scriptManger" EnablePartialRendering="true" runat="server" > <Scripts> <asp:ScriptReference Path="~/common/js/jquery-1.3.2.js" /> <asp:ScriptReference Path="~/common/js/validation.js" /> </Scripts> </asp:ScriptManager> My aspx page is : <%@ Pa...

What is the design reason for using a group box instead of a panel on a windows form?

So I am designing a control with a window s form. I want to group some controls together with a caption. So naturally I would go with a GroupBox. However is there some advantage in using a panel instead? Something not immediatly obvious to one who is still a little green with form design? How about some "gotchas" as well. ...

WPF handling RoutedEvent from UserControl

Hi, I have a UserControl, default one generated by VS, only TextBlock is added: <UserControl x:Class="MyNameSpace.Presentation.MyControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="myControl"> <Grid> <TextBlock x:Name="SomeTextBox" Text="So...