I've got an odd situation with a text box and an autocomplete setup on my page. I'm using a JQuery based autocomplete on a text box that has AutoPostBack="True". This works perfect if I use the keyboard to select an autocomplete item, which then fires Jquery to fill in the text box, and then when I tab out of the box the AutoPostBack fires. If, however, I click on an autocomplete item, my text box loses focus first and the AutoPostBack fires before the Jquery has a chance to change the text in my text box. Is there a way to delay either the PostBack or the Jquery so that they don't fight each other? I'm thinking it may have to be the PostBack that gets changed, since the JQuery would lose it's state on the PostBack. Any suggestions?
Why not remove the ASP.NET autopostback functionality and implement it in JQuery to invoke the post back if/when you want it to post back?
Related
I have put several controls into an UpdatePanel. When I press the button inside the update panel there's no progress bar on the bottom status bar and there's no typical click sound that occurs during a normal postback. But the page still flickers to the top and I cannot see the validation errors. Could it be because I have a DataGrid on the update panel. I heard DataGrid and Updatepanel don't work well together.
Are you using any validation controls? I tend to add Validation controls but forget to assign the ErrorMessage text which often cuases me ponder why something isn't working.
I have a radiobutton list and three placeholders in my page, out of which the radiobutton list,first and third placeholder are within updatepanel, second placeholder is not within updatepanel.
When radiobutton list selectionindex is changed, I want all three placeholders invisible. Placeholder2.visible=false code executes but still Placeholder2 is visible.
How to resolve this.
Thanks,
Viknesh.A
You should put all your placeholders in update panel on reload the page when the radio button hits (full post back) by setting AutoPostBack="true"
You should understand that by default changin radio button on a client only affects client html, so you need to pass that info to server.
Another option is to have client onclick for radiobutton and write your custom javascript function to hide your second placeholder, but don't forget to manage that situation on the server as well, when postback (either ajax or not) will occur.
Move Placeholder2 inside the UpdatePanel.
Or don't use an UpdatePanel at all.
Or use JavaScript to hide it, instead of server-side code.
I have a text box which I have extended with the AJAX Control Toolkit CalendarExtender. When I click on the text box, a calendar appears and I can select a date which then is added to the text box. So far so good.
This text box is used on a Grid View to filter the results in it. This was setup when I added a data source to the grid view.
This works fine other than the fact that after selecting the date in the date control, I then also have to hit enter in the text box for the grid view to update. Can I get to update as soon as the date is selected rather than having to press enter?
This is because the TextBox_TextChanged event is not being raised. This can only be raised when focus is taken off the textbox, and since focus was put on it, the text has changed.
One option would be to use jQuery to force a postback whenever text is changed in the textbox.
Something like:
$("input.textbox").change(function(){
__doPostBack();
});
This article may be of use for forcing Post Back from javascript:
http://weblogs.asp.net/yousefjadallah/archive/2010/06/27/insure-that-dopostback-function-implemented-on-the-page.aspx
If you want to refresh your grid without pressing the Enter key,
put your textbox's autopostback property to true.
Hope this helps.
I had a page with 3 update panels... based on textbox changes in updatepanel1, updates the modes of other panels before they click the submit button.
The problem is I created onblur events for the textboxes...once there is a postback everything works fine. But there is one worst case scenario where the user changes the textbox and uses the mouse scroll bar and clicks the submit button. In this case (as onblur event never occurs) I could not able to update the second and third update panels.
One solution I thought was, onclicking the submit button, I was trying to check the previous mode but this will not be possible for my case because of the design issues
You could always attach a Javascript event to the scrollbar to trigger the update as well.
Pseudocode:
window.onscroll:
if contents of textbox have changed:
do postback
else
do nothing
I have an ajax control toolkit modal popup on my page and in that modal popup i have a gridview on which user select some item through checkbox on each row of gridview. Whenever user check or uncheck on checkbox my modal popup automatically hide. I have set autopost property of checkbox set to true becuase im perporfing some calculation on each checkchanged event. what may be the problem
Your page is posting back because of the autopostback="true" on the checkbox, thus hiding the modal popup.
Look up 'ASP.Net Page Lifecycle' for further understandinf. It is important to know how this works.
I'm sure you'd also like to know how to solve this.
You could:
Set AutoWireUp=false on the page, but then you'd have to wire all events on the page manually. Since you aren't familiar with the Page Lifecycle, I'm not sure how successful you'd be.
Use a javascript-only modal popup.
Perhaps an UpdatePanel can be used.