Showing posts with label Telerik. Show all posts
Showing posts with label Telerik. Show all posts

Tuesday, November 27, 2012

Read Telerik drop downlist javascript

sometimes we need to read the value/text of a Telerik MVC dropDownList  items.
using JQUERY:

function getData()
{
var items= $('#dropdownlistName).data('tDropDownList').data;
// items is the items list
// items can be dealt as an array
// then we can get the text and the value of each item as following:
 
var text = items[0].Text;
var value = items[0].Value;
 
 
}

Note :
you have to read " $('#dropdownlistName) " after document.read() function as we have to wait for  the Telerik JQuery library to be loaded.
it is preferred to be read pageLoad function of the Microsoft.Ajax library

function pageLoad()
{
    getData()
}

or at any event handler javascript function

Thursday, December 22, 2011

Error with MVC telerik


when using Telerik components , it may give you the erorr:
 "Unable to set value of the property '__MVC_FormValidation': object is null or undefined"
 solution :
 let the style sheets registeration to be:
 @(Html.Telerik().StyleSheetRegistrar() .DefaultGroup(group => group
                                                                                   .Add("telerik.common.css")
                                                                                    .Add("telerik.Vista.css")
                                                                                   .Add("telerik.rtl.css") ) )

 instead of :
 @(Html.Telerik().StyleSheetRegistrar() .DefaultGroup(group => group
                                                                                   .Add("telerik.common.css")
                                                                                    .Add("telerik.Vista.css")
                                                                                   .Add("telerik.rtl.css")
                                                                                  .Combined(true)
                                                                                   .Compress(true) ) )