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?
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 used asp.net server side control to display and modify data in database, the control is just like this one:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx
what I want to do is after I click the "edit" button it will display a "edit" ui, and I want everytime I modify the data in the text box, asp.net will automatically click the "update" button for me to update the data i entered.
I tried to call the event handler, but failed.
There is a update command in asp.net, and how to programmatically call it ?
Try this. You can get the event refernce via this code
string postbackEvent = this.ClientScript.GetPostBackEventReference(this.button,"");
the postbackEvent will contains a __doPostback() function, which will invoke the button click in the server side. Assign this to some event, like onBlur of textbox.
this.txtSample.Attributes.Add("onBlur",postbackEvent);
Probably you will have to use the onTextChanged event of your TextBox control.
Set the autopostback attribute to "true"
<asp:TextBox AutoPostBack="True" ID="somethingID" OnTextChanged="CallSomeMethod" />
Look here : http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.autopostback.aspx
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?