usercontrols

handling events of controls (ON USER CONTROL or WEB PART) added during runtime

I used to have some controls added dynamically through runtime on an ASP.NET webpage and was able to handle their events but now I put the code in a user control but it doesnt work. Any idea? while (drr.Read()) { LinkButton lnkbtnDownloadFile = new LinkButton(); //name of the file ---> drr[2] lnkbtnDownl...

UserControl preview does not gets updated when existing items are deleted in CollectionEditor.

Hi All, I am facing this problem with default CollectionEditor. When I add items to the collection editor, I display the items as a rectangle on the user control. But when I delete the items that were present already the preview does not gets updated untill i click on OK or Add button. I have provided the code for the same below. Ste...

Webforms UserControl does not place items in the expected order when items in CollectionEditor moved up/down.

Hi all, This is another problem i found with CollectionEditor. If the order of the items in the CollectionEditor is important, (say im drawing the items on the UserControl preview from left to right) then moving the item up/down in the CollectionEditor does not update the preview. This is because the up/down buttons only change the i...

WPF Load Control question

Hi. I'm doing some stuff in WPF. I have a ComboBox with many Types. After selecting a concrete type, I want to be able to Load a particular UserControl (with many TextBoxes etc.) respecting the type in a defined region on my WPF Window. How to do that? Is there anything like LoadControl() and load it into a PlaceHolder in ASP.NET? And ...

UserControl inheriting from another UserControl

I have a UserControl that provides some functionality (loads and displays a client's information) and I want to extend that UserControl. Some forms require the plain old UserControl while other forms will require some additional fields. How can I inherit from the existing UserControl, maintain the existing fields but add new fields on as...

UserControl cannot be displayed in Designer - null object reference

I have a created a UserControl with a combobox in it. This combobox is populated from a xml, when this is not present, it is loaded from resource file. It works fine in the program, but it can't be displayed in designer - it says: "Object reference not set to an instance of an object." In the class responsible for loading the list from ...

How to initialize a ASP.NET User Control With parameter?

For example, I have a user control(ascx) with a label inside, I will use the the user control in my aspx page. How can I pass a string value to the ascx page so that it can be display in the label of ascx page at the beginning? ...

Can a userControl event cause an update panel to refresh??

I have an aspx. <div id="headerRegion" class="borderDiv"> <xy:paymentHeader id="paymentHeader1" runat="server" /> </div> <div id="paymentRegion" class="borderDiv"> <asp:UpdatePanel ID="paymentFormUpdater" runat="server"> <ContentTemplate> <asp:PlaceHolder runat="server" ID="plcPaymentForm" /> </Cont...

Databound radiobutton list in WinForms

This seems like this should be a pretty standard winforms control. Basically a combination of the listbox and CheckedListBox.. except with radio buttons. Does anyone know of a control I can download or is there a way to do this using the listbox or CheckedListBox? ...

Pass an object into a UserControl in a repeater? .Net 1

I want to wrap up a chunk of HTML render logic in a User Control. Then I want to pass a custom product object (title, thumbnail, id, etc.) to the UserControl that it can use when it renders. Ideally I want to use this in a repeater (or for loop) and pass the current custom product object into the UC. Every example I've seen has been pas...

User control (ascx) and properties

The only way I've found to persist property values within a user control is to use the ViewState. public string Title { get { return Convert.ToString(ViewState["Title"]); } set { ViewState["Title"] = value; } } I can't say I'm real impressed with this though, as the more properties a user control has the more crap ...

How to add same behaviour to a usercontrol template as the gridview <Columns>

When defining the markup for an asp gridview and the tag Columns, one can only choose from a predefined set of controls to add within it (asp:BoundField, asp:ButtonField etc). Im curious about if i can add the same type of behavior, say restricting the content to a custom control with the properties "Text" and "ImageUrl" to a TemplateCon...

Add Event Handler to User Control from custom object

I have created a user control that will contain a table of LinkButtons (and other information). I create the table rows in another custom object and return a TableRowCollection with the link buttons in certain cells of these table rows. In the code behind for the user control I created an event handler for the button click of these Lin...

Winforms UserControl is not using the inheritance tree I have created. What am I doing wrong.

Hello, I am working on a wizard form framework that will allow me easily create wizard forms. I have a WizardForm form that has a panel on it. My plan is to dynamically load UserControls into this panel on the form. Each UserControl that is loaded onto the form panel must implement certain properties (allowNavigateNext, AllowNAvigat...

Unhandled Exceptions from Managed C# User Control used in MFC Dialog

Our core application is built in MFC C++, but we are trying to write new code in .NET, and have created a User Control in .NET, which will be used on an existing MFC Dialog. However, when a unexpected/unhandled exception is thrown from the User Control, it causes the MFC app to crash (illegal op style), with no ability to recover. I've...

How to make a UserControl with a custom DefaultBackColor?

When I right-click on my custom UserControl's BackColor property in the property-grid, then click Reset, I would like the BackColor property to change to (for example) Color.LightGreen, and the property value to appear un-bolded, to indicate that it is the default value. Currently, I know I can do this: public override void ResetBackCo...

How to achieve databinding with an user control in wpf?

Hi! I'm fairly new to WPF and I have some problems getting databinding to work as I want. I've written a user control which contains a TextBox whose Text-Property I want to bind to a property of my UserControl, which I want to bind again to something else. What am I missing? XAML <!-- User Control --> <TextBox Text="{Binding Path=The...

What makes this image display in my WPF usercontrol?

I've been trying to make a simple usercontrol to display an image, and eventually make it act as a button in my WPF application. I had one of these usercontrols written into the form's XAML, and the image always displayed. However, when adding them programmatically to a stackpanel, the control was there but the image never displayed. H...

ASP.NET User Control - Accessing the main Page object in AddedControl

How can I access the main page object in the AddedControl event of a user control? I am trying to run the line of code ScriptManager oSCM = ScriptManager.GetCurrent(this.Page); in that event, but it returns null, even if there is a scriptmanager on the parent page. In the OnInit event in the WUC that same line of code returns t...

How to add custom properties to a custom webcontrol

I want to add custom typed properties to a webcontrol, like for example EditRowStyle in GridView, but in a way that the property's properties can be declared in Source view in ascx/aspx. It's clear that GridView hasn't got a property like EditRowStyle-BackColor, but only EditRowStyle has. Something like this: public class MyCustomGrid :...