I have inherited an application that has used Telerik.Web.Mvc DLL. It was developed circa 2010. I needed to work on the menu sizes and I asked for help from the Telerik guys. They suggested that the application being so old I should migrate to the latest code. Which I did. But I lost all the Telerik.Web.Mvc sitemap part. And now I am lost. I am not sure what comes after SiteMapManager. I cannot find any documentation on it, I do not understand how to migrate.
Can somebody help me with this issue?
Thank you.
I am changing the background color of a date ( that is being provided from the database ) by using the Calendar OnDayRender. The problem is that when the page initially loads the background color is not present. But if I change the month, then go back to the previous month, the background color appears.
ASP:
<
telerik:RadDatePicker
AutoPostBack
=
"true"
OnSelectedDateChanged
=
"rdpEnd_SelectedDateChanged"
ID
=
"rdpEnd"
ToolTip
=
""
class
=
"form-control"
Style
=
"width: 100%;"
Height
=
"30px"
aria-describedby
=
"ptoEndDate"
runat
=
"server"
>
<
DatePopupButton
ToolTip
=
""
/>
<
Calendar
runat
=
"server"
ShowRowHeaders
=
"false"
OnDayRender
=
"CustomizeDay"
>
</
Calendar
>
</
telerik:RadDatePicker
>
C#
protected
void
CustomizeDay(
object
sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
{
DateTime CurrentDate = e.Day.Date;
using
(DataClassesDataContext db =
new
DataClassesDataContext())
{
if
(db.Calendars.Where(x => x.date.Value.Date == e.Day.Date).Any())
{
TableCell currentCell = e.Cell;
currentCell.Style[
"background-color"
] =
"#000000"
;
}
}
}
hello
i have the following problem
i have a radgrid which is totally builded in code behind because it must be bound to different data types
you can see a preview in this page
the user may update a record or insert a new one
when entering in edit mode, some rows in the edit form should be hidden based on the selection of the main item (the INST_MODEL value that cannot be changed in edit mode)
following is the codebehind of the ascx (i omit fo simplicity the part of code that builds customedittemplate)
so, when selecting an item with INST_MODEL = GA_CP-LI-COR LI-7200, for example, the rows with INST_SA[...] labels should be hidden
how can i do it?!
thanks a lot
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Collections;
using System.Data;
using System.Collections.Specialized;
using System.Web.UI.HtmlControls;
namespace SitefinityWebApp.EcoControls
{
public partial class BADMView : System.Web.UI.UserControl
{
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["connMulti"].ConnectionString;
BadmVar bv = null;
int idVar = 1000;
int idSite = 0;
int insertUserId = 0;
public string I_MODEL="";
protected void Page_Load(object sender, EventArgs e)
{
Session["idutente"] = 127;
Session["usname"] = "database";
if (Session["idutente"] != null && Session["idutente"].ToString()!="")
{
insertUserId = int.Parse(Session["idutente"].ToString());
}
}
protected void Page_Init(object sender, EventArgs e)
{
/***********************/
//if (Request["idvar"] != null && Request["idvar"].ToString() != "0")
if (Request["idsite"] != null && Request["idsite"].ToString() != "")
{
//Response.Write("idvar:: " + Request["idvar"].ToString());
//idVar = int.Parse(Request["idvar"].ToString());
//pickUpVars.SelectedValue = Request["idvar"].ToString();
idSite = int.Parse(Request["idsite"].ToString());
sitesDDL.SelectedValue = Request["idsite"].ToString();
}
else
{
return;
}
//1. Get theBadm Variable Infos
SqlConnection cn = new SqlConnection();
cn.ConnectionString = conn;
cn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandText = "...";
//2. Build the grid
RadGrid grid = new RadGrid();
grid.ID = "instGrid";
grid.DataSourceID = "sqlInst";
grid.PageSize = 15;
grid.AllowPaging = true;
grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
grid.AutoGenerateColumns = false;
grid.AllowAutomaticUpdates = false;
grid.AllowAutomaticInserts = false;
grid.AllowAutomaticDeletes = false;
grid.AllowMultiRowEdit = true;
//grid.AllowMultiRowSelection = true;
grid.Skin = "Bootstrap";
grid.ItemCommand += new GridCommandEventHandler(instGrid_ItemCommand);
grid.ItemDataBound += new GridItemEventHandler(instGrid_ItemDataBound);
//2.1 Add Customers table
grid.MasterTableView.DataKeyNames = new string[] { "id_badmstorage", "value" };
if (bv.ID != 1)
{
grid.MasterTableView.EditMode = GridEditMode.EditForms;
grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
}
GridBoundColumn boundColumn = new GridBoundColumn();
boundColumn.DataField = "id_badmstorage";
boundColumn.HeaderText = "ID";
boundColumn.ReadOnly = true;
grid.MasterTableView.Columns.Add(boundColumn);
//2.2 SET SQL DATA SOURCE...
sqlInst.SelectCommand = "...";
//3. Add grid columns...
GridTemplateColumn tempC = null;
tempC = new GridTemplateColumn();
tempC.DataField = "value";
tempC.HeaderText = bv.Name;
tempC.UniqueName = "value";
tempC.ItemTemplate = new MyTemplate("value", bv.CvIndex, true);
tempC.EditItemTemplate = new CustomEditTemplate("value", true, bv.Unit, bv.CvIndex, bv.ID);
grid.MasterTableView.Columns.Add(tempC);
if (bv.QualifierList != null)
{
for (int i = 0; i < bv.QualifierList.Count; i++)
{
string temp = (bv.QualifierList[i].QualIndex != "") ? bv.QualifierList[i].QualIndex : bv.QualifierList[i].RealQualName;
tempC = new GridTemplateColumn();
tempC.DataField = temp;
tempC.HeaderText = bv.QualifierList[i].QualName;
tempC.UniqueName = bv.QualifierList[i].QualName;
tempC.ItemTemplate = new MyTemplate(temp, bv.QualifierList[i].CvIndex, bv.QualifierList[i].Required);
tempC.EditItemTemplate = new CustomEditTemplate(temp, bv.QualifierList[i].Required, bv.QualifierList[i].Type, bv.QualifierList[i].CvIndex, bv.ID);
tempC.Visible = (i <= 5);
grid.MasterTableView.Columns.Add(tempC);
}
}
//4. Edit commands
if (bv.ID != 1)
{
GridEditCommandColumn eCol = new GridEditCommandColumn();
eCol.UniqueName = "EditCommandColumn";
grid.MasterTableView.Columns.Add(eCol);/**/
}
//5. delete command
if (bv.ID != 1)
{
/*tempC = new GridTemplateColumn();
tempC.UniqueName = "DeleteColumn";
// tempC.HeaderText = "Delete";
tempC.ItemTemplate = new DeleteTemplate("delete");
grid.MasterTableView.Columns.Add(tempC);*/
}
// grid.ClientSettings.ClientEvents = new GridClientEvents(
//6. Add the grid to the placeholder
this.PlaceHolder1.Controls.Add(grid);
//AJAX SETTINGS...
AjaxSetting ajax = new AjaxSetting(grid.ID);
AjaxUpdatedControl up = new AjaxUpdatedControl();
up.ControlID = grid.ID;
ajax.UpdatedControls.Add(up);
up = new AjaxUpdatedControl();
ajax.UpdatedControls.Add(up);
RadAjaxManager1.AjaxSettings.Add(ajax);
}
private bool compareHTable(Hashtable tnew, Hashtable told)
{
foreach (string key in tnew.Keys)
{
if (tnew[key] != told[key])
{
return false;
}
}
return true;
}
public int IdVar
{
get { return idVar; }
}
protected void instGrid_ItemCommand(object sender, GridCommandEventArgs e)
{
string body = "";
SqlConnection cn = new SqlConnection(conn);
cn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
if (e.CommandName == "Update")
{
//Perform updates
}
else if (e.CommandName == "InitInsert")
{
}
else if (e.CommandName == "Edit")
{
//Edit code
}
else if (e.CommandName == "PerformInsert")
{
//Insert code
}
else if (e.CommandName == "Delete")
{
GridEditableItem editedItem = e.Item as GridEditableItem;
string idbm = editedItem.GetDataKeyValue("id_badmstorage").ToString();
cmd.CommandText = "UPDATE BADMStorage16 SET dataStatus=404, deleteUserId="+insertUserId+", deletedDate='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "' WHERE id_badmstorage=" + idbm;
cmd.ExecuteNonQuery();
body += "\nDeleted item for variable "+bv.Name+", record ID="+idbm+" by " + Session["usname"].ToString();
}
cn.Close();
}
}
When setting up a RadGrid in XML, you can set a variety of properties such as DataSourceID, AllowPaging, ImagesPath, AllowAutomaticInserts, etc.
I know that these are scattered throughout the tutorials on your website but is there anywhere or is there any document that has a list of all of these properties in the same place with associated descriptions of what they are used for? I am looking for something like your old CMS documentation only for your new stuff. Does that exist?
I'm a noob to Telerik controls. I just purchased the UI for ASP.NET AJAX controls. I just started playing with them and I'm stuck getting a simple RadCheckBox deployed. I've got the RadScriptManager and RadSkinManger in my aspx page. I added a RadCheckBox which for some reason shows as a button in the IDE. I've tried configuring many different properties of the check box. When I run it all I see is the Text I have defined for it. There is no checkbox to click. If I click the text it behaves (the first click) like a button (it depresses) but then on subsequent clicks, nothing.
I'm sure there is something super simple that I'm just not seeing. I haven't played with any other controls so I'm not sure if I'm not configured properly?
Thanks for any help!
Hi Telerik
1) I want to use client side programing in my application , on other word use all request with ajax (client side) . Is any online example?
How can i do it ?
2) How can i use https://jqueryvalidation.org/ with ajax ui telerik ? (for example : requierd radtextbox ... not sumbit page when radtextbox in empty) . Is online example ?
Please help me . Thanks
Hi Telerik
1) I want to use client side programing in my application , on other word use all request with ajax (client side) . Is any online example?
How can i do it ?
2) How can i use https://jqueryvalidation.org/ with ajax ui telerik ? (for example : requierd radtextbox ... not sumbit page when radtextbox in empty) . Is online example ?
Please help me . Thanks
I try to make a RadListBox inside the Custom Dialog. I would like to pass the value from RadListBox to parent page when I double clicking on it. I try using editor.pasteHtml funcion in double click event of RadListBox but it won't work.
Could you please tell me where I went wrong.
My source code like below.
WebForm.aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebEditor.WebForm1" %>
<!DOCTYPE html>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
/>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
>
Telerik.Web.UI.Editor.CommandList["InsertLexicon"] = function (commandName, editor, args) {
var myCallbackFunction = function (sender, args) {
editor.pasteHtml(args.image);
}
editor.showExternalDialog(
"InsertLexicon.aspx",
{},
400,
560,
myCallbackFunction,
null,
"InsertLexicon",
true,
Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
false,
true);
};
function pasteLexicon(myData)
{
var editor = $find('<%= edComment.ClientID%>');
editor.pasteHtml(myData);
}
</
script
>
<
br
/>
<
br
/>
<
br
/>
<
br
/>
<
telerik:RadEditor
RenderMode
=
"Lightweight"
runat
=
"server"
ID
=
"edComment"
EditType
=
"Inline"
NewLineMode
=
"Br"
ToolsFile
=
"ToolsFile.xml"
>
</
telerik:RadEditor
>
</
div
>
</
form
>
</
body
>
</
html
>
InsertLexicon.aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="InsertLexicon.aspx.vb" Inherits="WebEditor.InsertLexicon" %>
<!DOCTYPE html>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
/>
<
link
href
=
"StyleSheets/Editor.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
title
>InsertLexicon</
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
function getRadWindow() //mandatory for the RadWindow dialogs functionality
{
if (window.radWindow) {
return window.radWindow;
}
if (window.frameElement && window.frameElement.radWindow) {
return window.frameElement.radWindow;
}
return null;
}
function initDialog() //called when the dialog is initialized
{
var clientParameters = getRadWindow().ClientParameters;
}
if (window.attachEvent) {
window.attachEvent("onload", initDialog);
}
else if (window.addEventListener) {
window.addEventListener("load", initDialog, false);
}
function insertLexicon() //fires when the Insert Link button is clicked
{
var closeArgument = {};
var list = $find("<%= listComment.ClientID%>");
var item = list.get_selectedItem();
if (item == null || item == undefined) {
alert("請選擇詞庫");
return false;
}
else {
closeArgument.image = item.get_value();
getRadWindow().close(closeArgument);
}
}
function closeWindow() {
getRadWindow().close();
}
function OnClientItemDoubleClicked(sender, args)
{
var closeArgument = {};
var list = $find("<%= listComment.ClientID%>");
var item = list.get_selectedItem();
getRadWindow().get_browserWindow().pasteLexicon(item.get_value());
}
</
script
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
<!--Tool-->
<
telerik:RadListBox
RenderMode
=
"Lightweight"
runat
=
"server"
ID
=
"listComment"
Height
=
"350px"
Width
=
"100%"
ButtonSettings-AreaWidth
=
"35px"
OnClientItemDoubleClicked
=
"OnClientItemDoubleClicked"
>
<
Items
>
<
telerik:RadListBoxItem
Text
=
"Value1"
Value
=
"value1"
></
telerik:RadListBoxItem
>
<
telerik:RadListBoxItem
Text
=
"Value2"
Value
=
"Value2"
></
telerik:RadListBoxItem
>
</
Items
>
</
telerik:RadListBox
>
<
br
/>
<
div
>
<
telerik:RadButton
RenderMode
=
"Lightweight"
AutoPostBack
=
"false"
ID
=
"RadButton6"
runat
=
"server"
OnClientClicked
=
"insertLexicon"
Text
=
"Save"
/>
<
telerik:RadButton
RenderMode
=
"Lightweight"
AutoPostBack
=
"false"
ID
=
"RadButton7"
runat
=
"server"
OnClientClicked
=
"closeWindow"
Text
=
"Close"
/>
</
div
>
</
form
>
</
body
>
</
html
>
Hi,
We have a grid and a custom skin for it. In order to show grid images for "Add New", "Edit", "Delete", "Filter", etc... we put all grid related images into "~/images/grid" directory, based on this article
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/appearance-and-styling/skins
However, we also use buttons "Export To PDF" and "Export To Excel", which correct names are not mentioned in the above article.
What are the correct names we should use for these button so the images show in the grid header?
Thanks,
Evgeniya