w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
DotNetNuke User control not working .it shows data from .resource file in Portal>0>cache>pages.Not able to debug User control
I have a series of DNN tutorials that I started on recently (I wrote a majority of the old ones on dotnetnuke.com) that talk through the process of setting up your development environment, and then using the Visual Studio Templates that I have created/released (open source). I would encourage anyone trying to really do any development with DotNetNuke to check those out. http://www.christoc.com/tutorials

Categories : C#

Open User Control from user control in main window grid WPF
This is just a guess as you've not provided much information, but I noticed the following issue which may be the culprit. In your first code snippet, you seem to be creating the employee from the MainForm: Dim Empl As New Employee MainGrid.Children.Add(Empl) Grid.SetRow(Empl, 1) Your following comment would seem to confirm that assumption: This is from Window_Loaded event. Menu is User Control, and there I have few buttons to open and operate another user controls. When I press for example button "Question" And yet, in your Employee class, you are creating a brand new instance of MainWindow and then adding data to it: Public Class Employee Dim mw As New MainWindow Private Sub btnQuestionAdd_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles btnQu

Categories : Wpf

Losing styles when adding a User Control to a User Control
In general it is good practice to keep your styles separate from the markup. This makes maintenance easier and it also saves yourself from searching for the reason one of your elements appears a pixel away from where you are expecting (for example... Similar issues can be exasperating). Do you have the same issue if you set the CssClass attribute for your button(s) and set the styles in a css file for the class?

Categories : C#

WPF user control bind data to user control property
You can try Element binding inside the user control. Just give a name to UserControl and bind property: <UserControl x:Class="controlmaker.checkButton" 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" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="114" d:DesignWidth="221" x:Name="MyUserControl"> <Grid Background="Aqua" > <CheckBox Content="CheckBox" Height="16" HorizontalAlignment="Left" Margin="58,24,0,0" Name="checkBox1" VerticalAlignment="Top" /> <Button Content="{Binding Path=buttText, ElementName=MyUserC

Categories : Wpf

Button sizes changing on user control when control is added to window
You have don't have your LastChildFill property set to False on your top DockPanel. This is the reason "Ent" is changing size and moving your screen. You also have the HorizontalAlignment on "Del" set to stretch. Try setting that to Left, but might be moot with the LastChildFill correction. The overall resizing is do to HorizontalAlignment set to Stretch set that to Left.

Categories : Wpf

FlowLayout Control With User Control Item Template Not Binding
Try: public UserControl2() { InitializeComponent(); Loaded += (sender, args) => { var obj = (ViewMod)this.DataContext; if (obj == null || obj.Prop == null) return; var d = obj.Prop; if (d == null) return; grd2.Children.Add(new TextBlock { Text = d.Name }); }; } DataContext is not set instantly. Hence we use the Loaded event and add a lambda to it to do your corresponding steps. side-note: even-though this works, please do search and look at some MVVM examples. While having no code-behind is not really an MVVM requirement, I think your taking it a bit too far adding Grid children and stuff from code-behind when you can do it perfectly fine from xaml.

Categories : C#

How can I bind a parent control's TextBox from inside a user control
You can declare the DataContext property of the <TextBlockControl /> as the Text property of the "editor" <TextBox />: <wpfSandbox:TextBlockControl DataContext="{Binding Text, ElementName=editor}" /> and inside your control: <Grid> <TextBlock Text="{Binding}" /> </Grid>

Categories : Wpf

How to make binding from user control to property of parent control?
ElementName binding works within in same XAML scope. This will work - <Grid> <CheckBox Name="checkBox1"/> <Label Content="{Binding ElementName=checkBox1, Path=Name}"/> </Grid> But if you want to do it in different UserControl, you have to tweak a bit your code and use Tag to hold name - <Grid> <CheckBox Name="checkBox1"> <local:UserControl1 Tag="{Binding ElementName=checkBox1, Path=Name}"/> </CheckBox> </Grid> UserControl.xaml <Canvas> <Label Content="{Binding Path=Tag, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}"/> </Canvas> On a sidenote, in your UserControl, you know you need to bind with ElementName = checkBox1 and that's

Categories : Wpf

How to access the main page control values in user control
To retrieve, for example, a textbox defined in the aspx page from an ascx control contained in it you could try: Dim myTextBox As TextBox = Ctype(Me.Parent.FindControl("myTextBoxName"), TextBox) Note that the control you want to retrieve must have a runat="server" attribute otherwise it can not be seen server side. In your question you posted three controls without runat="server"; you could use instead: <asp:HiddenField ID="HiddenField1" runat="server" Value="1" /> <asp:HiddenField ID="HiddenField2" runat="server" Value="2" /> <asp:HiddenField ID="HiddenField3" runat="server" Value="3" /> In this case the above command would become: Dim myHiddenField As HiddenField = Ctype(Me.Parent.FindControl("myHiddenFieldName"), HiddenField)

Categories : Asp Net

Access Parent Page Control in Child User Control
You will have something like this in tab control. <cc1:TabContainer ID="TabContainer1" runat="server"> <cc1:TabPanel ID="TabPanel1" runat="server"> <ContentTemplate> <asp:DropDownList id="dropdownlist1" runat="Server"/> </ContentTemplate> </cc1:TabPanel> So first you need to find tabPanel1 then find dropdownlist1 like following. TabContainer TabContainer1= (TabContainer)(this.Page.FindControl("TabContainer1"); if (TabContainer1!=null){ TabPanel TabPanel1= (TabPanel)(this.TabContainer1.FindControl("TabPanel1"); if(TabPanel1 !=null){ DropDownList dropdownlist1= (DropDownList)(this.TabPanel1.FindControl("dropdownlist1"); }}

Categories : C#

How to pass data from user control to main control in wpf
You can set the DataContext(viewmodel) of the user control same as that of Main Window. Keep a property in viewModel and Bind that Property in the user control. So whenever anything changes in the Control that property will automatically be updated in the View Model which can be used by the Main

Categories : Wpf

Can we control speed of value updating in a WPF user control
Create a buffer between the control and the fast changing data source. You could create a buffer by making a class with a property that will keep track of when the last update to its property was made and only when it is more than 500 ms ago will update the property. private int _stockRate; private long _lastUpdate = 0; public int StockRate { get { return _stockRate; } set { long now = getTimeInMilliseconds(); // Stopwatch or other timer if(now - _lastUpdate > 500ms) { _stockRate = value; _lastUpdate = now; OnPropertyChanged("StockRate"); } } }

Categories : Wpf

can't use a user control
Try adding the assembly in the namespace declaration attribute "xmlns:local="clr-namespace:Project1;assembly=%Name of the Assembly%" i.e. (Presentation.Infrastructure) where Presentation is the project name, and Infrastructure is the folder where the control lives. –

Categories : C#

WPF User Control Resources
I think you're trying to redefine the ResourceDictionary that you've created when setting up your custom control. You've already created the resource dictionary for use with the control, and you're then attempting to create it again (hence the re-initialize exception). You could move your styling for the DataGridCell into the main template (which you wouldn't want to do in your case, because of your EvenSetter, which is presumably instance specific). A better solution for you may be to define that style in another ResourceDictionary and reference it, or add the Style to the resources for the Window/Page where you're using the custom control (e.g. you could add it to the resources of a parent Grid). I believe you can also merge resource dictionaries, although I've never tried it: http://

Categories : C#

Get User Control Variable
You have already had a uc in your form class, but you defined a new uc (local variable) in the btnSaveToPath_Click handler which of course has the initial FolderPath property as empty. private void btnSaveToPath_Click(object sender, EventArgs e) { MessageBox.Show(uc.FolderPath); //NOT blank MessageBox.Show(uc.folderBrowserDialog1.SelectedPath); //NOT blank } UPDATE You don't have any code to fire the custom event in your UserControl: public partial class FolderSelectDDL : UserControl { public delegate void ButtonClickedEventHandler(object sender, EventArgs e); public static event ButtonClickedEventHandler OnUserControlButtonClicked; private string folderPath; public string FolderPath { get { return folderPath; } set { folderPath = value; } } public Fold

Categories : C#

Best way to do the runtime UI changes on User Control?
If your senior cannot backup his/her claims.. then he/she isn't really someone you should try learning from. I'm not sure what the "memory issue" is that he/she is referring to, however it's hard to tell with your stripped down code. That being said, I would reconsider databinding in a property set purely because you open yourself up to "gotcha's" later down the track when people start setting this property. Instead, I would have a Refresh() method. Therefore, the calling code would be: UserControl.Property = value; UserControl.RefreshData(); This gives the calling API the option of refreshing at that point or deferring the decision.

Categories : C#

MVC 4 Razor user control
I would be more inclined to use a partial view which you could place in the shared views folder then call passing the model you wish to render with that view: @Html.Partial("propertySummary", property) Just a thought

Categories : C#

How do you add a user control after creating it?
Adding a user control to window after creating it: Step1: Adding reference to the window in xaml: xmlns:Views="clr-namespace:WpfApplicationName.Views" Step2: Adding the view to grid/stackpanel/wrappanel <Grid> <Views:UsercontrolName/> </Grid> Add this and once build your project. You usercontrol will be loaded into the window. Hope this helps you.

Categories : C#

Generic user control in ASP.NET?
If these properties and methods are all leverage by user controls then how about this: public abstract class MyBaseUserControl : UserControl { // shared properties and methods } and then when building your user controls: public class YourUserControl : MyBaseUserControl The MyBaseUserControl can reside in a basic .cs file somewhere in the assembly. Further, the only reason I listed the MyBaseUserControl as abstract is because it's strictly built to be inherited from.

Categories : C#

WPF MVVM User Control
instead of using dependency properties you can go an easy way when your customer object also has the address property <AdressView> <TextBlock Text="{Binding Path=MyAddress.Name}" /> <TextBlock Text="{Binding Path=MyAddress.Street}" /> mainwindow <ComboBox X:Name=cbo .../> <local:AddressView DataContext="{Binding ElementName=cbo, Path=SelectedItem}"/> customer.cs public Address MyAddress {get;set;} if you want your dependency property stuff to work, you have to post the code for your addressview, so that we can check the bindings to the dependency properties and you have to give some information how you wanna get the address with your customerid.

Categories : Wpf

Passing a value from one user control to other
I would add a method on the user control you need to pass data to. Then you can call that method from the container and pass in the value. Another approach is to put the value in session or viewstate.

Categories : Asp Net

asp.net gridview user control
Putting the grid view into a user control will lock you off from making <Columns> definitions in your markup where you include your user control, because the grid view definition is not accessible via properties of the user control. From the description of the changes you made that you want to reuse elsewhere, it seems to me that you are better off creating a CSS class that can be applied to all grid views in your application instead of a user control. As for the paging logic, you can have that be in a utility class that all grid views in your application can call to do their paging, if the paging logic is generic enough. The bottom line is you have locked the structure of your grid view by putting it into a user control, because there is no mechanism to alter the structure. You c

Categories : Asp Net

CakePHP user control
I think you’ve gone about this the wrong way. Ideally, you should have a users table and a corresponding User model, and then use ACL to determine what a user can and can’t do. You can create roles for clients and employees, and set permissions on these groups, and assign each user to a group. If you have client- and employee-specific data you wish to store, then you can always create these tables/models and set them to belong to a User.

Categories : PHP

asp.net user control deployment
No, you either cut and paste or look into using custom Server Controls. The custom server controls are basically a way of building the same .ascx style controls but doing it all in code without a UI portion. If done correctly, you can still have a UI drag and drop interface for your controls. http://msdn.microsoft.com/en-us/library/zt27tfhy(v=vs.100).aspx

Categories : Asp Net

WPF User control in Silverlight 4.0
Basically, Silverlight supports a sub-set of code available to WPF developers. Rather than go into all the details here, I would instead advise you to read the answers provided to a similar posted question and preferably search the existing posts before you ask already asked questions: WPF vs Silverlight

Categories : Wpf

c# DataBinding in User control Win8
i've solved my question.. So, i created a DependencyProperty on code behind of my User Control, named selection, and i put this in Text of my text box.. after, when i will using my user control, in my main page, i passed the value in for porperty.. Like this: User Control public sealed partial class UCNotes : UserControl { public string selection { get { return (string)GetValue(selectionProperty); } set { SetValue(selectionProperty, value); } } public static readonly DependencyProperty selecionadoProperty = DependencyProperty.Register("selection", typeof(string), typeof(UCNotes), new PropertyMetadata(null)); User Control XAML <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.micros

Categories : C#

Export excel from user control
the VerifyRenderingInServerForm is method of Page class, so you need to add this to the page containing the UserControl public override void VerifyRenderingInServerForm(Control control) { /* Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time. */ }

Categories : C#

User control needs different resx file
This is not exctly what you need: ResourceManager manager = new ResourceManager("Resources.Messages", Assembly.Load("App_GlobalResources")); string test = manager.GetString("EmailBodyMagazine",new System.Globalization.CultureInfo("fr-CA");); But maybe you can also use the resource manager to access your files directly

Categories : Misc

RangeValidator not working in web user control
The / has a special meaning in a date format string. It means: "replace me with your curent culture's date separator". In germany for example it is .. MSDN The "/" custom format specifier represents the date separator, which is used to differentiate years, months, and days. The appropriate localized date separator is retrieved from the DateTimeFormatInfoDateSeparator property of the current or specified culture. ... I think the only way is using a CustomValidator to check this format. Then you can parse the date in this way(on serverside): DateTime dt; if(DateTime.TryParseExact(txtDate, "MM/dd/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt)) { // now there is a valid date in dt } Notice the CultureInfo.InvariantCulture which i have used to enforce th

Categories : Asp Net

A mandatory label user control in C#
You have two options - a custom label control or a user control that contains the label and the * based on a Mandatory property. If you have an explicit need to make the "*" red (seems to be the case per your q), you will need to use the user control. This is slightly heavier, so I would recommend rethinking that requirement. Here's how the custom label control would look: public class CustomLabel : Label { public CustomLabel() { } public bool Mandatory { get; set; } public override String Text { get { return base.Text + " *"; } } } You would now use the CustomLabel instead of the Label.

Categories : C#

replace user control in grid
You have the names wrong - in the xaml you call them Control1Visibility and Control2Visibility, but in the ViewModel, you are calling them UserControl1Visibility and UserControl2Visibility. Change the names in one or the other, and make sure the PropertyChanged events are raised with the appropriate string.

Categories : Wpf

Dependency Property From User Control - WPF
Remember, {Binding} will default wise always take the DataContext as the source of the property. Thats why your code isn't working, NewContent is not a property in your ViewModel. You want to change the source of your binding, to your UserControl, this is one way to do it: <UserControl x:Class="WpfApplication2.UserControl1" 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" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" x:Name="myControl"> <Grid> &l

Categories : Wpf

Asp.NET user control date validation
I think you are trying to do something like this. Parent <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Parent.ascx.cs" Inherits="StackOverFlow.Parent" %> <table> <tr> <td>Parent Start Date </td> <td> <asp:TextBox runat="server" ID="txtStartDate" /> </td> </tr> <tr> <td>Parent End Date </td> <td> <asp:TextBox runat="server" ID="txtEndDate" /> </td> </tr> </table> Child <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Child.ascx.cs" Inherits="StackOverFlow.Child" %> <table> <tr> <td>Child Start Date </td> <td>

Categories : Asp Net

confused using Jquery in Asp.net (User control)
You should try out the Block UI Plugin Here is a jsfiddle on how it works So all you have to do is add a reference to the block ui script in your code. On click of your search button just call: $.blockUI({ message: '<div class="loading"><img src="../images/Loading/466.gif" title="Cargando" alt="Cargando" class="Load" /></div>' }); The above code will block all functions on your screen and show your custom message(which in this case is the html that you passed to the plugin) After your search returns a result you should do: $.unblockUI(); This will remove the loading image and the user can again interact with your page.

Categories : Jquery

How to pass value from page to User Control?
Say for you store the login name in a LABEL somewhere on the main page. Like this: lblLogin.Text = "LoginName"; Now, on the user control you have another LABEL called lblWCLogin where you want to assign the login name from Parent page. Do something like this: Label lblTextFromParentPageLabel = this.Parent.FindControl("lblLogin"); lblWCLogin = lblTextFromParentPageLabel.Text; Another Approach (does not matter if you have a MasterPage or not) is to Use Sessions. Set session on you Page or MasterPage code behind. Like this: Session["LoginName"] = "Some User Name"; Retrive the session value on UserControl like this: string login_name = (string)(Session["LoginName"]); Label1.Text = login_name;

Categories : C#

remove a user control in repeater
You need to add CommandArgument to your button like CommandArgument="<%# Container.ItemIndex %>". This way, in the code; e.CommandArgument gives you the item number, with which you can get the item that you want. Note: In fact instead of specifying ItemIndex as CommandArgument, you can use any Primary Key (Unique Identifier) from the DataSource that you bind to the repeater from where you will be able to get hold of the record directly from the list object (DataSource).

Categories : C#

How can I wrap my user control in code behind?
Try using a PlaceHolder. A PlaceHolder does not load a container element. Assume that the Placeholder is called plcTest: UserControl userControl = Page.LoadControl("~/Controls/userControl.ascx"); plcTest.Controls.Add(userControl); Frontend code would look like this: <li><asp:PlaceHolder ID="plcTest" runat="server" ></asp:PlaceHolder></li>

Categories : C#

Windows User control form
If I understand your problem correctly, check your anchor points of the controls on your form. Also, check that form controls are set to grow and shrink, as you see fit. The combination of the two may fix your problem.

Categories : Windows

How to set focus on an element of a user control?
Focus in WPF is a complex topic. I think you'll find that the proper way to do what you want is to use FocusManager in your XAML: <UserControl ... FocusManager.FocusedElement="{Binding ElementName=myTextBox}"> <TextBox x:Name="myTextBox" /> </UserControl> If you use FocusManager like this to establish all focus requirements (that is, you use FocusManager on all Windows and UserControls that have any sort of focus requirements), then you'll probably find that all the focusing works exactly like you expect.

Categories : C#

How to run some code when a user control is at first showing in WPF
There is another event that you can attach to the TabControl instead of the actual tab. Using the SelectionChanged event you can gain access to both the tabs removed (hidden) and the tabs shown (active). You will then need to add a flag in your class to check if the tab has already been shown. Something like this should work. readonly List<string> shownTabs; public MainWindow() { InitializeComponent(); this.shownTabs = new List<string>(); this.tabCtrl.SelectionChanged += tabCtrl_SelectionChanged; } void tabCtrl_SelectionChanged(object sender, SelectionChangedEventArgs e) { if(e.AddedItems.Count == 0) return; var tabItem = e.AddedItems[0] as TabItem;

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.