textbox

How to know the data type of value entered by user at runtime in textbox?

徘徊边缘 提交于 2019-12-13 02:22:45
问题 How to know the data type of value entered by user at runtime in textbox? My simple example: I've tried it by using GetType() , but it was useless, it always shows System.String , whether I enter int or String . 回答1: If the user has typed text into a textbox, that's always a string. It's never an int. You can parse the text as an integer, but the input itself is still text. You could speculatively try to parse it in different ways: int intValue; if (int.TryParse(text, out intValue) { ... use

How to disable HTML tag validation on a specific TextBox?

主宰稳场 提交于 2019-12-13 02:05:39
问题 I have a form where one of the fields would allow entry of HTML tags. <asp:TextBox ID="someID" runat="server" TextMode="MultiLine" /> In this field I have a RequiredFieldValidator validation only. Unfortunately, after any PostBack if the content of any of the fields includes HTML tags or any other potentially dangerous code - the entire ViewState is cleaned. Setting ValidateRequest to false does not help. I'm using IIS 7.5 and .NET 4.0. Any ideas? 回答1: You also need to set the <system.web>

Use SHIFT + ENTER for multiline textbox in UWP

天涯浪子 提交于 2019-12-13 01:46:58
问题 I would like to adjust the behavior of a TextBox , so that SHIFT + ENTER on the keyboard inserts a new line, while just ENTER executes a different command (such as changing focus or pressing "send" like in messaging apps). By default, the AcceptsReturn property of the TextBox being set to true inserts a new line when ENTER is pressed. Changing AcceptsReturn to false seems to prevent the new line from working at all, even if I manually add the new line: private void ContentTextBox_KeyUp(object

textbox must not be empty if checkbox is ticked

半世苍凉 提交于 2019-12-13 01:29:55
问题 I have three checkboxes. Each checkbox has a 'name' and 'age' text box next to them. 'Singles' checkbox box has one set of these textboxes while 'Couples' checkbox has two sets. I'm looking for code which will provide an 'alert' message prior to submitting a form to say all textboxes must be filled in if corresponding checkbox is ticked. For instance, if only 'Singles' checkbox is ticked, only 'Singles' Textboxes to be checked. If 'Singles' and 'Couples' Checked, Textboxes for 'Singles' and

Enable and disable textbox if checkbox is checked

别来无恙 提交于 2019-12-13 01:24:31
问题 I read this article as suggested by an answer for a similar question. I did everything the article said, but the end result wasn't what I wanted. I want the text box to be disabled by default. When the checkbox is checked, the textbox is enabled. What happened was that the textbox is enabled by default, and when the checkbox is checked, the textbox is disabled. Here is my code: <td class="trow2"> {$prefixselect}<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="

Gwt getCellForEvent flexTable

倾然丶 夕夏残阳落幕 提交于 2019-12-13 01:12:56
问题 I`m trying to add addValueChangeHandler function to a TextBox inside a flexTable. But when I add this code: int rowIndex = tableImages.getCellForEvent(event).getRowIndex(); I use this method to know the current row in case of a ClickEvent. the method is not acceptable for ValueChangeEvent, so how can I know what is the row Index for the changed cell? Thank you. 回答1: Well yes, because it needs a Cell itself, not a TextBox or event value. What you can do, is: Get the event Source via event

Click item in listbox and View details in multiline textbox

社会主义新天地 提交于 2019-12-13 01:08:20
问题 I would like to click on an item in a listbox and display the attributes that were passed into that listbox to a multiline textbox. Below is the code I have written on form initialisation public Form1() { InitializeComponent(); ReadFromFile.Read("sample.GED"); foreach (KeyValuePair<int, Individual> kvp in ReadFromFile.individuals) { listBox2.Items.Add("ID = " + kvp.Value.id + " Name = " + kvp.Value.name.givenName + " " + kvp.Value.name.surname + " DoB = " + kvp.Value.birth.date); } int

Unable to highlight text in textboxes in IE9

牧云@^-^@ 提交于 2019-12-13 00:59:05
问题 I have C# MVC web app that has some textboxes that in IE9 you can enter in text, but you can't highlight via the mouse or via holding shift and the arrow keys. I've looked around on the web and i've found other people experiencing this, with no solution. One site i found claimed it was an issue with IE9 on pages that make multiple AJAX calls, which my site has but, removing AJAX really isn't a solution. Is there a way via code or via settings in IE9 so that users can highlight text in a

Show missing part of text in datagrid textbox WPF

北城以北 提交于 2019-12-13 00:36:57
问题 I have one data-grid in my project, and after getting strings into it one part of them can't fit, because they are too long. I want that my text-box columns have fixed size, so I don't wanna use "auto" width property for text-box, but I was wondering: Is there some kind of property that I can use for showing whole string optionally? Like for example: If string is to long show the part of it you can fit, and after that show three dots (...) or some symbol like that. After clicking on three

How can i remove inner padding on TextBox wpf?

给你一囗甜甜゛ 提交于 2019-12-13 00:24:19
问题 I created a textbox. And there is empty place under text. In picture, Red Line. How can I remove that inner padding? 回答1: You can set negative values for padding. e.g. <TextBox Padding="-2" Width="100" Height="18"></TextBox> It will look like 来源: https://stackoverflow.com/questions/43908447/how-can-i-remove-inner-padding-on-textbox-wpf