Category Archives: Telerik

How to access columns, all properties and data of Telerik’s MVC Grid on client

If you want to access all data in your Grid that you have in DOM in your browser on client, you maybe found this helpful link to Telerik’s help page :

http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-client-api-and-events.html

But looking at all those events that are out of box, you maybe eventually need to access all columns or data that you have in grid or tweak some things on client. Then direct access to grid in DOM would be much appreciated.

Answer is in fact on page above, it’s just not that obvious, until you inspect all the elements in DOM you have once page loads.

$('#id-of-our-grid').data('tGrid');

This will give you element with properties like :

ajax – and all URLs that will grid use, columns, data, currentPage, dataSource, modelBinder, etc…..

Just try it and you will see 🙂

Hope this helps.

How to hook to client keyboard events with Telerik’s DropDownList

So, you have same problem as me, how to subscribe to clients keyboard events with Telerik’s DropDownList control for ASP.NET MVC? 🙂

Unfortunatelly, there is no out of box event for this yet, but it’s not that hard, we just need some jQuery magic.

This is the code :


$('#id-of-your-combobox').parent().keydown(function (e) {
alert('Handler for .keydown() called.');
});

Please be aware, that if you are using combo box in Grid (in Telerik’s MVC Grid, like I do), then you need to execute this code in OnEdit event handler, since combo box object exists only when some row is in edit state.

If you have any questions, feel free to ask.

Hope this helps, at least to save you some time.

Don’t forget to add Telerik’s WebResource handler to both sections in web.config file

Today I came across easy to spot but nasty little problem when deploying ASP.NET app with Telerik ASP.NET AJAX controls.

When creating the project, some coleague of mine (propably) used old web.config file to create new app (because of some common classes and setting that we use). Anyway, with Cassini everything worked fine, but when deployed on IIS 7.5, I got an

‘~/Telerik.Web.UI.WebResource.axd’ is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScriptManager

error. I googled out in some discussions that : you should set the Managed pipeline mode from Integrated to Classic. This indeed solved the problem with behaving IIS 7.5 as old 6.0 (with handler registered in old web.config node), but I wasn’t convinced that to use Telerik’s controls, I should use old type of pipeline. That would be really strange. So I was searching around, what is the real problem.

I looked in web.config file and then it finally hit me. 🙂

Our old web.config file registered Telerik’s handler only in old <system.web> section for IIS 6 (and that sufficed for cassini and IIS 6.0) and not in new <system.webServer> section. So I had to add this piece of xml to web.config :

<handlers>
    <add name=”Telerik.Web.UI.WebResource”  path=”Telerik.Web.UI.WebResource.axd” verb=”*” type=”Telerik.Web.UI.WebResource, Telerik.Web.UI” />
</handlers>

(Please note, this snippet is dated 2011 – it worked at that time, I suppose in 2014 this will be generated in a different way)
This would be of course be added by RadScriptManager’s menu hidden in it’s smart tag in design mode, but we didn’t used this approach as everything worked on our dev machines.

So, when deploying to IIS 7.0 and up, don’t forget to register handlers to both nodes or use Telerik’s RadScriptManager menu option. 🙂

If you want to learn more :

http://www.telerik.com/help/aspnet-ajax/troubleshooting.html

http://msdn.microsoft.com/en-us/library/46c5ddfy.aspx

http://stackoverflow.com/questions/716049/what-is-the-difference-between-classic-and-integrated-in-iis7