Links postbacks to the same page? - telerik

I have multiple links on my page, when i click on any link, it first loads the same page using get or post and then go to the clicked url. I want to avoid the postback to the same url, what can be done?
Note, My application uses Telerik controls.

This is completely going to depend on which Telerik controls you are using but the general rule of thumb would be to use the OnClientClicking (see Telerik Documentation) using set_cancel(true); to prevent a postback.
If your links aren't telerik controls you could use javascript or JQuery (if being used) to cancel the postback using the onclick event and return false; to cancel the postback.

Related

using client side validation with telerik controls

Can you use client side validation with telerik controls? The examples show validation using standard html input controls. I have forms with RadTextBoxes, RadComboboxes etc and would like to add validation.
You can access the Telerik client-side api by using
var ctrl = $find('<%= txtSomeTextBox.ClientID %>');
then you can get the current value of the textbox by calling the .get_value() function. Use your browser's debug tool to see which methods are available in the object that is returned or consult Telerik's help site.
Go to Telerik's online demos: http://demos.telerik.com/aspnet-ajax/input/examples/common/validation/defaultcs.aspx and you will find examples for almost anything. This one shows how to use the built-in client-side validation with the RadControls for ASP.NET AJAX.

MVC Webgrid Paging and Sorting Stops Working After Ajax Calls

I have created an MVC application that uses webgrids to display data on my views. In my grid's toolbar I have drop downs, text boxes and a search button that call Jquery to perform various actions. For example, if I click the search button, I refresh the grid via Ajax based on a text entry. This all works well until interaction with the webgrid (page or sort) occurs. We noticed that if any ajax calls are made, then the sorting and paging do not work anymore. Also, if I load the page and page or sort first, then none of my JavaScript works. I have been researching this issue, but have not seen any concrete solutions. Does anyone have recommendations for a solution?
I would wager to guess that you are attaching your jquery handlers in the document.ready function using something like $("#Sort").click(function(){});. When you reload the grid via an AJAX call, the jquery handlers are not reattached since the DOM was not reloaded. Try using something like this $("#Sort").live('click', function(){}); which will attach the handler to any instance of your identifier once it is present on the page.
This is was a complete guess since you posted no code, but this and the post you referenced above (SO post) seems to have fixed your issue.

Asp.net MVC Ajax - Disabling button in ajax.beginform?

I'm using microsoft ajax and ajax.beginform.
It's working great for model binding my partial view, but I need to conditionally disable some of the buttons in my form itself depending on what comes back from the server.
How can I go about this without using JQuery?
Have you thought instead about using two separate views instead, and have your conditional logic in your controller determine which view to display.

Is it possible to show an overlay when a form is submitted (not via Ajax)?

A bit of background: I am using asp .net MVC and I am not allowed to asynchrounously submit the form using JQuery. When the user submits the form it takes a few seconds for the save to happen and then a message is displayed to them. In this time the client wants to show an overlay with an image and a processing label. I was using BlockUI (Jquery plugin) for all overlays but it wont work since I am not posting the form via ajax.
Any ideas on how to show an overlay is much appreciated.
TIA.
Regards,
Raja
You can tie a overlay to the button click, because you are not using AJAX the form submission will reload the page.
Also, blockUI should not require AJAX.
$('.button').click(function() {
$.blockUI();
});
Since u are using MVC, am not sure if u are using webforms or controllers.
Please try this,
For webforms, u can use OnClientClick to call a javascript to show the div that has the processing gif image.
For controller pattern, in onclick event handler before the form is submitted, use javascript/jquery to show the div that has the processing gif image.

facebook wall-like ajax in yii's zii widget list

I'm very new to yii, and I'm trying to integrate the facebook-wall-like style into my post list.
In short, I just want to add a "Load More" with ajax to load more posts at the bottom of the post list.
I know how to write ajax or html, but I don't know how to integrate this style into yii.
I'v tried the zii.widgets.CListView/CDetailView.. but I can't find ways to add ajax.
If there's anyone who knows the how-to, please share it with me.
Thanks!
Take a look at this extension, it is a pager that adds infinite scroll like in twitter - when you get to the bottom of the page it loads more content via ajax. If you prefer to load more only once a button is pressed, i'm sure it's just a matter of overriding the button's onclick event.

Resources