usercontrols

Custom UserControl Property used by child element

I'm trying to get some WPF concepts down, so I've put together a simple example of what I'm trying to do. I would like to set a custom property of a user control, and have it be used by an element within the control. I've been researching and experimenting, but I'm not fully understanding everything here. Any help would be appreciated. ...

Web User Controls and Validation

Hi, I have an ASP.Net web user control that contains a TextBox and a calendar from the Ajax Control Toolkit. When I include this user control on my page I would like it to participate in input validation (there is a required filed validator set on the TextBox inside the UC), ie. when the page is validated the content of the UC should a...

UserControl causing loss of textbox content in Gridview header

All, My problem is that my gridview header that contains textboxes etc. that users can type into is somehow losing the content of those textboxes when the user forces a postback - but only if I have a user control in the header. This is using .NET 2.0. I've created a basic gridview that binds to a generic list datasource. I've added a ...

Usercontrols which don't trigger events for visitors

Hello! This UpdatePanel is contained by an UserControl. When the LinkButton is pressed arow should be added in another GridView. When an user is logged in this control is working well. The problems appears when an user is not logged in and try to push that button. No event triggers. Someone suggested me to give a permission for accessin...

Call function in User Control from code behind of the page

Now this is all way simplified, but here goes: I have a User Control that consists only of a single *.ascx file. The control has no code-behind: it's just a script with a few functions, like this: <%@ Control Language="VB" EnableViewState="False" ClassName="MyControlType" %> <script runat="server"> Public Function MyFunction() As ...

WPF Template Binding in ToggleButton UserControl

I'm developing a basic dip-switch user control as a personal learning exercise. Originally I had it set up where you could declare some custom color properties on the user control, and they would be used on elements inside the control. However, I recenly discovered ToggleButtons, and rebuilt my control to take advantage of them. Since t...

Building an OCX with VS.NET?

What happened to OCX's? Are they no longer possible to create with the latest tools? I need to create an ActiveX control that I can place in Word, PowerPoint and Excel documents. If I use VS.NET, I can only create a UserControl DLL with COM Interop, but I don't think I can add that using the "More Controls" toolbox of PowerPoint's Devel...

Passing Values between Web User Controls

Hi, I've several web user controls on my asp.net page and I wanna pass values between them. For example : There is a dropDownList in one of them and when user selects any item from dropDownList, it can pass the selected value to the other user control which includes GridView to show related data of selected item value from the user con...

WPF How to get a UserControl to inherit a Button?

I created a UserControl which consists of a couple ellipses and labels. I added it just fine to another form and things were looking pretty snazzy. Then I went to start adding some event handlers and discovered that the control I made did not expose a Click event. Oops. Easy to fix, right? Just go back to the code-behind on the User...

Events in UserControl

Hi all, I am new to UserControls, and while developing my own control I found a problem with showing events of my control in the property grid at design time. If I have some events in my control I want to see them in Property grid and if I double-click that I want to have a handler, in the same way Microsoft does for its controls. ...

C# UserControl Inheritance

Working with VS.NET 2008, output type Class Library, Target Framework .NET 2.0 I've come up with a simplified scenario to ask this question. I have a Button user control, its a simple panel with a single big button on it. I want to create a RedButton control that extends Button, and similarly, a GreenButton.e.g. Class RedButton : Butt...

Adding event handlers by using reflection

I am adding dynamically controls to page by using LoadControl and Controls.Add. I need somehow to wrap Init and Load event handlers of this loaded controls into my code. So it should be such order of events SomeMyCode() -> Control.Init() -> AnotherMyCode() and the same for Load SomeMyCode() -> Control.Load() -> AnotherMyCode(). My idea w...

Setting the parent of a usercontrol prevents it from being transparent

I've created a simple user control which is manually created with something like MyUserControl ctrl = new MyUserControl(); The control have been designed to have BackColor = Color.Transparent and that works fine, until I set the Parent of the control to a form at which time it turns into the color of the form. Might sound like its tr...

Dynamically add a usercontrol in VB.net

I have made a custom UserControl i Vb.net (windows application). How can I add this dynamically to a form? ...

ASP.NET : Possible to create a UserControl that include inside markup content?

Hi, I'm trying to achieve something google isn't able to give answer. I'm trying to create an asp.net usercontrol that when I put content into it's open close tag will include it for me to be still able to acess it's content by ID from the Parent. Here is an exemple of what I want to achieve. Usercontrol: <%@ Control Language="C#" Aut...

How do I hook the TAB key in a usercontrol so that focus doesn't move to a different control?

I have a usercontrol that is meant to take up the entire form. I want my usercontrol to handle the TAB key press and do something rather than have the TAB move focus to another control on the form. I'm handling the KeyDown event in my usercontrol, but it doesn't fire when the TAB key is pressed. ...

One blog for each Django user with the "blog role"

Hi, What approach is the best way to make content-types restricted to a user in Django, lets say that i want all users with the user-role "blogger" to have its own blog. Ive createt a weblog app, but how do i restrict it so that the user logged inn can only post in his "own" blog, and how do I make views that shows only a users blog? ...

What should the converter parameter be for this binding

I am trying to implement a wpf user control that binds a text box to a list of doubles using a converter. How can i set the instance of user control to be the converter parameter? the code for the control is shown below Thanks <UserControl x:Class="BaySizeControl.BaySizeTextBox" xmlns="http://schemas.microsoft.com/winfx/2006/xam...

How to access a user control in a masterpage from a content page?

Lets say that I have a header user control in a master page, and want to change a property of the user control depending on what content page is loaded inside of the master page. How might I go about this? Thanks! ...

Load User Control dynamically and Default Namespace

In Silverlight, when you want to create a control dynamically, you must add the namespaces like this (as in http://msdn.microsoft.com/en-us/library/cc189044(VS.95).aspx): XNamespace xmlns = "http://schemas.microsoft.com/client/2007"; XElement textBlock2 = new XElement(xmlns + "TextBlock", new XAttribute(XNamespace.Xmlns + "x...