http://www.telerik.com/community/forums/aspnet-ajax/tabstrip/ie8-zoom-display-problem.aspx
http://www.telerik.com/community/forums/aspnet-ajax/form-decorator/buttons-have-vertical-line.aspx
http://www.telerik.com/community/forums/aspnet-ajax/tabstrip/line-showing-in-tab.aspx
http://www.telerik.com/community/forums/aspnet-ajax/combobox/combobox-does-not-render-properly.aspx
http://www.telerik.com/community/forums/aspnet-ajax/panelbar/resizing-text-using-ctrl-and-ctrl.aspx
http://www.telerik.com/community/forums/aspnet-ajax/combobox/wrong-styled-combobox.aspx
http://www.telerik.com/community/forums/aspnet-ajax/combobox/css-bug.aspx
http://www.telerik.com/community/forums/aspnet-ajax/tabstrip/latest-tabs-display-incorrectly.aspx
How can I populate a telerik drop-down list at page load?
I get the following error(at emphasized line below) when I try to populate dropdownlist:
Error: 'data(...)' is null or not an object
Here is how I try to populate the telerik ddl:
$(function(){
var values = [];
for (var i = 1; i < 10; i++) {
values.push({ Text: i, Value: i });
}
****$("#MyDdl").data("tDropDownList").dataBind(values);****
});
Tried it this way as well:
$(function(){
onDataBinding();
});
function onDataBinding(e) {
var MyDdl = $('#MyDdl').data('tDropDownList');
var values = [];
for (var i = 1; i < 10; i++) {
values.push({ Text: i, Value: i });
}
****MyDdl.dataBind(values);****
};
But get following undefined error at emphasized line above:
Error: 'undefined' is null or not an object
Note: Adding a button and loading the ddl on button click event does populate telerik drop-down list. Doing it following way works perfectly fine, but cant seem to make it to work on page load. Also, When I bind it to a telerik datepicker's onload, it does populate the dropdownlist but makes it a static field 0r disables it, and hence cant select any values.
$(function(){
var values = [];
for (var i = 1; i < 10; i++) {
values.push({ Text: i, Value: i });
}
$("#MyDdl").data("tDropDownList").dataBind(values);
});
Any help is much appreciated.
<
telerik:RadTreeList
ID
=
"MenuManager"
runat
=
"server"
>
<
Columns
>
<
telerik:TreeListBoundColumn
DataField
=
"MenuText"
HeaderText
=
"Menu Name"
UniqueName
=
"Name"
/>
<
telerik:TreeListHyperLinkColumn
DataNavigateUrlFields
=
"SitePageID"
DataNavigateUrlFormatString
=
"/admin/pageManager/?CID={0}"
DataTextField
=
"PageTitle"
HeaderText
=
"Url Title"
UniqueName
=
"PageTitle"
/>
<
telerik:TreeListBoundColumn
DataField
=
"MenuUrl"
HeaderText
=
"Url"
UniqueName
=
"MenuUrl"
/>
<
telerik:TreeListBoundColumn
DataField
=
"MenuTarget"
HeaderText
=
"Target"
UniqueName
=
"MenuTarget"
HeaderStyle-Width
=
"60px"
/>
<
telerik:TreeListBoundColumn
DataField
=
"IsEnabled"
HeaderText
=
"Status"
UniqueName
=
"MenuItemEnabled"
HeaderStyle-Width
=
"60px"
/>
<
telerik:TreeListEditCommandColumn
ButtonType
=
"ImageButton"
HeaderStyle-Width
=
"60px"
/>
<
telerik:TreeListButtonColumn
ButtonType
=
"ImageButton"
ButtonCssClass
=
"deleteConfirm"
CommandName
=
"Delete"
HeaderStyle-Width
=
"30px"
/>
</
Columns
>
<
EditFormSettings
UserControlPath
=
"~/includes/userControls/MenuForm.ascx"
EditFormType
=
"WebUserControl"
>
</
EditFormSettings
>
<
ClientSettings
AllowItemsDragDrop
=
"true"
>
<
Selecting
AllowItemSelection
=
"True"
/>
</
ClientSettings
>
</
telerik:RadTreeList
>
private string[] DataKey = { "MenuID" };
private string[] ParentKey = { "ParentID" };
private List<
SiteMenu
> MenuList = new List<
SiteMenu
>();
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
MenuManager.Skin = "Default";
MenuManager.AllowPaging = false;
MenuManager.AutoGenerateColumns = false;
MenuManager.GridLines = TreeListGridLines.Both;
MenuManager.ShowTreeLines = false;
MenuManager.NeedDataSource += MenuManager_NeedDataSource;
MenuManager.ItemCommand += MenuManager_ItemCommand;
MenuManager.InsertCommand += MenuManager_InsertCommand;
MenuManager.UpdateCommand += MenuManager_UpdateCommand;
MenuManager.DeleteCommand += MenuManager_DeleteCommand;
MenuManager.ItemDataBound += MenuManager_ItemDataBound;
MenuManager.ClientSettings.AllowItemsDragDrop = true;
MenuManager.ClientSettings.Selecting.AllowItemSelection = true;
MenuManager.AllowMultiItemSelection = true;
MenuManager.DataKeyNames = DataKey;
MenuManager.ParentDataKeyNames = ParentKey;
MenuManager.ItemDrop += MenuManager_RowDrop;
MenuManager.GridLines = TreeListGridLines.Both;
MenuList = new SiteMenu().SelectAllPublicMenuItemsBySiteIDNotDeleted(ThisSiteID);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
MenuManager.ExpandToLevel(1);
}
}
protected void MenuManager_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
{
MenuManager.DataSource = MenuList;
}
protected void MenuManager_ItemCommand(object sender, TreeListCommandEventArgs e)
{
if (e.CommandName == RadTreeList.InitInsertCommandName)
{
MenuManager.ClientSettings.Reordering.AllowColumnsReorder = false;
}
if (e.CommandName == RadTreeList.CancelCommandName)
{
MenuManager.ClientSettings.Reordering.AllowColumnsReorder = true;
}
}
protected void MenuManager_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e)
{
if (e.Item is TreeListDataItem)
{
TreeListDataItem item = (TreeListDataItem)e.Item;
if (item["MenuItemEnabled"].Text == "True")
{
item["MenuItemEnabled"].Text = "Enabled";
}
else
{
item["MenuItemEnabled"].Text = "Disabled";
}
if (item["MenuUrl"].Text.Contains("?CID="))
{
item["MenuUrl"].Attributes.Add("style", "color:#AAA");
}
}
}
protected void MenuManager_InsertCommand(object sender, TreeListCommandEventArgs e)
{
TreeListEditFormItem item = e.Item as TreeListEditFormItem;
UserControl MenuForm = (UserControl)e.Item.FindControl(TreeListEditFormItem.EditFormUserControlID);
int parentID = 0;
if (item.ParentItem != null)
{
parentID = (int)item.ParentItem.GetDataKeyValue("MenuID");
}
RadComboBox menuType = (RadComboBox)MenuForm.FindControl("MenuSelectList");
RadTextBox menuText = (RadTextBox)MenuForm.FindControl("MenuText");
switch (menuType.SelectedItem.Text)
{
case "Editable Content":
RadTextBox pageTitle = (RadTextBox)MenuForm.FindControl("PageTitle");
CheckBox defaultHomepage = (CheckBox)MenuForm.FindControl("DefaultHomepage");
if (new SiteMenu().InsertNewMenuItem(parentID, menuText.Text, pageTitle.Text, defaultHomepage.Checked))
{
Response.Redirect("/admin/menuManager/");
}
break;
case "Document Link":
UploadedFile uploadedFile = null;
RadUpload docUpload = (RadUpload)MenuForm.FindControl("DocumentLink");
docUpload.MaxFileSize = 10000000;
if (docUpload.UploadedFiles.Count > 0)
{
uploadedFile = docUpload.UploadedFiles[0];
}
if (new SiteMenu().InsertNewDocumentLink(parentID, menuText.Text, uploadedFile.GetName()))
{
Response.Redirect("/admin/menuManager/");
}
break;
case "External / Custom Link":
RadTextBox linkUrl = (RadTextBox)MenuForm.FindControl("LinkUrl");
RadComboBox target = (RadComboBox)MenuForm.FindControl("LinkTarget");
if (new SiteMenu().InsertExternalLink(parentID, menuText.Text, linkUrl.Text, target.Text))
{
Response.Redirect("/admin/menuManager/");
}
break;
case "Chamber Modules":
RadComboBox moduleType = (RadComboBox)MenuForm.FindControl("ModulePageType");
if (new SiteMenu().InsertNewModuleMenuItem(parentID, menuText.Text, moduleType.SelectedValue))
{
Response.Redirect("/admin/menuManager/");
}
break;
}
}
protected void MenuManager_UpdateCommand(object sender, TreeListCommandEventArgs e)
{
TreeListEditFormItem item = e.Item as TreeListEditFormItem;
UserControl MenuForm = (UserControl)e.Item.FindControl(TreeListEditFormItem.EditFormUserControlID);
int thisMenu = (int)item.ParentItem.GetDataKeyValue("MenuID");
RadComboBox menuType = (RadComboBox)MenuForm.FindControl("MenuSelectList");
RadTextBox menuText = (RadTextBox)MenuForm.FindControl("MenuText");
CheckBox enabled = (CheckBox)MenuForm.FindControl("MenuItemEnabled");
switch (new SubCategory().SelectThisSubCategory(Convert.ToInt32(menuType.SelectedValue), PCSSession.Current.SiteID).TypeDescription.ToLower())
{
case "editable content":
RadTextBox pageTitle = (RadTextBox)MenuForm.FindControl("PageTitle");
CheckBox defaultHomepage = (CheckBox)MenuForm.FindControl("DefaultHomepage");
if (new SiteMenu().UpdateThisMenuItem(ThisSiteID, thisMenu, menuType.SelectedValue, menuText.Text, pageTitle.Text, enabled.Checked, defaultHomepage.Checked))
{
Response.Redirect("/admin/menuManager/");
}
break;
case "document link":
UploadedFile uploadedFile = null;
RadUpload docUpload = (RadUpload)MenuForm.FindControl("DocumentLink");
docUpload.MaxFileSize = 10000000;
if (docUpload.UploadedFiles.Count > 0)
{
uploadedFile = docUpload.UploadedFiles[0];
if (new SiteMenu().UpdateThisDocumentLink(thisMenu, menuType.SelectedValue, menuText.Text, uploadedFile.GetName(), enabled.Checked))
{
Response.Redirect("/admin/menuManager/");
}
}
else
{
if (new SiteMenu().UpdateThisMenuText(thisMenu, menuType.SelectedValue, menuText.Text, enabled.Checked))
{
Response.Redirect("/admin/menuManager/");
}
}
break;
case "external / custom link":
RadTextBox linkUrl = (RadTextBox)MenuForm.FindControl("LinkUrl");
RadComboBox target = (RadComboBox)MenuForm.FindControl("LinkTarget");
if (new SiteMenu().UpdateThisExternalLink(thisMenu, menuType.SelectedValue, menuText.Text, linkUrl.Text, target.SelectedItem.Text, enabled.Checked))
{
Response.Redirect("/admin/menuManager/");
}
break;
case "chamber modules":
RadComboBox moduleType = (RadComboBox)MenuForm.FindControl("ModulePageType");
if (new SiteMenu().UpdateThisModuleMenuItem(thisMenu, menuType.SelectedValue, menuText.Text, moduleType.SelectedValue, enabled.Checked))
{
Response.Redirect("/admin/menuManager/");
}
break;
}
}
protected void MenuManager_DeleteCommand(object sender, TreeListCommandEventArgs e)
{
TreeListDataItem item = e.Item as TreeListDataItem;
int thisMenuItem = (int)item.GetDataKeyValue("MenuID");
int menuType = new SiteMenu().SelectThisMenuItem(thisMenuItem, ThisSiteID).MenuTypeID;
switch (new SubCategory().SelectThisSubCategory(menuType, ThisSiteID).TypeDescription.ToLower())
{
case "document link":
if (new SiteMenu().DeleteThisDocumentLink(thisMenuItem))
{
Response.Redirect("/admin/menuManager/");
}
break;
case "editable content":
if (new SiteMenu().DeleteTheEditableContentPage(thisMenuItem))
{
Response.Redirect("/admin/menuManager/");
}
break;
default:
if (new SiteMenu().DeleteThisMenuItem(thisMenuItem))
{
Response.Redirect("/admin/menuManager/");
}
break;
}
}
protected void MenuManager_RowDrop(object sender, TreeListItemDragDropEventArgs e)
{
int key = (int)e.DraggedItems[0].GetDataKeyValue("MenuID");
int destinationId = 0;
int sortOrder = 0;
if (IsUnder.Checked)
{
destinationId = (int)e.DestinationDataItem.GetDataKeyValue("MenuID");
sortOrder = 1;
}
else
{
destinationId = (int)e.DestinationDataItem.GetParentDataKeyValue("ParentID");
sortOrder = new SiteMenu().SelectThisMenuItem((int)e.DestinationDataItem.GetDataKeyValue("MenuID"), ThisSiteID).SortOrder + 1;
}
if (destinationId == 0)
{
if (key != destinationId)
{
MenuList.FirstOrDefault(i => i.MenuID == key).ParentID = destinationId;
MenuList.FirstOrDefault(i => i.MenuID == key).SortOrder = sortOrder;
foreach (SiteMenu menuItem in MenuList.Where(i => i.ParentID == destinationId))
{
if (menuItem.SortOrder >= sortOrder && menuItem.MenuID != key)
{
menuItem.SortOrder += 1;
}
}
if (new SiteMenu().UpdateMenuListByParentID(destinationId, MenuList.Where(i => i.ParentID == destinationId).ToList()))
{
Response.Redirect("/admin/menuManager/");
}
}
}
else
{
if (key != destinationId && key != MenuList.FirstOrDefault(i => i.MenuID == destinationId).ParentID)
{
MenuList.FirstOrDefault(i => i.MenuID == key).ParentID = destinationId;
MenuList.FirstOrDefault(i => i.MenuID == key).SortOrder = sortOrder;
foreach (SiteMenu menuItem in MenuList.Where(i => i.ParentID == destinationId))
{
if (menuItem.SortOrder >= sortOrder && menuItem.MenuID != key)
{
menuItem.SortOrder += 1;
}
}
if (new SiteMenu().UpdateMenuListByParentID(destinationId, MenuList.Where(i => i.ParentID == destinationId).ToList()))
{
Response.Redirect("/admin/menuManager/");
}
}
}
}
<
telerik:RadScriptManager
ID
=
"knockoutAppScriptManager"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Path
=
"Scripts/jquery-1.5.1.js"
/>
<
asp:ScriptReference
Path
=
"Scripts/knockout-2.1.0.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<%@ Page Title="Knockout | Tutorial #1" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Tutorial1.aspx.cs" Inherits="KnockoutApp.Tutorials.Tutorial1" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"HeadContent"
runat
=
"server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"MainContent"
runat
=
"server"
>
<!-- learn.knockoutjs.com -->
<
p
>First name: <
strong
><
asp:Label
ID
=
"firstNameLabel"
runat
=
"server"
data-bind
=
"text: firstName"
/></
strong
></
p
>
<
p
> Last name: <
strong
><
asp:Label
ID
=
"lastNameLabel"
runat
=
"server"
data-bind
=
"text: lastName"
/></
strong
></
p
>
<
p
> Full name: <
strong
><
asp:Label
ID
=
"fullNameLabel"
runat
=
"server"
data-bind
=
"text: fullName"
/></
strong
></
p
>
<
p
>First name: <
asp:TextBox
ID
=
"firstNameTextBox"
runat
=
"server"
data-bind
=
"value: firstName"
/></
p
>
<
p
> Last name: <
asp:TextBox
ID
=
"lastNameTextBox"
runat
=
"server"
data-bind
=
"value: lastName"
/></
p
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Go caps"
data-bind
=
"click: capitalizeLastName"
/>
<!-- js code -->
<
script
type
=
"text/javascript"
>
function AppViewModel() {
this.firstName = ko.observable("Bert");
this.lastName = ko.observable("Bertington");
this.fullName = ko.computed(function () {
return this.firstName() + " " + this.lastName();
}, this);
this.capitalizeLastName = function () {
var currentVal = this.lastName(); // Read the current value
this.lastName(currentVal.toUpperCase()); // Write back a modified value
};
}
// Activates knockout.js
ko.applyBindings(new AppViewModel());
</
script
>
<!-- end of content -->
</
asp:Content
>
<%@ Page Title="Knockout | Tutorial #1" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Tutorial1Rad.aspx.cs" Inherits="KnockoutApp.Tutorials.Tutorial1Rad" %>
<%@ Register TagPrefix="Telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"HeadContent"
runat
=
"server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"MainContent"
runat
=
"server"
>
<!-- learn.knockoutjs.com -->
<
p
>First name: <
strong
><
asp:Label
ID
=
"firstNameLabel"
runat
=
"server"
data-bind
=
"text: firstName"
/></
strong
></
p
>
<
p
> Last name: <
strong
><
asp:Label
ID
=
"lastNameLabel"
runat
=
"server"
data-bind
=
"text: lastName"
/></
strong
></
p
>
<
p
> Full name: <
strong
><
asp:Label
ID
=
"fullNameLabel"
runat
=
"server"
data-bind
=
"text: fullName"
/></
strong
></
p
>
<
p
>First name: <
telerik:RadTextBox
ID
=
"firstNameTextBox"
runat
=
"server"
data-bind
=
"text: firstName"
/></
p
>
<
p
> Last name: <
telerik:RadTextBox
ID
=
"lastNameTextBox"
runat
=
"server"
data-bind
=
"text: lastName"
/></
p
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Go caps"
data-bind
=
"click: capitalizeLastName"
/>
<!-- js code -->
<
script
type
=
"text/javascript"
>
function AppViewModel() {
this.firstName = ko.observable("Bert");
this.lastName = ko.observable("Bertington");
this.fullName = ko.computed(function () {
return this.firstName() + " " + this.lastName();
}, this);
this.capitalizeLastName = function () {
var currentVal = this.lastName(); // Read the current value
this.lastName(currentVal.toUpperCase()); // Write back a modified value
};
}
// Activates knockout.js
ko.applyBindings(new AppViewModel());
</
script
>
<!-- end of content -->
</
asp:Content
>
data-bind
=
"text: firstName"
and
data-bind
=
"value: firstName"