Gridview editing without postback - javascript

I am using Gridview with Edit option. When i click on Edit button row becomes editable with Update & cancel button. But this process causes a postback which degrades performance in my scenario. Is there any other way available to make row editable without causing a postback(maybe using javascript)?

Asp.net has this handy feature built in. Its called an update panel and it allows you to specify part of a page to update. It uses ajax to perform a behind the scenes postback.
Here is an article on the subject by 4 Guys from Rolla which contains some code samples.

You can do this from javascript too. two options:
Using pageMethod call a method inside code behind with required parameters.
Expose a web service and set the DB update function there and call the function from javascript.
Using update panel may cause certain issues...

Related

Telerik Kendo Scheduler Selected Event Details

This is regarding Telerik Kendo (MVC) Scheduler control. When I double click any specific event, I would like to get some selective details for that event, like Description, Start Time, IsAllDay.
Not all the data. This is because I want to take all this selected data for the event and show it on a different page, where I may then perform some edit/update. I know the Kendo scheduler offers a pop-up mode to edit data but we don't need that in our application flow. That is the catch.
Is it at all possible?
I am new to Telerik Kendo MVC controls and I have no idea what or how. My knowledge on this matters is less than 7 days. The resources I searched around are mostly talking about client-side js code. The control itself is rendered through JS in those examples, as opposed to #Html.Kendo(). A scheduler in my case. It is not related to my need.
Can you give me some hints? Can you please show me how. And most importantly, is it at all possible. Could you confirm that...
Regards
I suggest using an editor template, it will substitute the default template that is displayed when you double click an event.
For this you have to:-
-Add the editable property to your scheduler control
.Editable(editable => editable.TemplateName("CustomEditorTemplate"))
-Add a partial view with the same name as TemplateName specified above.
-Add the model and html for the selective details to the partial view
-If you are allowing any edits on the popup add the data source property for Update
.Update("ActionName", "ControllerName")
This is the editor template API Reference

In Salesforce open the edit screen after the object was created with Javascript button

In Salesforce, we have a button that creates events with the fields already filled out, but after the item is created I want it to reload the screen in the "Edit" view in case they want to change anything. Any ideas?
Do you need to validate fields values? Maybe it will be easier to do with field validation rules? It can be useful in cases when your data is populated not only from user screens, but also can be created in code (classes/triggers) or via API.
If you know that you exactly should to use JavaScript, you can add standard event attributes to command buttons on your Visualforce page and write JS functions for implementation of your validation logic.
I ended up creating a visualforce page with a controller and a custom button to accomplish what I needed.

Possible to read the selection of a subgrid in CRM2011?

I'm trying to be able to retreieve the selection of a SubGrid at the exact moment a user selects it. For example, add an EventListener OnClick that would make a JS function run in the background to do X thing when a subgrid element/row is selected without having to click Save or another button to run the function. Ive been searching online and alot of links appear for retrieving ALL records in a subgrid but none really show if one can add an EventListener. Another possibility would be to intercept when a subgrid is focused on and make that run a function. What do you guys think would be possible, always trying to keep the methods the supported way. :).
If your willing to be a little creative, you could try the following:
Add a custom ribbon button.
Add an enable rule to that ribbon button that calls a JavaScript library.
Add your logic into that JavaScript library.
When a record is selected in the sub grid, CRM will refresh the ribbon and call your enable rule.
I've only just thought of that so I don't know if it will work, but worth a try.
If that fails then I don't know any other supported way to have an OnClick event.
Edit, I've had a play and it does appear to be possible, see my blog post here: CRM 2013 Adding an On Change Event to a Grid View. Its for CRM 2013, but I believe can be adapted for CRM 2011 (see my note at the end).

javascript or ajax actionlink

I am working with mvc4 and new to working with it. I have a question around the Ajax ActionLink.
I have a long list of products, with each, there is an add to bag button. In the past I would use jquery to bind a click event to this button and then use javascript to make a server side request to a controller action.
I want all interaction to not cause a full page postback.
I am wondering is it best to follow my approach with javascript or use the Ajax ActionLink? What are the pros and cons of either approach?
Both are same.
Ajax ActionLink : less to write, works with conjuction Jquery un-obtrusive. Not much control on the markup.
HtML Link + Jquery Ajax call : will you give full control on the click event, you can add extra options to it.

New row in asp:repeater by java script

In my aspx page I have repeater to show list something, I want to add new row and show it in repeater without postback. I will send date soon. I don't want to use AJAX
How to add row to asp:repeater by JavaScript?
The best bet is inpect the code using a tool like firebug retrieve the html for the row, and recreate that using javascript and attach it to the DOM. Dirty but doable. Using something like jquery will make your work easier.
I know you dont want to use AJAX but the cleanest method would be to use an UpdatePanel and do is on the server side using a partial postabck
The repeater just generates repeating html so it's definitely possible to insert new html by using javascript. As #mellamokb mentions those changes won't be visible on the server side.
It's generally a bad idea to mix client and server side rendering with ASP.NET Webforms.
In the case of a list of some kind being dependent on e.g. a combobox it's often a better idea to render lists for all options in the ASPX code. Then use javascript to hide every list except the currently active one.

Categories

Resources