usercontrols

add one xaml based usercontrol to another on mouse event

I have three xaml files + their code behind files in my Silverlight (C#) web project. One is the MainPage.xaml, which is what gets rendered in the browser. The other two (lets call them Dot and Box) are custom usercontrols. When the webpage loads, Dots get added to random locations in a sub-canvas in MainPage xml. I would like to add...

Programatically add UserControl with events

Hi everybody I need to add multiple user controls to a panel for further editing of the contained data. My user control contains some panels, dropdown lists and input elements, which are populated in the user control's Page_Load event. protected void Page_Load(object sender, EventArgs e) { // populate comparer ddl from enum string[...

How can I refresh a custom wpf user control from code behind?

I have this custom wpf user control: ShowCustomer.xaml: <UserControl x:Class="TestControlUpdate2343.Controls.ShowCustomer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Grid> <TextBlock Text="{Binding Message}"/> </Grid> </UserContro...

ASP.NET: User control with dependent attributes

I'm writing a user control with two attributes, A and B. I want the programmer using this control to be warned when defining a value for attribute A but not for B. Can I accomplish this somehow? ...

Replace a string with a user control

How can I replace a string with UserControl? if string = [$control1$] replace with control1.ascx ...

Start and End Divs Using Two Controls - Aps.net mvc

In an Asp.net MVC application I'd like to encapsulate the ugly wrapper code (just a literal html opening string and another closing string) we use to make corners and shadows compatible with older browsers (we don't use javascript for performance reasons) in a manner compatible with the visual studio design view. I'd like to put the w...

how to load usercontrols from the assembly using the filename?

we have a set of usercontrols complied to a dll. we could just load the controls using their classnames by like ASP.theusercontrol_ascx blah = new ASP.theusercontrol_ascx(); but if we have dynamic data and load the controls based on the filename (or the control name), how can we load them like Page.LoadControl("TheURL/theusercontrol.asc...

ASP.NET User Control inner content

Hey, I have a user control which accepts a title attribute. I would also like that input inner HTML (ASP Controls also) inside of that user control tag like so: <uc:customPanel title="My panel"> <h1>Here we can add whatever HTML or ASP controls we would like.</h1> <asp:TextBox></asp:TextBox> </uc:customPanel> How can I achi...

Maximum number of entries in a ListBox

What is the maximum number of entries a simple ListBox (ComboBox) should contain? There are fifty states in the US - is 50 too many? There are over 270 countries and territories in the world - is 270 too many? When should a ListBox include search or type-ahead capabilities? When should the designer consider something other than a L...

C# typed <T> usercontrol in design mode gives error

I've got a custom class, which derives from UserControl. The code: public partial class Gallery<T> : UserControl where T : class, IElement, new() This classworks like it's supposed to work. But, when I try to enter design mode of the form which contains these Gallery classes, it gives me errors: Could not find type 'PresentrBu...

Relative paths issues for ImageButton / LinkButton

Hi I have recently migrated from .Net 1.1 to 3.5, and none of my ImageButton's or LinkButton's work. Not only do they not show the image, but when pressed, they redirect back to the root of the site; and the 'onClick' EventHandler doesn't fire. E.g. If I click an ImageButton on the page: http...../MyWebsite.ecom/Project1/frontend/...

Asp.Net: Passing value from Page to UserControl

Hi all, I have a textbox on my aspx page and I need a usercontrol to be able to see or access that value, how would I do that please. I created a public property on my aspx page public string txtBoolValue { get { return this.txtBool.Text;} } How do I call that from my ascx page? Thanks Melt ...

C# exclude complete form / usercontrol by using compiler constants

I'd like to exclude / include a complete form in my project. But when I add the needed #if CONST and #endif the compiler complains about resources that may get wrong names. warning MSB3042: A namespace or class definition was found within a conditional compilation directive in the file "Form1.cs". This may lead to an incorrect choice...

When to use UserControl vs. Control in Silverlight?

I'm just getting my feet wet in Silverlight, and don't really understand the differences and pros/cons of creating a UserControl vs. creating a Control for the same task (as in when you right click on a selection in Expression Blend, for instance). It seems like selecting "Make Into Control" just creates a new template for the base type...

Add user control in Visual C++ 2008 Express

I can't seem to add a user control from an existing solution I've created in visual C++ 2008 Express. I don't see the option located anywhere. Perhaps I'm looking in the wrong area or it's just not available in the express edition. I've followed the advice described here: http://msdn.microsoft.com/en-us/library/114xc3e5%28VS.80%29.aspx ...

Usercontrols asp.net textbox/validator controls

Hi all, I want to combine a textbox and several validator controls into 1 usercontrol. Is this possible with the intent to keep some fields dynamic like textbox:cssclass textbox:id textbox:width I'm asking this because i find myself putting a lot of validator controls for every (same textbox type) field in my form and it's getting kin...

Asp.Net: Problem setting property value in UserControl

Hi all, I have a UserControl called 'Inspirations' with the following public property private int pagenumber; public int PageNumber { get { return pagenumber; } set { pagenumber = value; } } On my aspx page I set the value of the property like so: Inspirations.PageNumber = (int)Convert.ToInt32(this.txtNum.Text); On my as...

Design-time moving of a child control owned by a composite user control

Hi, I have a Windows Forms user control, which (for various reasons irrelevant to this issue) are exposed in the designer, much like the panels in a split panel. Most everything works nicely, except for dragging the control. The child controls are created by the user control, and it does not accept new children. The intent is only to al...

Asp.Net: Dynamically switching UserControl - How?

Hi all, In Asp.Net is it possible to dynamically switch which user control gets loaded with the .aspx page. Depending on the type of news story I would like to switch which control gets loaded. Thanks melt ...

Handling user abuse in rails

I've been working on a web app that could be prone to user abuse, especially spam comments/accounts. I know that RECAPTCHA will take care of bots as far as fake users are concerned, but it won't do anything for those users who create an account and somehow put their spam comments on autopilot (like I've seen on twitter countless times). ...