I am using VB for coding. I want to disable postback when user presses enter when writing in a textbox...instead cursor should move to a new line...how do I do that
Did you set the TextBox.TextMode property to MultiLine?
Related
I want to make an ASP.NET multilined TextBox to trigger the button1_Click() event instead of going newline when ENTER key is pressed. Note that this button is not in a form tag.
Do it with onkeypress and check it if it was enter do button1_performclick().that will do the job for you
You will have to track onkeypress of TextBox and check it if key pressed was enter or not, If entered was pressed then perform __dopostback which will postback your form and on page_load check for its arguments. For more information on __dopostback Go here
Please give peace of advice. I have login form. Login and password textboxes, and button 'enter'. Button disabled if textboxes are empty. So I've made client side event that makes button enable. Event TextChaged for both textboxes. But after entering to application users login and password wrote to cookies. When I entering the next time, I past the login name into the first box, password appears automatically. And 'enter' button still disabled. Does exist some event that occurs after cookies was paste?
ps: used devexpress textboxes
When you enter Login details second time, your textchange event should ideally have fired! and 'Enter' button should have been enabled. Are you sure its all working fine?
Alternatively, here is what you can do:
onblur event of the textbox, check the length of both the text boxes (Login & Password). If length is greater than zero for both textboxes, enable the Enter Button.
Hope it helps.
I have the following situation:
I coded a aspx app c#, the user has 4 dropdownlists, one textbox and two buttons (cancel, save) in a page. I need the user to be remembered to save any changes to the textbox before allowing him to change the index of any dropdownlist. So, if the user changes the textbox value, he only have the option to cancel or save those chhanges. If he tries to do something else, like changing the index of a dropdownlist, I need to cancel this event and give him a message to save or cancel before do this.
I've tried many ways, but they all seem amatours to me and give lots of colateral efects. Is there any decent/elegant way to do this?
Create a custom validator for the TextBox. In the DropDownList's SelectedIndexChanged event handlers check the status of the TextBox and set the validator's args.IsValid property appropriately - you can notify the user via the TextBox CustomValidator ErrorMessage property to click Save if the value of the TextBox has changed.
I have a textbox and a button with an onClick event connected to it, and when the button is clicked once I want to change the text of the button and clear the textbox. How can i accomplish this?
If you want to do this on a postback (a complete refresh of the page), simply put code in your button click handler to set these values. For example, textbox.Text = string.Empty;
If you want to set it on the client side (without refreshing the page), then you'd need to use client script such as JavaScript.
This needs you to know about TextBox and its properties. Normally the value of a textbox you use its Text property as TextBox1.Text. In your case you put this statement in the button's click event
string txtValue=TextBox1.Text;
TextBox1.Text=string.Empty;
To see how to use TextBox and its properties. This can help
i have a user name, password and a calendar button which when click, a calendar appear and insert the date selected into the date textbox field, and a submit button.
After, i key in value for user name and password and click on the calendar button, the password textbox field because empty. So how can i going to stop the password textbox field to become empty when i click i the calendar button??
i set visible calendar only when click on the button
<asp:Calendar ID="Calendar1" runat="server" Visible="False"></asp:Calendar>
is there a way?
For security reasons, ASP.Net clears a password textbox before sending it to the client. This happens for instance on a postback, after the click on that calendar has been processed.
Sounds like you are clearing it on postback in the codebehind. What does your PageLoad code look like?