usercontrols

Event problem C# .NET UserControl

I have an UpdatePanel and in it a regular Panel. In the Panel I dynamically add simple UserControls. The Usercontrol has a Button and a Label. When I click on a button in a control it removes all controls in the Panel which I have added dynamically. Can anyone help? int controlID = 0; List<Control> cc = new List<Control>(); ...

Asp.Net MVC UserControl

I'm porting an application from WebForms to MVC. I have a WebForms UserControl that is used throughout the site and which contains presentational and business logic, and in particular some 'initizliation' logic (in the Page_Load) My understanding of MVC UerControls is that they have no dedicated controller and thus contain no logic, a...

ASP.NET: Assign a variable before rendering user control

(New to ASP.NET here.) I have a user control which should check for a value in the request query string before deciding what to render: <%# softLoaded ? "HELLO" : "GOOD BYE" %> This is the code-behind for the user control: public bool softLoaded { get; set; } protected void Page_Load(object sender, EventArgs e) { softLoaded = "...

How can you draw separate parts a control in different places with WPF?

Hello. I'm trying to split the drawing of a WPF UserControl onto two separate pages of a custom Paged Panel that I'm writing. I thought of using a VisualBrush to draw bits of the control. Is this the way to go? I presume I'll also have to put the controls that need to be visually split in an invisible container. Has anyone come across a...

JQuery in ASP.Net User Control in C#

I'm trying to add some JQuery to an ASP.Net User Control to check to see if checkboxes have been selected or not. It appears that scripting languages are not supported directly in user controls, but need to be added via the RegisterStartupScript() method. I found a post at this url describing this: http://www.codeproject.com/KB/aspnet/...

User Control Events and Overrides

I have a User Control for typical CRUD like actions on my WinForm app. Validate, Insert, Update, Clear, Cancel, and Delete. On every form I put this on I end up adding the click event, ucPersonNav.btnValidate.Click += new EventHandler(btnValidate_Click);, for every button. What I am wondering is can I have the Events be on the User C...

JQuery in ASP.Net User Control in C#

I'm having problems using JQuery inside an ASP.Net User Control I've created a sample and here is the markup for my user control: <%@ Control Language="C#" ClassName="UC" AutoEventWireup="true" CodeFile="UC.ascx.cs" Inherits="UserControls_UC" %> <span id="Licenses"></span> <script type="text/javascript"> $(document).ready(fu...

Placing jQuery Refernce at the bottom of HTML Document breaks User Control

Walter Rumsby provided a great answer to Where to place JavaScript in an HTML file. He references the work done by the Yahoo Exceptional Performance team and their recommendation to place scripts at the bottom of the page. Which is a hard and fast rule that I've been following for quite sometime now. In the same thread Levi Rosol pointed...

Pass a value and reload User Control from Javascript

Hi guys, I have a User control (because I use the same in other page, so I thought I should reuse code and not double my work), but in this page I show a list of companies and each one has a company number, I need to pass this company number to that User Control and it has to reload using that passed company number. How can I accomplis...

Listbox with Custom Listitem -- Prevent Selection?

I have a listbox that uses a UserControl as the item template. Inside the UserControl, I have an image (an X) that when clicked, sends out event to remove the UserControl(listitem) from the listbox. Is there a way to prevent the listbox from selecting that item when a user clicks on the image but still allows listitem selection for eve...

ASCX with GridView and DetailsView

Hi I've created an ASCX control with a GridView and a DetailsView associated to the GridView, both have a DataSource associated. The ASCX works fine when there's only one in the page, as soon as I add the second one (both with distinct event handlers and parameters) I start having problems with the second control. The first control ke...

WPF UserControl in DataTemplate within ItemsControl - how to bind to parent of ItemsSource

The subject line says it all really! I have a user control which can be bound successfully to, say, a Fullname object - i.e. it works ok. I now need to show a list of these and, again, this works ok when the control is in a DataTemplate within ItemsControl.Template. But, the control has a property (InEditMode) that is not a property ...

How do you free system ram when creating and disposing user controls.

I have a c# application that is composed of various screens which is each a respective user control. The application requires a lot of switching between the various screens and is also graphic intensive. Each control is disposed once the next control is invoked and the garbage collector is called to release the system resources. The thin...

Can creating a C++ control and using it in C# gain performance?

In reality, I am trying to create a control showing price depths of a stock which needs to accept a large number of messages and summarizing them for display purposes. Will I get a better result if I create it in MFC and use that control in my .Net Winform application than writing the whole thing in .NET? ...

How to assign a user control to a namespace without having code-behind?

In a normal user control, we have .cs.ascx (code-behind) to assign the namespace we want our control to be in. But what if we don't have this code-behind to assign the namespace? Can we maybe assign the namespace of a user control in the headers? EDIT I was hoping I can do somthing like this: <%@ Control Language="C#" AutoEventWireup="...

Can you create a web user control in a application project outside of the project's default namespace?

I have a web user control (ascx) in my project and I would like to move it to a more general namespace that makes it easier to share the control across projects. The problem is, it seems that web user controls like to stay in a namespace named after the web application they're in. Is there some way to break out of the web app namespace...

Creating a ToolBox component with design-time support using a UserControl

I have a UserControl for Windows Forms. How can I convert it to a component? What I want to do is, to add it to the VS toolbox, add it to form with drag and drop at design-time and change its Location and Dock properties using the Properties window. What should I look for to do this? I've created something similar before but it was a Co...

Usercontrol events dont fire in Httphandler

uitest.ascx usercontrol events dont fire, does anyone have a clue about it? business.Pages.Page page1 = new business.Pages.Page(); System.Web.UI.HtmlControls.HtmlForm form = new System.Web.UI.HtmlControls.HtmlForm(); UserControl uc = (UserControl)page1.LoadControl("~/use...

How to call a method of an user control from a page in asp.net 2.0 ?

Hi all, I have a usercontrol used in a masterpage. I have added a page with the masterpage. Now I need to call a method of the user control from the page. How to do this? Please help. ...

How to get value on Postback from user control created in render method?

Hi All, I have UserControl and I need to add (generate) some tags, basically Input tags. Later on on postback I need collect values from these inputs. I use Render method to generate Inputs, but I dont know how can I get the values from these inputs on Postback. I do have unique id for each Input. Code form Render method: writer.Write(...