Monthly Archives: July 2012

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.

The Web project blablabla requires missing web components to run with Visual Studio. ASP.NET Web pages with Razor syntax

missing web pages with razor syntax

Ever encountered this strange popup in VS2010 after several hours of happily working with MVC? And now VS thinks, that something is wrong with your Razor components?

Well the thing might be, that you just updated from SVN and your web.config file was modified in a bad way, say like this :

  <connectionStrings>
<<<<<<< .mine
    <add name="blablaConnectionStringFullSQL" connectionString="some-connection-string" providerName="System.Data.SqlClient" />
    <add name="blablaConnectionStringFullSQLalt" connectionString="some-connection-string" providerName="System.Data.SqlClient" />
=======
    <add name="blablaConnectionStringFullSQLalt" connectionString="some-connection-string" providerName="System.Data.SqlClient" />
    <add name="blablaConnectionStringFullSQL" connectionString="some-connection-string" providerName="System.Data.SqlClient" />
>>>>>>> .r199
  </connectionStrings>

Well at least, this was my case, so as a first shot, take a look at files that conflicted after update.

Hope this helped a bit.