usercontrols

Dynamically load user control

I have this GridView that have it's DataSource as a list of previously selected products. For every item on it, I need to Eval it's ID and load a specifc form that the user must fill, then after that i've got to update the GridView. I have made those specific forms as User Controls, is this the best approach for this scenario? If yes, ...

What is Custom Control and User Defined Control?

hi everyone,Can any explain me what is Custom Control and UserControl?The Main difference between them.Suggest me some basic examples links. Thanks in advance ...

error when adding a control to a user control

I'm trying to add a control in within a user control: LinkButton l = new LinkButton(); l.Text = "Test"; l.OnClientClick = "TestClick"; l.ID = "TestID"; l.Page = Page; Page.Controls.Add(l); I get this error when the page loads: An unhandled exception was generated during the execution...

ASP.NET MVC displaying user name from a Profile

The following is the LogOn user control from a standard default ASP.NET MVC project created by Visual Studio (LogOnUserControl.ascx): <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% if (Request.IsAuthenticated) { %> Welcome <b><%: Page.User.Identity.Name %></b>! [ <%: Html.ActionLink("Log Off", "LogOff", "Accou...

How to set an event for "Enter" pressed while cursor is inside a textbox within usercontrol.

Hi, I have a usercontrol which is used for searching. There is a textbox and a search button. When the button is clicked the search method is called. I want the search also to occur when the cursor is inside the textbox and the enter key is pressed. My first thought on how to do this was maybe to add the event to submit action of the fo...

How to handle dynamic user control events in aspx page.

Hi, I have an aspx webpage in which an user control is added dynamically as follows: UserControl testUsrControl = LoadControl("TestUsrControl") as UserControl; testUsrControl.ID ="test"; Then I tried adding an event handler of user control inside aspx like below: testUsrControl.Drpdatafield_SelectIndexChanged += new EventHandler(this...

How to call the event of usercontrol in page of aspx.

I have created the usercontrol. There is event : public event System.EventHandler MemberSelectionChanged; I have called this event in aspx page like this(given below). It working fine. Is there any other way to call the user control event in aspx page. this.ucMemberList.MemberSelectionChanged += new EventHandler(MemberList_MemberSe...

WPF - Doesn't find all usercontrols in other assembly in XAML

I have this other assembly which has a folder with 10 UserControls and I reference the assembly in XAML so I can use them. xmlns:usercontrols="clr-namespace:Company.Project.OtherAssembly.UserControls;assembly=Company.Project.OtherAssembly" However, when I try to use the UserControls with <usercontrols:someUserControl /> it only finds ...

WPF Play MediaElement in UserControl using only XAML

Hi, I have this UserControl: <UserControl x:Class="Jugues.contacteButton" x:Name="contacteButtonControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" ...

User control not retaining property values

I have a very simple user control with 5 radio buttons on it, and 3 properties (ID, RatingSetID, and Rating). On the initial load of the page they are on, the code acquires data and places the data into the 3 properties. However, when the submit button is clicked the page reloads and the 3 properties get reset to 0, they are in the !IsPo...

Controls in a WPF UserControl don`t raise lost focus

Hello, I have a MainWindow with 3 main buttons at the top and below a MainUserControl. In the MainUserControl I have at top 3 UserControls with ButtonBars and at the bottom a DataGrid. When I enter data in a DataGridCell and I click into another cell a property change is fired in my ViewModel bound to the DataGrid. When I enter data...

WPF Changing text in a controltemplate at run time

I am making a template control so that I can have a button with an image that changes when you click it. I also am trying to get text on top of the button that can change at run time. I have the button images and everything working but I can't seem to get that label at runtime so I can change the text. Here is the code in the xaml. I...

C#, UserControls: I cannot alter txtBlock.Text, it gives an "object reference is required for the non-static method" error!

I was recently having some issues with a bigger project, but in an effort to solve the problem, I made a new solution with just two incredibly basic files. It is a WPF C# project with the main window containing a button, and a usercontrol containing a textblock. I already have them linked in Blend so that when I click the button, the use...

Command Binding not working when the host control is added programatically in wpf

This is weird. I have a UserControl (MyControl) with a button inside. I have added a command to this button whose command target is another user control which is again added to the same window. When I add the UserControl statically in xaml to the CustomControl's host space, the CommandBinding system works fine, where as the same doesn't...

Can I have multiple instances of the same UserControl in 1 app?

I am creating a Text Editor Type app. I can have multiple editors open via tabs. In my first try, I used simple TextBoxes to edit text. Everything worked ok. Then I created a UserControl encapsulating the text box + buttons to perform text manipulation eg. bold/italic etc. I found out that when I open different tabs, they all contain the...

How to slide(push) controls down/up in a View?

Hello folks! I have a button which when pressed, should push the controls below it down and show textFields on the space freed. Basically, just changing the position of these controls in an animated way. Any ideas/tips on how to do that? I tried the code in: How to Make a UITextField Move Up When Keyboard Is Present But couldn't get i...

How To Use Reflection To Find UserControls On A Page In A Nested MasterPage

I have a CommonMaster page that then contains a ConfigurableReportsMaster page. I then have an AutitLog.aspx page. Now, on that .aspx page I have multiple UserControls. Some of these UserControls are inheriting from an ISQLFilter interface, but not all. While on the .aspx, in a RunReport event (that currently successfully fires) I ...

asp.net repeater with usercontrol - setting commandargument

Hello I have the following repeater code: <asp:Repeater ID="repMain" runat="server" OnItemCommand="repMain_ItemCommand" EnableViewState="false"> <ItemTemplate> <dmg:testcontrol runat="server" MyData=<%#Container.DataItem %>> </dmg:testcontrol> </ItemTemplate> </asp:Repeater> The testcontrol usercontrol looks li...

gplV2: can i use it for free or not?

i'm confused, i've read the GPLV2 (and lesser GPL and all of them) over and over again, but i don't get it, and maybe you can: i'm creating a website for a client. I get paid for that. When i'm done, the app won't be open source, it is solely meant to be used by my client. Now i want to use a nice user control in it, but the control is...

How to catch all exceptions in a user control

I have an user control, which contains multiple methods and each of these methods has a try-catch block. I catch only one type of exceptions, for example ArgumentException. Update - I don't catch one exception but multiple exceptions which I defined. Each of these methods handles the ArgumentException the same way, so I have redundant c...