Search Results

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

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

  • Issue with dynamically loading a user control on button click

    - by Kumar
    I have a page in which I am loading a user control dynamically as follows: Default.aspx: <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </cc1:ToolkitScriptManager> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> Default.aspx.cs: protected void Page_Load(object sender, EventArgs e) { var ctrl = LoadControl("~/UserCtrl1.ascx"); ctrl.ID = "ucUserCtrl1"; PlaceHolder1.Controls.Add(ctrl); } Below is the code for UserCtrl1.ascx <asp:Label ID="Label1" runat="server"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" /> <br /> <asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder> I am dynamically loading another user control when the Button1 is clicked UserCtrl1.ascx.cs protected void Button1_Click(object sender, EventArgs e) { Label1.Text = "UserControl - 1 button clicked!"; var ctrl = LoadControl("~/UserCtrl2.ascx"); ctrl.ID = "ucUserCtrl2"; PlaceHolder2.Controls.Add(ctrl); } Below is the markup for UserCtrl2.ascx <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label2" runat="server"></asp:Label> <asp:Button ID="Button2" runat="server" Text="Button2" OnClick="Button2_Click" /> </ContentTemplate> </asp:UpdatePanel> UserCtrl2.ascx.cs protected void Button2_Click(object sender, EventArgs e) { Label2.Text = "UserControl - 2 button clicked!"; } After the page loads when I click the Button1 in UserCtrl1 the click event fires and I am able to see the Label1 text. It also properly loads the UserCtrl2, but when I click the Button2 in UserCtrl2 the click event dosent fire and even worse when I click the Button2 twice the UserCtrl2 control dissappears from the page. How can I fix this?

    Read the article

  • DataGrid in USerControl --> Paging problem

    - by grady
    Hi, I have a DataGrid in a USerControl. Somehow the paging doesnt work, the paging has the right amount of pages, but clicking the numbers does not work ... it stays on page 1. This is my Grid: <asp:DataGrid ID="DG_Grid" runat="server" AllowPaging="True" PageSize="10" EnableViewState="True" AllowSorting="False" DataKeyField="DUEDATE" OnItemDataBound="DG_Grid_ItemDataBound" OnItemCommand="DG_Grid_ItemCommand"> Ideas anyone?

    Read the article

  • c# - create invisible user control

    - by dhh
    Hey, I need to create a user control in C#.Net, which can be added to the application without being visible - just like the FolderBrowserDialog. It's a new window which I'll be using often so I think this is the right way. The window will be opened by envoking the showDialog-Method as known from the other dialog. Any Idea? Thanks and regards, Daniel

    Read the article

  • Why are controls within custom panel (C# winforms) disappearing in designer?

    - by Brandon
    I have been able to create a custom C# winforms control that is basically a panel with a fixed banner (header/footer). I want to base other user controls on this "banner panel". I've gotten past the problem with the designer here. I can successfully add controls to the inner content panel. Everything looks fine while designing. However, when I recompile, the controls I added to the content panel disappear. They are still there (in code) but aren't displayed in the designer. Is there any thing that I need to do to set the drawing order of the controls?

    Read the article

  • Change user control appearance based on state

    - by John
    I have a user control that consists of four overlapping items: 2 rectangles, an ellipse and a lable <UserControl x:Class="UserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="50.1" Height="45.424" Background="Transparent" FontSize="24"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="3.303*" /> <RowDefinition Height="40*" /> <RowDefinition Height="2.121*" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="5.344*" /> <ColumnDefinition Width="40.075*" /> <ColumnDefinition Width="4.663*" /> </Grid.ColumnDefinitions> <Rectangle Name="Rectangle1" RadiusX="5" RadiusY="5" Fill="DarkGray" Grid.ColumnSpan="3" Grid.RowSpan="3" /> <Ellipse Name="ellipse1" Fill="{Binding State}" Margin="0.016,0.001,4.663,0" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Stroke="Black" IsEnabled="True" Panel.ZIndex="2" /> <Label Name="lblNumber" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" FontWeight="Bold" FontSize="24" Grid.Column="1" Grid.Row="1" Padding="0" Panel.ZIndex="3">9</Label> <Rectangle Grid.Column="1" Grid.Row="1" Margin="0.091,0,4.663,0" Fill="Blue" Name="rectangle2" Stroke="Black" Grid.ColumnSpan="2" Panel.ZIndex="1" /> </Grid> Here is my business object that I want to control the state of my user control: Imports System.Data Imports System.ComponentModel Public Class BusinessObject Implements INotifyPropertyChanged 'Public logger As log4net.ILog Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged Private _state As States Public Enum States State1 State2 State3 End Enum Public Property State() As States Get Return _state End Get Set(ByVal value As States) If (value <> _state) Then _state = value RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("State")) End If End Set End Property Protected Sub OnPropertyChanged(ByVal name As String) RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(name)) End Sub I want to be able to change the state of a business object in the code behind and have that change the colors of multiple shapes in my usercontrol. I'm not sure about how to do the binding. I set the datacontext of the user control in the code behind but not sure if that's right. I'm new to WPF and programming in general and I'm stuck on where to go from here. Any recommendations would be greatly appreciated!!

    Read the article

  • Good Replacement for User Control?

    - by David Lively
    I found user controls to be incredibly useful when working with ASP.NET webforms. By encapsulating the code required for displaying a control with the markup, creation of reusable components was very straightforward and very, very useful. While MVC provides convenient separation of concerns, this seems to break encapsulation (ie, you can add a control without adding or using its supporting code, leading to runtime errors). Having to modify a controller every time I add a control to a view seems to me to integrate concerns, not separate them. I'd rather break the purist MVC ideology than give up the benefits of reusable, packaged controls. I need to be able to include components similar to webforms user controls throughout a site, but not for the entire site, and not at a level that belongs in a master page. These components should have their own code not just markup (to interact with the business layer), and it would be great if the page controller didn't need to know about the control. Since MVC user controls don't have codebehind, I can't see a good way to do this. I've searched previous SO questions, and have yet to find a good answer. Options so far In an attempt to avoid turning the comments section into a discussion... RenderAction This allows the view to call another controller, which will be responsible for interacting with the BLL and whatever data is necessary to its corresponding view. The calling view needs to be aware of the sub controller. This seems to provide a nice way to encapsulate partial views and controls, without having to modify the calling controller. RenderPartial The calling controller is still responsible for executing whatever code is associated with the partial view, and making sure that the model passed to the partial view contains the data it expects. Effectively, modifying the partial view potentially means modifying the calling controller. Annoying especially if this is used in multiple places. Portable Areas Place each control in its own project/area?

    Read the article

  • Caching Web UserControl by Propety is not working (Grr!)

    - by PapillonUK
    Here's my code behind: <PartialCaching(60, Nothing, "UsrCtl_WebUserControl.CacheString", Nothing, True)> _ Partial Class UsrCtl_WebUserControl Inherits System.Web.UI.UserControl Private _CacheString As String Public Property CacheString() As String Get Return _CacheString End Get Set(ByVal value As String) _CacheString = value End Set End Property End Class Here's the user control embedded in a page: <uc:wuc ID="wuc" runat="server" CacheString="A" /> And in another page: <uc:wuc ID="wuc" runat="server" CacheString="B" /> According to the docs this control should maintain a different, 60 second cached version for each value of the CacheString property. It doesn't work - it caches for 60 seconds, but only one cached copy is created regardless of what I put in the CacheString property. Anyone any ideas what i'm doing wrong? - After 4 hours of this I have no hair or nails left - please save my monitor from the brick.

    Read the article

  • Adding Custom Properties

    - by j-t-s
    Hi All I have created a user control, and now I want to add custom properties to it so they will appear in the Properties toolbar in Vis. Studio. How can this be done? My custom property will be: "Animation Type" with options "Fade | Blink | Scroll | Blend" thank you

    Read the article

  • In an ASP control how can I get the text in a <Contentemplate> tag in the control code?

    - by uince81
    Hi, In my page ASP.net page I'm using a custom control like this: <MyNamespace:MyControl runat="server" ID="myControl"> <contenttemplate> This is the text I want to use </contenttemplate> </MyNamespace:MyControl> In the c# code of the control how can I obtain a string containing the text between the <contentemplate> tag (eg. "This is the text I want to use") ? Can you give me the code? Thank you!

    Read the article

  • User Control - dependency property to Change Image Issues

    - by mflair2000
    i'm having issues setting the Image from a dependency property. It seems like the trigger doesnt fire. I just want hide/show and image, or set the source if possible. public static readonly DependencyProperty HasSingleValueProperty = DependencyProperty.Register("HasSingleValue", typeof(bool), typeof(LevelControl), new FrameworkPropertyMetadata(false,FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); public bool HasSingleValue { get { return (bool)GetValue(HasSingleValueProperty); } set { SetValue(HasSingleValueProperty, value); } } public LevelControl() { this.InitializeComponent(); //this.DataContext = this; LayoutRoot.DataContext = this; } //Control Markup <Grid x:Name="LayoutRoot"> <Image x:Name="xGreenBarClientTX" HorizontalAlignment="Stretch" Height="13" Margin="7,8.5,7,0" Stretch="Fill" VerticalAlignment="Top" Width="47" Canvas.Left="181.67" d:LayoutOverrides="Height" > <Image.Style> <Style TargetType="{x:Type Image}"> <Style.Triggers> <DataTrigger Binding="{Binding HasSingleValue}" Value="True"> <Setter Property="Opacity" Value="100"/> </DataTrigger> <DataTrigger Binding="{Binding HasSingleValue}" Value="False"> <Setter Property="Opacity" Value="0"/> </DataTrigger> </Style.Triggers> </Style> </Image.Style> </Image>

    Read the article

  • Animate UserControl (When It Gets Collapsed) in WPF

    - by sanjeev40084
    I have two xaml file one is MainWindow.xaml and other is userControl EditTaskView.xaml. In MainWindow.xaml it consists of listbox and when double clicked any item of listbox, it displays edit window (EditView userControl). Whenever edit window gets displayed, it plays an animation (sliding from right to left). The EditView userControl has two buttons 'Save' and 'Cancel'. Now I want to add animation (sliding edit window from left to right) when any of the button (Save or Cancel) button is clicked. When 'Save' or 'Cancel' button is clicked, it Collapse the edit window. Here is the story board which slides window from right to left. <Storyboard x:Key="AnimateEditView"> <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="EditTask" > <EasingThicknessKeyFrame KeyTime="0" Value="100,0,0,0"> <EasingThicknessKeyFrame.EasingFunction> <ExponentialEase EasingMode="EaseOut"/> </EasingThicknessKeyFrame.EasingFunction> </EasingThicknessKeyFrame> <EasingThicknessKeyFrame KeyTime="0:0:1" Value="0,0,0,0"> <EasingThicknessKeyFrame.EasingFunction> <ExponentialEase EasingMode="EaseOut"/> </EasingThicknessKeyFrame.EasingFunction> </EasingThicknessKeyFrame> </ThicknessAnimationUsingKeyFrames> </Storyboard> </Window.Resources> <Window.Triggers> <EventTrigger RoutedEvent="Control.MouseDoubleClick" SourceName="lstBxTask"> <BeginStoryboard Storyboard="{StaticResource AnimateEditView}"/> </EventTrigger> <Window.Triggers> Here is the xaml within MainWindow. <ListBox x:Name="lstBxTask" Style="{StaticResource ListBoxItems}" MouseDoubleClick="lstBxTask_MouseDoubleClick"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <Rectangle Style="{StaticResource LineBetweenListBox}"/> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Taskname}" Style="{StaticResource TextInListBox}"/> <Button Name="btnDelete" Style="{StaticResource DeleteButton}" Click="btnDelete_Click"/> </StackPanel> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> <ToDoTask:EditTaskView x:Name="EditTask" Grid.Row="0" Grid.RowSpan="3" Grid.ColumnSpan="2" Visibility="Collapsed" > Any suggestions?

    Read the article

  • How to get width of button in DateTimePicker-Control/Controls in general?

    - by Inno
    Hello everybody, I implemented a custom DateTimePicker. On the DateTimePicker there is a button. In the examples I've found it's width is set to 16. This is working but I would like to have a dynamic approach. So, is there a way to get the size of this button or is there a general way to get information about .Net-Control sub elements like size etc.? Trying DateTimePicker.Controls didn't help me (it's empty).

    Read the article

  • How to fix the flickering in User controls.

    - by Royson
    In my application i am constantly moving from one control to another. I have created no. of user controls, but during navigation my controls gets flicker. it takes 1 or 2 sec to update. I tried to set this SetStyle(ControlStyles.OptimizedDoubleBuffer, true); or SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); but it didn't help... Each control has same background image with different controls. So what is the solution for it.. Thanks.

    Read the article

  • User Controls Importing Problem (asp.net)(vb)

    - by Phil
    I have this class that contains vars for db connection; Public Shared s As String Public Shared con As String = WebConfigurationManager.ConnectionStrings("foo").ToString() Public Shared c As New SqlConnection(con) Public Shared x As New SqlCommand(s, c) I import this to my page like this; Imports DBVars I'm then able to access these vars from my page. But if I try to import them into a user control the variables are not available. Am I making an error or is this expected? Thanks.

    Read the article

  • Wpf user control button command is not firing in viewmodel

    - by mani1985
    hi, i have a user control in which there is a button. i wrote icommand in the viewmodel for the button to call some function. when i use this user control in some other page ,the user control button click is not working. my xaml Save my view model private ICommand _insertNewNote; public ICommand InsertNewNote { get { if (_insertNewNote == null) { _insertNewNote = new RelayCommand( param = this.InsertNewExceptionNote()); } return _insertNewNote; } } public void InsertNewExceptionNote() { //... } my problem is when i use this user control in some page like this the user control is getting displayed in the page. but the button in the user control is not firing when i click it. user control view model icommand is not at all initialized. please provide me a solution. Thanks in advance.

    Read the article

  • Call any webservice from the same $.ajax() call

    - by Andreas
    Hi! Im creating a usercontrol which is controled client side, it has an javascript-file attatched to it. This control has a button and upon click a popup appears, this popup shows a list of my domain entities. My entities are fetched using a call to a webservice. Im trying to get this popup usercontrol to work on all my entities, therefore i have the need to call any webservice needed (one per entity for example) with the same $.ajax() call. I have hiddenfields for the webservice url in my usercontrol which you specify in the markup via a property. So far so good. The problem arise when i need some additional parameters to the webservice (other than pagesize and pageindex). Say for example that one webservice takes an additional parameter "Date". At the moment i have my parameters set up like this: var params = JSON.stringify({ pageSize: _this.pageSize, pageIndex: _this.pageIndex }); and then i call the webservice like so: $.ajax({ webserviceUrl, params, function(result) { //some logic }); }); What i want to do is to be able to add my extra parameters (Date) to "Param" when needed, the specification of these parameters will be done via properties of the usercontrol. So, bottom line, i have a set of default parameters and want to dynamically add optional extra parameters. How is this possible? Thanks in advance.

    Read the article

  • User control attributes at design-time

    - by ciscoheat
    I'm testing a simple User Control in Visual Studio 2008: A Panel named Wrapper with some controls inside. Can Visual Studio handle this at design time? public partial class TestControl : System.Web.UI.UserControl { [Description("Css class of the div around the control.")] [CssClassProperty] public string CssClass { get { return Wrapper.CssClass; } set { Wrapper.CssClass = value; } } } When setting the CssClass property, it doesn't update the css of the Panel at design time. Am I hoping for too much?

    Read the article

  • ASP.NET Controls with Highly Customizable GUI

    - by micha12
    We are developing an ASP.NET web application where some of the features that we will need to implement are quite standard: for example, a chat between users, a forum, etc. There are ASP.NET chats and forums components available. However, they all have a predetermined GUI and html markup that is almost impossible to change and very difficult to customize. And this is a very common situation for most controls like grids, etc.: you have very low control over the html markup that is being generated by the control. In our case, our web app will have its own web design created by a professional web designer in PhotoShop, and then it will but transformed into html markup that will then be transformed in aspx pages. We would ideally like to create the html markup for the forum and chat by ourselves, and use only the non-GUI part of the ASP.NET components. Is this approach feasible? Has anyone dealt with such approach in practice?

    Read the article

  • asp.net custom web user control -- button

    - by jreedinc
    Is it possible to create a custom button -- web user control? I want certain java scripts to trigger when buttons are clicked. If so, are there any articles out there that explain the basics? I completely understand that I can load javascript via .js link or dynamically at page load, but I would like to just drop a control on the page without manually adding code to every page on every one of my projects.

    Read the article

  • How can I automatically highlight a specific character in link text using JQuery + CSS?

    - by Chris McCall
    I'm adding hotkeys to a web application in order to enable keyboard shortcuts for our CSRs to use, to reduce injury and increase calls-per-hour. I'm using an ASP.net UserControl to inject javascript into the page and it's working great. I want the control to "just work", so that when hotkeys are assigned, using a declarative syntax, if the hotkeyed letter exists in the link text, it will be highlighted automatically, so the developer doesn't have to do anything, and also to maintain consistency in visual cues. Here's the code to assign hotkeys, if it matters: <uc:HotKeysControl ID="theHotkeys" runat="server" Visible="true"> <uc:HotKey ControlName="AccStatus$btnInvoiceEverBill" KeyCode="ctrl+v" /> <uc:HotKey ControlName="AccStatus$btnRefund" KeyCode="ctrl+u" /> <uc:HotKey ControlName="thirdControl" KeyCode="ctrl+p" /> </uc:HotKeysControl> I want something like: <a href="whatever" name="thirdControl">Make a <span class=hotkey">P</span>ayment</a> ...but I'm not married to the idea of injecting a <span/> in there if there's a better way. How can I do this in CSS or JQuery? Is there a way to pass in a letter to a CSS style and have it change the color of the text displayed? Should I generate javascript to highlight the text when the page loads? What would/did you do in this situation?

    Read the article

  • Windows user control hosted in IE is not working.

    - by kumar
    Hi i have hosted a windows user control in IE. Every thing is working fine, if i open the application in the same machine where the Web application is hoste. if i access the same appication from a remote client IE, A blank box is coming with a small image in the corner. I have added the site as trusted site in the IE and made all the security settings needed. let me know, what am i doing wrong. Thanking you.

    Read the article

  • How can I fix "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the conte

    - by slolife
    I have a user control (ascx) that I have added two public properties to: RequestTypeId and GroupId. Both have the attribute set. In my aspx page, I have a ListView, and in the ItemTemplate, I place my control reference, like so: <ctrl:ServiceTypeGroup runat="server" RequestTypeId="<%#RequestType.RequestTypeId%>" GroupId='<%#Eval("Id").ToString()%>' /> Setting the RequestTypeId works fine. Setting the GroupId fails with the following error: "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control." What do I need to do to my user control code to allow binding a Eval() expression to one of its properties? Or is it not possible?

    Read the article

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