Search Results

Search found 444 results on 18 pages for 'usercontrols'.

Page 8/18 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • How To Create a Custom List of ProgressBars in .Net 2.0

    - by user205077
    I have created a progress bar custom control and would like to embed this into a list which can be sorted and placed on a windows form using .Net 2.0. What is the best approach for this? Is it possible to just add it to a ListView as a subitem? Is there a better way to achieve this? I want it to be as lightweight as possible.

    Read the article

  • User control loosing its contents when loaded programatically

    - by Phil
    I have a usercontrol which contains 2 repeaters and the code to populate them with data. If i manually insert this into the page then it works correctly, the repeaters populate etc. If I load it programatically using this method; 1) add class name to user control ClassName="ContentModule" 2) reference this in the default.aspx <%@ Reference Control="~/modules/content.ascx" %> 3) Add the code to my codebehind page_load to do the loading; Private loadmodule As ASP.ContentModule Try If themodule = "content" Then loadmodule = CType(LoadControl("~\Modules\Content.ascx"), ASP.ContentModule) Modulecontainer.Controls.Add(loadmodule) End If Catch ex As Exception Response.Write(ex.ToString & "<br />") End Try Nothing from within the usercontrol is loaded to the page. Although if I add some static text i.e "TEST" to the top of the usercontrol this is displayed ok on the default.aspx page. This makes me think that the control is loaded ok, but there is something in the way I have loaded it that is causing the contents to not properly execute. Very frustrating this one! Any help greatly appreciated!

    Read the article

  • C#.NET How to access fields in user control dynamically?

    - by Conor H
    Hi, I'm making a settings screen at the moment that will have a radiobutton group which will determine what controls are displayed. The different settings are contained within a UserControl. I am dynamically creating this UserControl like so: panel = new btSettings(); this.Controls.Add(panel); panel.Location = new Point(15, 49); Just wondering how I can access the fields within this control and design time when the object will only be created during run time? Thanks.

    Read the article

  • How can I dynamically clear all controls in a user control?

    - by Michael
    Is it possible to dynamically (and generically) clear the state of all of a user control's child controls? (e.g., all of its TextBoxes, DropDrownLists, RadioButtons, DataGrids, Repeaters, etc -- basically anything that has ViewState) I'm trying to avoid doing something like this: foreach (Control c in myUserControl.Controls) { if (c is TextBox) { TextBox tb = (TextBox)c; tb.Text = ""; } else if (c is DropDownList) { DropDownList ddl = (DropDownList)c; ddl.SelectedIndex = -1; } else if (c is DataGrid) { DataGrid dg = (DataGrid)c; dg.Controls.Clear(); } // etc. } I'm looking for something like this: foreach (Control c in myUserControl.Controls) c.Clear(); ...but obviously that doesn't exist. Is there any easy way to accomplish this dynamically/generically?

    Read the article

  • Compilation error on a user control

    - by MikeP
    I'm stumped! We have a user control for managing account information. We use this particular control on two pages. On one page, everything works perfectly and meets our expectation. On the second page however we receive compilation errors stating that: "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\lrpcentral\0e987bea\6719c8b6\App_Web_PageThatFails.aspx.f3d462c1.oi52bvii.0.cs(172): error CS0433: The type 'xxxx_ascx' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\APPLICATIONNAME\0e987bea\6719c8b6\App_Web_xxxx.ascx.cdcab7d2.xbnvt2za.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\APPLICATIONNAME\0e987bea\6719c8b6\App_Web_eix7xllr.dll' My problem is similar to Cyril's but the "delete everything from Temp" is not an option for me, and Cyril's solution does not apply since the only variable we have is contained in the designer file, which is not deployed to our production environment (we pre-compile). After reading David's answer (here) I examined my directories for circular dependency and was unable to find any. Structure: Top Level Page that works Control Directory A Page that causes the error

    Read the article

  • What is the most effective way to test for combined keyboard arrow direction in ActionScript 3.0?

    - by Relee
    I need to monitor the direction a user is indicating using the four directional arrow keys on a keyboard in ActionScript 3.0 and I want to know the most efficient and effective way to do this. I've got several ideas of how to do it, and I'm not sure which would be best. I've found that when tracking Keyboard.KEY_DOWN events, the event repeats as long as the key is down, so the event function is repeated as well. This broke the method I had originally chosen to use, and the methods I've been able to think of require a lot of comparison operators. The best way I've been able to think of would be to use bitwise operators on a uint variable. Here's what I'm thinking var _direction:uint = 0x0; // The Current Direction That's the current direction variable. In the Keyboard.KEY_DOWN event handler I'll have it check what key is down, and use a bitwise AND operation to see if it's already toggled on, and if it's not, I'll add it in using basic addition. So, up would be 0x1 and down would be 0x2 and both up and down would be 0x3, for example. It would look something like this: private function keyDownHandler(e:KeyboardEvent):void { switch(e.keyCode) { case Keyboard.UP: if(!(_direction & 0x1)) _direction += 0x1; break; case Keyboard.DOWN: if(!(_direction & 0x2)) _direction += 0x2; break; // And So On... } } The keyUpHandler wouldn't need the if operation since it only triggers once when the key goes up, instead of repeating. I'll be able to test the current direction by using a switch statement labeled with numbers from 0 to 15 for the sixteen possible combinations. That should work, but it doesn't seem terribly elegant to me, given all of the if statements in the repeating keyDown event handler, and the huge switch. private function checkDirection():void { switch(_direction) { case 0: // Center break; case 1: // Up break; case 2: // Down break; case 3: // Up and Down break; case 4: // Left break; // And So On... } } Is there a better way to do this?

    Read the article

  • Transparent child control

    - by pps
    Hello all, I'm writing a control that may have some of its parts transparent or semitransparent. Basically this control shows a png image (with alpha channel). The control's parent window has some graphics on it. Therefore, to make the png control render correctly it needs to get image of what the parent window would draw beneath it. Parent dialog might have WS_CLIPCHILDREN flag set, that means that the the parent window won't draw anything under the the png control and in this case png control won't work properly. This control has to work on Windows Mobile also, so it can't have WS_EX_TRANSPARENT

    Read the article

  • In an asp.net, how to get a reference of a custom webcontrol from a usercontrol?

    - by AJ
    Hi I have a page which holds a custom webcontrol and a usercontrol. I need to reference of webcontrol in usercontrol class. So, I make the declaration of webcontrol as public in page class. But, when I do “this.Page.”, I don’t see the webcontrol listed in list provided by intellisense. Most probably, I am missing something. In an asp.net page, how to get a reference of a custom webcontrol from a usercontrol? Please advise. Thanks Pankaj

    Read the article

  • How can I get to the value of my WPF UserControl DependencyProperty from UI Automation Framework?

    - by Surfbutler
    Hi, I'm having trouble getting access to my WPF UserControl DependencyProperty values through the UI Automation Framework. I've used James McCaffreys article in MSDN as a starting point (Automating IO Tests in WPF Applications, MSDN March 2009), but I can only see properties etc in standard controls such as buttons. I'm assuming there's some Automation interface I have to implement on my UserControl, but what and how? I can already see my control fine e.g. in UISpy, but I can't see the dependency properties within it. Here's what my usercontrol looks like currently in UISpy: AutomationElement General Accessibility AccessKey: "" AcceleratorKey: "" IsKeyboardFocusable: "False" LabeledBy: "(null)" HelpText: "Switches 48v Phantom Power On/Off (for Mic inputs only)." State IsEnabled: "True" HasKeyboardFocus: "False" Identification ClassName: "" ControlType: "ControlType.Custom" Culture: "(null)" AutomationId: "V48SwL" LocalizedControlType: "custom" Name: "" ProcessId: "5684 (VirtualSix)" RuntimeId: "7 5684 40026340" IsPassword: "False" IsControlElement: "True" IsContentElement: "True" Visibility BoundingRectangle: "(140, 457, 31, 20)" ClickablePoint: "155,467" IsOffscreen: "False" ControlPatterns

    Read the article

  • Changing the direction of a Combo box dropdown in SWT

    - by Kris
    Hi, I'm building an Eclipse plugin in SWT, and I have the following problem: one of my fields is a combo box, and in some cases it may have fairly long items as selection options. My plugin runs on the right side of the screen, so when you go to use the combo-box, the right side of the combo box is cut off. So, my question is: is there any way to change the dropdown's alignment relative to the combo control? It seems to be permanently left-aligned... and I'm pretty sure you can change the direction in Swing (though the only place I've seen it done is in the Substance UI demo. The Combo Box tab has boxes with North, South East, and West flyout directions... for my application, I need something like the West flyout) Note: Setting actual text limits is a last-case-scenario option; it would be quite a bit of guesswork to set the text limit dynamically (since the widget's view can be resized). Here's a picture (sorry, I can only have one link and no images :( ... I need some more rep :p) Left side of the line: Proper width - the view is the wide enough for the combo dropdown to display all the text; you can see the scrollbars on the right side. Right side of the line: Too small - Here, the view has been resized, and the combo dropdown scrollbar (as well as some of the text) is cut off by the right side of the screen. I always have more screen space available to the left (since this is always on the right hand side of the screen), but the combo dropdown always appears to the lower right. Hopefully this is clear enough.

    Read the article

  • ASP.NET/C#: How to use a Subclassed Control on a Page?

    - by Bob Kaufman
    I've subclassed DropDownList to add functionality specific to my application: public class MyDropDownList : DropDownList { ... } ... then referenced it in Web.Config, which is where I figure things start to go wrong: <pages theme="Main"> <controls> <add tagPrefix="bob" tagName="MyDropDownList" src="~/Components/MyDropDownList.cs" /> </controls> </pages> my reference to it does not work: <tr><td>Category</td> <td><bob:MyDropDownList runat="server" ID="Category"... /> and my best clue is the complier error message: "The file 'src' is not a valid [sic] here because it doesn't expose a type." I figure I'm misapplying knowledge of how to create a Web User Control here. What I want to be able to do is refer to this control on an ASP.NET page just like I would the parent DropDownList. Refactoring back into a Web User Control that contains a DropDownList is not desirable, because I want to apply a RequiredFieldValidator to it.

    Read the article

  • Mimic C preprocessor with Python/Ruby?

    - by prosseek
    I need to mimic the preprocessor feature of C with Python. If I want to run the debug release, I use as follows with C #ifdef DEBUG printf(...) #endif I just use -DDEBUG or similar to trigger it on or off. What method can I use for Python/Ruby? I mean, what should I do to control the behavior of python/ruby scripts in such a way that I can change a variable that affects all the script files in a project?

    Read the article

  • calling a method on the parent page from a user control

    - by Kyle
    I am using a user control that I created (just a .cs file not an .ascx file), that does some magic and depending on a value generated by the control, I need it to do something on the parent page that is 'hosting' the control. It needs to call a method under certain circumstances (method is on the parent control). the control is placed on the parent page like so: <customtag:MyControl ID="something" runat="server" /> I'm dynamically creating buttons etc on the control itself but when a button is clicked, let's say for example that there's a text box on the control and if the value of the textbox is "bob" it needs to call a method on the page that's housing the control...how can I accomplish this?

    Read the article

  • AutoScaleMode.Inherit does not inherit

    - by codymanix
    I have a user control contained in a tabpage. The Form has set AutoScaleMode = AutoScaleMode.Font and the UserControl has set AutoScaleMode.Inherit. Now when I enlarge the font size of the form then the font is enlarged in the user control too, but the controls contents are not scaled. If I explicitly set AutoScaleMode.Font on the user control then it works properly. Shouldn't AutoScaleMode.Inherit work that way?

    Read the article

  • Sign out button reloads all user controls

    - by eych
    I have an aspx page with several user controls (ascx) as well as an asp:button for signing out. The click event of the button clears the session and does a response.redirect to the login page. However, before the click event is called, since the page posts back, all of the Page_Load events run for all of the controls. What is the best way to have the click event code run without unnecessary reloading of all user controls?

    Read the article

  • Binding a Value from a View-Model to the View-Model of a child User Control in Silverlight?

    - by andrej351
    Hi there, So i have a UserControl for one of my Views and have another 'child' UserControl inside that. The outer 'parent' UserControl has a Collection on its View-Model and a Grid control on it to display a list of Items. I want to place another UserControl inside this UserControl to display a form representing the details of one Item. The outer / parent UserControl's View-Model already has a property on it to hold the currently selected Item and i would like to bind this to a DependancyProperty on the inner / child UserControl. I would then like to bind that DependancyProperty to a property on the child UserControl's View-Model. I can then set the DependancyProperty once in XAML with a binding expression and have the child UserControl do all its work in its View-Model like it should. The code i have looks like this.. Parent UserControl: <UserControl x:Class="ItemsListView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding Source={StaticResource ServiceLocator}, Path=ItemsListViewModel}"> <!-- Grid Control here... --> <ItemDetailsView Item="{Binding Source={StaticResource ServiceLocator}, Path=ItemsListViewModel.SelectedItem}" /> </UserControl> Child UserControl: <UserControl x:Class="ItemDetailsView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding Source={StaticResource ServiceLocator}, Path=ItemDetailsViewModel}" ItemDetailsView.Item="{Binding Source={StaticResource ServiceLocator}, Path=ItemDetailsViewModel.Item, Mode=TwoWay}"> <!-- Form controls here... --> </UserControl> The selected Item is bound to the DependancyProperty fine. However from the DependancyProperty to the child View-Model does not. I've used this sort of apporach in a WPF app without problems. It appears to be a situation where there are two concurrent bindings which need to work but with the same target for two sources. Why won't the second (in the child UserControl) binding work?? Is there a way to acheive the behaviour I'm after?? Cheers.

    Read the article

  • Set Custom ASP.NET UserControl variables when its in a Repeater

    - by tnriverfish
    <%@ Register Src="~/Controls/PressFileDownload.ascx" TagName="pfd" TagPrefix="uc1" %> <asp:Repeater id="Repeater1" runat="Server" OnItemDataBound="RPTLayer_OnItemDataBound"> <ItemTemplate> <asp:Label ID="LBLHeader" Runat="server" Visible="false"></asp:Label> <asp:Image ID="IMGThumb" Runat="server" Visible="false"></asp:Image> <asp:Label ID="LBLBody" Runat="server" class="layerBody"></asp:Label> <uc1:pfd ID="pfd1" runat="server" ShowContainerName="false" ParentContentTypeId="55" /> <asp:Literal ID="litLayerLinks" runat="server"></asp:Literal> </ItemTemplate> </asp:Repeater> System.Web.UI.WebControls.Label lbl; System.Web.UI.WebControls.Literal lit; System.Web.UI.WebControls.Image img; System.Web.UI.WebControls.HyperLink hl; System.Web.UI.UserControl uc; I need to set the ParentItemID variable for the uc1:pdf listed inside the repeater. I thought I should be able to find uc by looking in the e.Item and then setting it somehow. I think this is the part where I'm missing something. uc = (UserControl)e.Item.FindControl("pfd1"); if (uc != null) { uc.Attributes["ParentItemID"] = i.ItemID.ToString(); } Any thoughts would be appreciated. Also tried this with similar results... when I debug inside my usercontrol (pfd1) the parameters I am trying to set have not been set. uc = (UserControl)e.Item.FindControl("pfd1"); if (uc != null) { uc.Attributes.Add("ContainerID", _cid.ToString()); uc.Attributes.Add("ParentItemId", i.ItemID.ToString()); }

    Read the article

  • (nested) user controls within a mvp pattern causing sporadic problems

    - by LLEA
    hi everyone, I have a serious problem with nested user controls (UCs) in WinForms while trying to implement the mvp pattern (passive view). The project consists of one model (designed as a singleton) and a set of different presenters with corresponding view interfaces. To avoid one huge view interface and therefore an overloaded main UI, I decided to make use of a set of different UCs. Each UC has one view interface and one presenter that can access the model. But there are nested UCs: meaning that one specialised UC implements sort of a basic UC. The main UI just represents a container for all those UCs. So far, so good (if not, please ask)?! There are two problems that I am facing now (but I guess both are of the same origin): From time to time it is not possible anymore to load the UCs and test them within the Visual Studio 2008 User Control Test Container. The error message just says that a project with an output type of class library cannot be started directly etc. I can "handle" that by unloading all UC projects and reloading them afterwards. (I guess the references to all mvp components and other UCs are then updated). Assuming that the implementation of my mvp pattern is okay and all those UCs are testable within the VS Test Container at a certain time - there is the biggest problem still left: I am not able to add any UC (even the basic and unnested ones) to a simple Form (UI). The error message: error message.jpg Could it be that my basic UC causes all these Problems?! It consists of two simple ComboBoxes and implements a basic presenter and basic view interface. Whenever I add this UC to a different UC the VS designer adds two references to the public getter methods of the UC as resources. I then manually remove those resources from the resx-file and commend the corresponding lines in the designer file. thx in advance

    Read the article

  • When to draw/layout child controls in UserControl

    - by Ted Elliott
    I have a list-type UserControl (like a ListBox). The items inside the control are another complex UserControl containing a few other controls (ComboBox, TextBox, etc). I'm wondering what the preferred or best method would be to override to draw/layout the child controls. I basically want to trigger this method any time the list changes. I originally had a RedrawItems method that I just called whenever I needed to redraw which added or removed Controls from the Controls collection. But it was getting triggered too early in the lifecycle of the code from some of the designer code. Now I've switched to overriding OnLayout and doing my stuff there. I call PerformLayout when I want to trigger a redraw, such as when the DataSource property changes or when it fires a changed event. Is OnLayout the best place for this? Here is the code: [ComplexBindingProperties("DataSource")] public partial class CustomList : UserControl { private object _dataSource; private CustomListItem _newRow; public CustomList() { InitializeComponent(); } protected override void OnCreateControl() { base.OnCreateControl(); _newRow = new CustomListItem(); Controls.Add(_newRow); } public object DataSource { get { return _dataSource; } set { bool register = _dataSource != value; if (_dataSource != null && _dataSource != value) { UnregisterDataSource(_dataSource); } _dataSource = value; if (_dataSource != null) RegisterDataSource(_dataSource); PerformLayout(); } } public CustomListItem ItemTemplate { get { return _newRow; } } protected override void OnLayout(LayoutEventArgs e) { base.OnLayout(e); int ctrlCount = this.Controls.AsEnumerable().OfType<CustomListItem>().Count(); ctrlCount--; // subtract 1 for the add row var ds = this.DataSource as System.Collections.IList; int itemCount = ds == null? 0 : ds.Count; int maxCount = Math.Max(ctrlCount,itemCount); if (maxCount == 0) return; this.SuspendLayout(); // temporarily remove the template Controls.RemoveAt(Controls.Count-1); for (int i = 0; i < maxCount; i++) { CustomListItem item; if (i >= itemCount) { Controls.RemoveAt(i); } else { if (i >= ctrlCount) { item = ItemTemplate.Copy(); this.Controls.Add(item); item.Location = new Point(0, item.Height * i); item.TabIndex = i + 1; item.ViewMode = true; } else { item = (CustomListItem) Controls[i]; } item.Data = ds[i]; } } this.Controls.Add(ItemTemplate); ItemTemplate.Location = new Point(0, ItemTemplate.Height * maxCount); ItemTemplate.TabIndex = maxCount + 1; this.ResumeLayout(true); } private void RegisterDataSource(object dataSource) { IBindingList ds = dataSource as IBindingList; if (ds != null) { ds.ListChanged += new ListChangedEventHandler(DataSource_ListChanged); } } void DataSource_ListChanged(object sender, ListChangedEventArgs e) { switch (e.ListChangedType) { case ListChangedType.ItemAdded: PerformLayout(); break; case ListChangedType.ItemChanged: break; case ListChangedType.ItemDeleted: PerformLayout(); break; case ListChangedType.ItemMoved: PerformLayout(); break; case ListChangedType.Reset: PerformLayout(); break; default: break; } } private void UnregisterDataSource(object dataSource) { IBindingList ds = dataSource as IBindingList; if (ds != null) { ds.ListChanged -= new ListChangedEventHandler(DataSource_ListChanged); } } }

    Read the article

  • Dock=>Fill a control in FlowLayoutPanel

    - by serhio
    I have a UserControl in which a FlowLayoutPanel. This user control consist of a description and some controls: [descr.] 123456789, it should be able to be reversed 987654321 [descr.] So FlowLayoutPanel is used for this scope(RightToLeft - True/False). Is this a way that the label1 fill the rest of the control(to left or right respectively)?

    Read the article

  • Multiple layout UserControl

    - by johnm01
    Hi all, I have a UserControl that manages a lot of editable information (like text-boxes). Now I need to make a version of this control that has a different layout (from horizontal to vertical). I can expose the control, like this: public TextBox MyText { get { return myText; } set { myText = value; } } i can now manually change the location and size, but this does not give me a visual reposition of them at design time. Is there a better way of doing this ? Thanks John

    Read the article

  • Javascript not getting keyDown input

    - by William
    For some reason my code just isn't wanting to fire off any kind of OnKeyDown event. I don't know why. Can anyone tell me what I'm doing wrong? <!DOCTYPE html> <html lang="en"> <head> <title>Canvas test</title> <meta charset="utf-8" /> <link href="/bms/style.css" rel="stylesheet" /> <style> body { text-align: center; background-color: #000000;} canvas{ background-color: #ffffff;} </style> <script type="text/javascript"> var x = 50; var y = 250; var speed = 5; function controls(event){ if(!e){ //for IE e = window.event; } if(e.keyCode==37){//keyCode 37 is left arrow x -= speed; } if(e.keyCode==39){ //keyCode 39 is right arrow x += speed; } if(e.keyCode==38){//keyCode 37 is up arrow y -= speed; } if(e.keyCode==40){ //keyCode 39 is down arrow y += speed; } } function update(){ document.onkeydown="controls(event);"; draw(); } function draw(){ var canvas = document.getElementById('screen1'); if (canvas.getContext){ var ctx = canvas.getContext('2d'); ctx.fillStyle = 'rgba(255,255,255,0.5)'; ctx.fillRect(0,0,500,500); ctx.fillStyle = 'rgb(236,138,68)'; ctx.fillRect(x,y,25,25); } } setInterval('update();', 1000/60); </script> </head> <body> <canvas id="screen1" width="500" height="500"></canvas> </body> </html>

    Read the article

  • How to override event on a UserControl

    - by Vadim
    Hello! I have a WinForms application (OwnerForm) with some UserControl. When textbox of UserControl is changed, I want to filter content of a OwnerForm. But how can I make it? I don't want to specify OwnerForm inside the user control. I know a solution to add manually handlers for MyUserControl.tb.TextChanged to some functions on a owner form, but I think it's bad way. I'll prefer to have overridable functions, but I can't imagine how to do it. Any suggestions? Thanks in advance,

    Read the article

  • User control javascript

    - by Prashant
    Hi, I have a generic user control which will be used twice in a page. There is a javascript asscoiated with it which also needs to be added. How can I add this to a page since the javascript will be added multiple times.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >