I'm using jQuery Mobile 1.1 and .NET 3.5 WebForms. I've got a few dropdowns that I populate with choices in the Page_Load after checking !Page.IsPostBack. When using JQM, the UpdatePanel with these dropdowns comes back with all of the dropdowns empty. I feel like this is something with ViewState because it's all of the controls that were previously filled by the code. The dropdowns that are filled out in the ascx don't have the same problem.
The only thing in my mobileinit is:
$.mobile.ajaxEnabled = false;
jQuery Mobile, asp.net web forms and update panels simply don't work with one another:
JQueryMobile dialog shows twice because of a postback
You may also be having issues related to the select menu not refreshing when changes occur within the update pannel. Consider manually refreshing that:
$("#mySelectMenu").selectmenu("refresh");
Related
Ever since I have installed JQuery mobile on my Rails 4 application, every view is now formatted by JQuery mobile. I would like to only apply JQuery mobile to one view and not the entire application. At this point Foundation is overlapping with JQuery mobile's formatting. Some textboxes are even being rendered twice. Also when validation of the textboxes fails, the page renders with another set of textboxes and Signup buttons embedded within the old ones.
I simply ended up uninstalling the jquery mobile gem and did a generic install. This seems to have worked. Still don't know exactly what happened.
I'm using jQuery Dilog Modal in ASP.NET page but when the page do postback the button that open the dialog modal loses the jQuery behavior...
I tested the button inside and outside of UpdatePanel, but I got the same error...
How can I maintain the jQuery after postback?
Try wiring up your button inside pageLoad() instead of $(document).ready(), which is native to .NET and will fire on each postback.
function pageLoad(sender, args)
{
$('#button').click();
}
Beware that pageLoad() is not a permanent replacement for $(document).ready() when using ASP.NET, since they behave very differently, but in this case it just might solve your problem.
I am fairly new to mvc and I tried mvc4 when it was still in beta. I remember that when I started a new internet project, I got a popup dialog for log in and registration by default. I don't see that when I start a new project anymore, is that gone from the internet project?
I believe the popup dialog you're referring to was just the jQuery UI Dialog that the sample project used to use:
The project was built to support both a straight request to /Login and one via the jQuery UI dialog which was slimmed down to look like it was only a popup. It did this by making the Login action return a different View based on it being requested through the frame or not as detected by a value in the query string.
You can of course have this again, you'll just need to do it manually (or dig out one of the older templates) as it's no longer in the default templates.
To help you out, here's a couple of somewhat related questions that contain the sample code (ContextDependentView is one thing I remember from this template) and probably some hints on how to recreate it:
Generating a modal jQuery partial view with MVC4 does not work
ASP.NET MVC 4 and ContextDependentView
MVC4 - ContextDependentView - What does it mean?
It was removed from the Internet project templates in the final releases of MVC 4. The popup was pretty slick but I imagine there were issues/complexities they decided to eliminate by just keeping the view/page for logon and registration. In the older versions that had the pop-up they still had the view/page for logon because of how forms based authentication works. If the user is not authenticated/authorized for a web site/page MVC does a redirect to the logon page. This will not work with a JQuery popup dialog on the same page. The popup only worked if you clicked on the Logon link for the page. I am guessing that they decided since they need the view/page logon anyway to simplify things and keep it consistent by eliminating the popup dialog.
I have implemented an MVC Single Page Application (SPA) that only uses a JQuery dialog for a popping up a dialog for logon, and eliminates the need for logon page. But it required a fair amount of customization to authentication/authorization process on the server and used basic authentication on the client.
I am hoping there is someone here who had encountered and solved this problem with Telerik MVC Grid and DatePicker in IE6 (yes IE6! cant do anything as it's the browser used by the client and they are not upgrading anytime soon).
The setup is like this: A Telerik MVC grid using Ajax binding (select, add , edit, and delete). For add and edit, a popup editor is used. The editor template has a Telerik MVC DatePicker.
Telerik demo has the same setup here.Using IE6, the DatePicker disappears after selecting a date.
This code library submission was posted pretty recently on Telerik's website and it covers a workaround for disappearing DatePickers in IE6.
The code library is not available any more, but I contacted Telerik on their forum and they said this will be fixed for the next version, due in mid March.
I have a menu which is created from the database.
When the users navigate through pages the current page is highlighted with the css class.
Menu is rendered with the Html.RenderAction("Menu","Home");
Because of being datadriven menu i use the new ChildActionCache attribute which is in the ASP.NET MVC 2 Futures project to cache the menu.
This is where the problem starts, because of displaying the menu from cache "highlight current page" doesn't work anymore.
How can i fix this ?
Thanks in advance
The primary way to fix it is to stop caching the menu. :-P
Alternatively, don't indicate the current page from the server, but do it instead with some jQuery goodness on the client-side; that way the server can still cache the menu, and the client would change the appearance of the link on the menu to the current page.
Of course, that second solution would not work on browsers without JS enabled, but IMO that's a fair trade off.
I came up with this solution yesterday.
$("#nav-side,#nav-footer").find("a[href='" + window.location.pathname + "']").each(function () {
$(this).addClass("current");
});