usercontrols

User Control on a WebPart, PostBack / ViewState Problem

Hi, I'm using a Sharepoint WebPart to load a UserControl which has a button that does some processing on PostBack. I got a problem: when I click the button for the first time, the data loaded on ! IsPosback gets lost, but this does not occur when I click the button again. I think my problem is explained here: Sharepoint Lifecycle, but I...

Providing external dependencies to a WPF Custom UserControl

Hello: I'm attempting to create a simple WPF UserControl beginning with the default constructor. public partial class MyControl : UserControl { InitializeComponent(); } Now MyControlwill require access to my database and that connection is initialized and managed externally. What is the best way to provide an external dependent res...

Can't access master page from user control

My master page code looks something like this: namespace Recipes { public partial class MasterPage : System.Web.UI.MasterPage { ... public void UpdateUserLogin() { NicknameLbl.Text = ((Recipes.BasePage)Page).CurrentUser.Nickname; } ... } } I want to call the UpdateUserL...

Multiple instances of user control with a canvas causes exception in Silverlight

I have a user control that has a grid (the one you get automatically when you create a user control) and a canvas within that. <Grid x:Name="LayoutRoot" Background="White"> <Canvas x:Name="SurfaceCanvas"> </Canvas> </Grid> In the CS file, I've defined an "Items" collection. public ObservableCollection<TestItem> Items { ge...

Fancybox event is not fired

i have my login in a fancybox and fancybox div is in a controller. problem is if click the button nothing happens event isnt fired. this is my controller.ascx <div id="inline1" style="width:400px;"> <ul class="forms"> <li class="inputfield"><asp:TextBox ID="kullanıcı_adi" runat="server"></asp:TextBox></li> </ul> <ul> <li><asp:T...

Adding a user control "The Enumerator is not valid"

I'm using Visual Studio 2010 to create a small WPF application. I've created a user control that I am now trying to add to my main form. The user control does show up in toolbox but every time I try to drag the control to the form I get the error: The enumerator is not valid because the collection changed. I should know what's wrong ...

Now getting how to create a user control for this kind of display with databinding as well

How to create a user control for this kind of layout. I have a css. But dont know how to create a control for this kind of display. Title is the department name and below mentioned radio buttons are status for each department. Now department can be multiple as present in database. This one box can contain only two department list and ne...

Repeater in my user control is empty on postback

I've looked at a lot of similar questions here, but to no avail. So here goes... I'm creating a set of user controls that display a list of grid-like tables. Anyway, the objective is to list the grids, mess with the each grids data (client-side) and press save. The grids work great, but when I press save teh repeater in the VIEWER is...

Handle Click Event for LinkButton in User Control from Parent ASP.NET page

I have a LinkButton within a User Control and it has handled with: Private Sub LoginLinkLinkButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LoginLinkLinkButton.Click Response.Redirect("/", True) End Sub On certain ASPX pages I would like to handle the click from the page's code behind, opposed to with...

Binding Dependency Properties

so here i come creating a user control. it consists of a treeview dropping down from a combobox. actually there is a button with a control (DropTree) dropping down from it's contextmenu. so i have an control DropTree public partial class DropTree : UserControl { public TreeView TreeView { get{return treeView;} } public Dr...

How to dynamically add user controls within a user control.

I want to create a user control that will again contain a user control that will be dynamically generated and can be repeated N times with respect to data present in data table. How can i do this. ...

cloning tabpage with user control inside of it?

There is a form with a tab control, which has a tab page element. This application is designed in such a way that it is if you drag and drop a chart control (which are listed as icons in a sidebar) the chart gets populated with data, and shows a graph. We have a button which should make a clone of that tabpage and show itself in another...

Font color on hover for list items in a combobox

I have a combobox that has custom drawn items. It also makes use of zebra striping and because of this, the hover color is sometimes off. How can I control how it looks on hover? Here's the code I use: Color zeros = Color.FromArgb(200, 200, 200); Color ones = Color.FromArgb(225, 225, 255); private void innerBox_DrawItem(obje...

Why doesn't the Validation.Error event get fired in this case?

I have copied an example from MSDN and added the Validation.Error event. Problem is, it never gets fired. Why not? <UserControl x:Class="MeasurementControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxm...

WPF UserControl Memory leak

Hi I have a UserControl in an application where I am constantly swapping the Content property with other UIElements. However I noticed in Task Manage after a while the memory goes up after a number of swaps... Using AntProfiler I noticed for some reason there ToolBarAutomationPeer that the UserControl references.... To fix this Memo...

Reusing expensive UserControls

So we have this legacy code that displays data in a tree format. They pad each node of the tree using spacer images (...yup..ugh) Unfortunately, the use of these images is controlled by an in-house UserControl that we're forced to use (basically just derives from Web.UI.WebControls.Image, though). Well, turns out we have a HUGE tree wi...

Exposing events of underlying control

I have a combobox in a custom control. How can I expose specific events from it such as SelectedIndexChanged or KeyPress, etc to anyone/thing implementing my custom control? ...

asp.net usercontrol SetFocusOnError

I have a aspx page that several of the same usercontrols on the page. The usercontrol houses a textbox that has a Required field validator on it. The validator works but the setonfocus="true" does not seem to be working, further more, the button the aspx page when the validator shows the error message, the button still fires the code b...

Edit Validation.ErrorTemplate in code

I have a UserControl that contains a TextBox. The TextBox.Text property is data-bound and validated. When a Validation.Error occurs, I would like to edit the Validation.ErrorTemplate. Specifically, I would like adorn it with a Polyline. The end goal is to have a UserControl that has a red squiggly line under the text when it fails a va...

Maintaining visibility settings through persistence in dynamically created controls

I have a somewhat complex custom user control, created in C# .NET, which is essentially a tree structure. The control , ctlGroup, contains a list of fields (which are also custom user controls - ctlFields) and a list of child groups. The datalist containing the child groups creates new instances of the same ctlGroup control, because each...