user-controls

How to call a java script function from user controls

假如想象 提交于 2020-01-05 05:57:32
问题 This is my user control example.ascx <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="add.ascx.cs" Inherits="WebApplication3.add" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <link rel="Stylesheet" href="style.css" /> <script type="text/javascript"> function toDo() { //Do something }; </script> <asp:TextBox ID="txt_name" onkeydown="toDo()" runat="server" CssClass="input_txt"> </asp:TextBox> When i load my page and add my user

WPF: Set Size of an DataGrid in a Expander

蹲街弑〆低调 提交于 2020-01-05 05:11:34
问题 I have a TabControl which contains a StackPanel with many Expander. In each Expander I placed an UserControl. So, I have a clear view. The UserControl contains a DataGrid. Now, the problem is, that the height from the DataGrid is not set. If the DataGrid is lager than the window-size no Scrollbar is shown. <TabControl SelectionChanged="Selector_OnSelectionChanged" Height="Auto"> <TabItem Header="DoSmth"> </TabItem> <TabItem Header="Misc" Height="Auto"> <StackPanel Height="Auto"> <Expander

Bind an ObservableCollection to Lines

假如想象 提交于 2020-01-05 03:16:06
问题 I want to have a graphical part in my UserControl which will display Lines based on a collection (and update coords during runtime and also add/remove lines during runtime based on the collection). Lets assume I have a class called Class1: public class Class1 : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(PropertyChangedEventArgs e) { if (PropertyChanged != null) PropertyChanged(this, e); } private int _x1 = 0; public int X1

KeyDown event is not firing when pressing enter in an UserControl

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-04 14:16:11
问题 I have a UserControl for an application and with a textbox. When pressing enter in this textbox a button should be activated (basically pressing 'Ok' via pressing Enter instead of clicking the button manually with the mouse). So I added a KeyDown event to my textbox and implemented the following code: private void txtSearchID_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && !txtSearchID.Text.Equals(string.Empty)) { button_Click(null, null); } } But when I wanted to test

Looking for a UserControl which supports ANSI escape codes

痞子三分冷 提交于 2020-01-04 05:10:17
问题 I am looking to handle incoming telnet text that has ANSI escape codes. For the bounty I am looking for a full implementation where I can just append text to the end of a buffer. The control should be scrollable, yet still be able to handle appending text, cursor positioning, etc.. while the user is scrolled out of view. For example, "\e[0;32mHello \e[0;37mWorld" Would display a green "Hello" and a white "World" As this would need to handle cursor positioning, setting a default 80 characters

How to call a method from user control to aspx page?

亡梦爱人 提交于 2020-01-04 04:03:16
问题 I want to call a method from user control to aspx page I'm trying but I am not able to call that method in aspx page Code: AddVisaUserControl.ascx.cs public event EventHandler UserControlButtonClicked; public void OnUserControlButtonClick() { if (UserControlButtonClicked != null) { UserControlButtonClicked(this,EventArgs.Empty); } } protected void btnRemove_Click(object sender, EventArgs e) { OnUserControlButtonClick(); } .aspx Edit In the below code when the page load I am getting "null

Custom Control & Toolbox Tab

放肆的年华 提交于 2020-01-04 03:12:19
问题 I am creating a user interface and I am trying to figure out the best way to organize all of my custom controls. I already know that I can do the following: 1) If I want to have a property visible for design-time manipulation via the Properties window, I use the following... [Browsable(true)] [Description("Text for Display"), Category("Custom Properties")] public string DisplayText { get { return textDisplay.DisplayText; } set { textDisplay.DisplayText = value; } } 2) If I want to hide the

Pausing Matlab Script or Function on certain user event

浪子不回头ぞ 提交于 2020-01-04 02:11:30
问题 I know that there is the possibility of Matlab of pausing a Matlab function or script by using input() thus when I have a for-loop and want to pause it every iteration: for i = 1:N reply = input(sprintf('Pausing in iteration %d! Continue with Enter!', i), 's'); % Calculations end but how to get the following working: Usually it runs without pausing (as if the input() wouldn't be there) but when the user does something (perhaps press a key, a button, or something similar in matlab), the script

uwp should I be using user control inside a data template?

拈花ヽ惹草 提交于 2020-01-03 17:51:06
问题 in my UWP app I was thinking to extract my data template into a seperate user control , i.e: <DataTemplate><local:CustomTemplate/></DataTemplate> and the user control ( customtemplate ) will have that stackpanel or grid which was previously in my DataTemplate directly, along with its bindings, I already know how to achieve this. My Question is that by extracting out the data template in a user control, would this cause any performance hit? I read somewhere that while doing this each

Loading ASCX control created dynamically (via code)

◇◆丶佛笑我妖孽 提交于 2020-01-03 13:31:24
问题 I am creating Web User Controls via code (my C# code write-out markup, code-behind and designer files to disk on a callback). The controls are created all fine. I can add them to my web-project and put them on a page. When I try to load the control using LoadControl(path) it says: Unable to load type 'MyNameSpace.UseControlClass' which is because control is not yet compiled. But my requirement is to load controls dynamically without recompiling the solution. How can I compile the user control