I am using below code and want to restrict input so user can only Allow numeric value to 3-digits right of decimal point.
for ex:
123.00
123
12.45
1
<telerik:RadNumericTextBox ID="txtFactor" runat="server" MaxLength="5"
MinValue="0.00" NumberFormat-DecimalDigits="<%$ Resources:Common,decimalDigitsTwo%>"
Width="60px">
<ClientEvents OnBlur="CurrentYear" />
</telerik:RadNumericTextBox>
I have RadGid using dynamic data binding to an SQL dataset. I'm also inserting items using a PostBack call from JavaScript. The newly added items do not show on the grid after the rebind call. Paging and editing also no longer works without hiving refreshing the entire page.
Any help would be greatly appreciated.
Grid Markup
<telerik:RadAjaxLoadingPanel ID="rvpLoadingPanel" runat="server"></telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="rvpPanel" runat="server" LoadingPanelID="rvpLoadingPanel" ShowLoadingPanelForPostBackControls="true">
<telerik:RadGrid ID="grdReviewPanel" runat="server" AutoGenerateColumns="false" CssClass="Gridheight4" Width="100%" AllowPaging="true" PagerStyle-AlwaysVisible="false" PageSize="4" Skin="Telerik">
<ClientSettings>
<Scrolling AllowScroll="true" UseStaticHeaders="true" />
</ClientSettings>
<MasterTableView DataKeyNames="Panel_Member_ID" CommandItemDisplay="Top" EditMode="InPlace" AllowAutomaticUpdates="false" AllowAutomaticInserts="false" CommandItemSettings-ShowRefreshButton="true" HeaderStyle-Font-Size="8pt" HeaderStyle-Font-Bold="true" ItemStyle-Font-Size="8pt">
<CommandItemTemplate>
<asp:LinkButton ID="btnNew" runat="server" CssClass="w3-btn w3-flat-midnight-blue w3-small w3-round" OnClientClick="btnNew_OnClick(); return false" ToolTip="Add new review panel members.."><i class="fa-solid fa-user-plus"></i> New</asp:LinkButton>
<asp:LinkButton ID="btnGridReFresh" runat="server" CssClass="w3-btn w3-flat-midnight-blue w3-small w3-round w3-right" OnClientClick="RfeshtlGrid(); return false"><i class="fa-solid fa-refresh"></i> Refresh</asp:LinkButton>
</CommandItemTemplate>
<Columns>
<telerik:GridEditCommandColumn HeaderText="Edit" HeaderStyle-Width="65px"></telerik:GridEditCommandColumn>
<telerik:GridBoundColumn DataField="Panel_Member_ID" UniqueName="Panel_Member_ID" Display="false" ForceExtractValue="Always" DataType="System.String"></telerik:GridBoundColumn>
<telerik:GridBinaryImageColumn DataField="Employee_Photo" UniqueName="Employee_Photo" ImageAlign="Middle" ImageHeight="30px" ImageWidth="30px" HeaderText="Panel Member" ReadOnly="true"></telerik:GridBinaryImageColumn>
<telerik:GridBoundColumn DataField="Reviewer_Name" UniqueName="Reviewer_Name" HeaderText="Name" DataType="System.String" ReadOnly="true" ItemStyle-Font-Size="7pt"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Title" UniqueName="Title" HeaderText="Title" DataType="System.String" ItemStyle-Font-Size="7pt" ItemStyle-CssClass="maximize"></telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn DataField="Minutes_Member" UniqueName="Minutes_Member" HeaderText="Minutes Member" DataType="System.Boolean" HeaderStyle-Width="65px"></telerik:GridCheckBoxColumn>
<telerik:GridNumericColumn DataField="List_Order" UniqueName="List_Order" HeaderText="Display Order" DataType="System.Int32" ItemStyle-Font-Size="7pt"></telerik:GridNumericColumn>
<telerik:GridClientDeleteColumn ButtonCssClass="w3-flat-midnight-blue" ButtonType="FontIconButton" CommandName="Delete" UniqueName="Delete" HeaderStyle-Width="60px" ConfirmDialogType="RadWindow" ConfirmText="Are you sure you want to delete this item?" ConfirmTitle="Delete"></telerik:GridClientDeleteColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</telerik:RadAjaxPanel>
Client Scripts
<script type="text/javascript">
//<![CDATA[
function btnNew_OnClick() {
//This function displays the dropdown container for selecting
// and listing dropdown selections to be added to the grid.
var pmcontainer = document.querySelector("#newpm");
pmcontainer.style.display = 'block';
}
function RefreshGrid() {
__doPostBack("<%=rvpPanel.ClientID%>", " ");
}
function btnAdd_onClick() {
//Calls the SQL insert statment.
var dataList = $find("<%=lstReviewers.ClientID%>");
var rowcount = dataList._virtualItemCount;
if (rowcount > 0) {
PageMethods.AddReviewMembers(itemsAdded, itemsFailed);
}
function itemsAdded(response) {
//Calls postback method add items and refresh the grid.
__doPostBack("<%=rvpPanel.ClientID%>", "Insert");
var pmcontainer = document.querySelector("#newpm");
pmcontainer.style.display = 'none';
}
function itemsFailed(error) {
var message = error.get_message();
swal.fire({
title: 'ERROR!',
text: message,
icon: 'error'
});
}
}
//]]>
</script>
Code Behind
Private Sub AppealSettings_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
ClearReviewerInfo()
RefreshReviewerList()
Else
Dim ctrlName As String = Page.Request.Params.[Get]("__EVENTTARGET")
If ctrlName.Contains("listRvPanel") Then
'Listview Panel..
Dim strparameter As String = Page.Request("__EVENTARGUMENT")
If strparameter = "Delete" Then
ClearReviewerInfo()
Else
GetPanelMemberInfo(strparameter)
End If
ElseIf ctrlName.Contains("rvpPanel") Then
'Grid Panel
Dim insertParam As String = Page.Request("__EVENTARGUMENT")
If insertParam = "Insert" Then
AddNewPanelMembers()
Else
grdReviewPanel.Rebind()
End If
End If
End If
End Sub
Private Sub grdReviewPanel_NeedDataSource(Sender As Object, e As GridNeedDataSourceEventArgs) Handles grdReviewPanel.NeedDataSource
grdReviewPanel.DataSource = ReviewPanelData()
End Sub
Private Function ReviewPanelData(Optional ByVal Command As String = "", Optional ByVal strPanelMemberID As String = "",
Optional ByVal strTitle As String = "", Optional ByVal blnMinutesMem As Boolean = False, Optional ByVal intOrder As Integer = Nothing) As DataTable
Dim strConn As String = ConfigurationManager.ConnectionStrings("UMDB").ToString
Dim strSQL As String = ""
Dim dt As DataTable = Nothing
Try
Select Case Command
Case PerformInsertCommandName
strSQL = "EXEC dbo.usp_ins_tbl_Review_Panel_Members @Panel_Member_ID = " & SQL_Prepare_String(strPanelMemberID)
strSQL &= ", @Title = " & SQL_Prepare_String(strTitle)
strSQL &= ", @Minites_Member = " & SQL_Prepare_Boolean(blnMinutesMem)
strSQL &= ", @List_Order = " & SQL_Prepare_Number(intOrder)
ExecuteSQL(strSQL, strConn)
Return dt
Case UpdateCommandName
strSQL = "EXEC dbo.usp_upd_tbl_Review_Panel_Members @Panel_Member_ID = " & SQL_Prepare_String(strPanelMemberID)
strSQL &= ", @Title = " & SQL_Prepare_String(strTitle)
strSQL &= ", @Minites_Member = " & SQL_Prepare_Boolean(blnMinutesMem)
strSQL &= ", @List_Order = " & SQL_Prepare_Number(intOrder)
ExecuteSQL(strSQL, strConn)
Return dt
Case DeleteCommandName
strSQL = "DELETE FROM dbo.tbl_Appeal_Panel_Review_Members WHERE Panel_Member_ID = " & SQL_Prepare_String(strPanelMemberID)
ExecuteSQL(strSQL, strConn)
Return dt
Case Else
strSQL = "EXEC dbo.usp_get_tbl_Review_Panel_Members"
Dim ds As DataSet = GetDataSet(strSQL, 30, strConn)
dt = ds.Tables(0)
Return dt
End Select
Catch ex As Exception
Dim strErrorText As String
Dim strErrSource As String
strErrSource = ex.Source
strErrorText = "<P>" & Replace(Replace(Replace(Replace(Replace(ex.Message, vbCrLf, "<br/>"), "'", ""), "&", ""), "<", ""), ">", "") & "</p>"
'Console.Write(ex.Source & vbCrLf & ex.Message & vbCrLf & ex.StackTrace)
ShowError(strErrorText, strErrSource)
Return Nothing
End Try
End Function
Private Sub AddNewPanelMembers()
'Get the items selected from the dropdown container stored in temp SQL table
' and insert them into the grid's datasource table.
Dim strConn As String = ConfigurationManager.ConnectionStrings("UMDB").ToString
Dim strSQL As String = "SELECT * FROM dbo.tmp_Reviewer_Staging"
Dim ds As DataSet = GetDataSet(strSQL, 20, strConn)
Dim dt As DataTable = ds.Tables(0)
PanelMemID = ""
PMtitle = ""
PMListOrder = 0
Dim rowCount As Integer = dt.Rows.Count
If rowCount > 0 Then
With dt
For i As Integer = 0 To .Rows.Count - 1
Dim strPanelMemberID As String = .Rows(i).Item("Employee_ID")
Dim strTitle As String = .Rows(i).Item("Job_Title")
Dim intOrder As Integer = .Rows(i).Item("List_Order")
ReviewPanelData("PerformInsert", strPanelMemberID, strTitle, False, intOrder)
grdReviewPanel.MasterTableView.IsItemInserted = True
ReviewPanelData()
Next
End With
grdReviewPanel.Rebind() 'Refresh grid after data insert.
ClearReviewerInfo()
RefreshReviewerList()
End If
End Sub
I am attempting to put a radmenu inside of a radgrid gridTemplateColumn. The radmenu appears to have a vertical separator at the end that I have been unable to identify and remove which is underlined in red in the image below.
Markup is as follows. CSS below.
<!--grid markup removed other than relevant column -->
<telerik:GridTemplateColumn UniqueName="ParentGridMenu" HeaderStyle-Width="24px">
<ItemTemplate>
<telerik:RadMenu ID="menuParentRow" runat="server" Width="24px" ClickToOpen="true">
<Items>
<telerik:RadMenuItem ImageUrl="~/images/vertical-ellipsis-24.png" runat="server" Height="24px" Width="24px">
<Items>
<!--items removed as not relevant -->
</Items>
</telerik:RadMenuItem>
</Items>
</telerik:RadMenu>
</ItemTemplate>
</telerik:GridTemplateColumn>
.rmRootGroup
{
border:none !important;
background-color:transparent !important;
background-image:none !important;
},
.RadMenu_Default .rmVertical a.rmLink:hover,
.RadMenu_Default .rmVertical a.rmFocused,
.RadMenu_Default .rmVertical a.rmSelected,
.RadMenu_Default .rmVertical a.rmExpanded,
.RadMenu_Default .rmVertical a.rmExpanded:hover {
border:0 !important;
padding-bottom:1px !important;
padding-top:1px !important;
background-color:transparent !important;
background-image:none !important;
}
Hi Team ,
1. The below style i have to trigger during checkbox check status change
<style type="text/css">
table.RadCalendar_Default .rcRow .rcSelected
{
background: red;
}
</style>
Need to give this style inside javascrit
2. I need to change the same radcalendar hover colour change when the checkbox status change
checkbox1 ✅️
radcalendar control
I have to change the radcalendar date hovering to red if i check the checkbox and normal colour if unchecked
In the Excel-like Filtering example for ASP.NET AJAX, the RadGrid utilizes filtering by way of a HeaderContextFilterMenu. Because of this distinction, the coding samples for setting/removing filters via javascript seem to be incompatible.
For example, with a standard RadGrid you could set a filter with the following javascript:
var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
masterTable.filter("OrderID", 10254, Telerik.Web.UI.GridFilterFunction.GreaterThan, true);
OR
var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
masterTable.filter("AccessLevel", "User", "EqualTo");
masterTable.sort("Name");
But since I'm using the "Excel-like Filtering" mode/style, when I try this same logic, it returns the following error after calling
:Uncaught TypeError: d is null
My assumption is that there is a different set of steps/calls needed to set filtering when HeaderContextFilterMenu is involved. Any ideas?
DefaultCS.aspx:
<%@ Page Language="c#" AutoEventWireup="false" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.GridExamplesCSharp.Functionality.Filtering.ExcelLikeFiltering.DefaultCS" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
<title>Telerik ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" EnableAJAX="true">
<div class="demo-container no-bg">
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" AllowFilteringByColumn="true" runat="server" FilterType="HeaderContext" EnableHeaderContextMenu="true"
EnableHeaderContextFilterMenu="true" AllowPaging="True" PagerStyle-AlwaysVisible="true" OnFilterCheckListItemsRequested="RadGrid1_FilterCheckListItemsRequested" DataSourceID="SqlDataSource1" AllowSorting="true" GroupingEnabled="true">
<MasterTableView DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="CustomerID">
<Columns>
<telerik:GridBoundColumn FilterCheckListEnableLoadOnDemand="true" DataField="ContactName" FilterControlAltText="Filter ContactName column" HeaderText="ContactName" SortExpression="ContactName" UniqueName="ContactName" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterCheckListEnableLoadOnDemand="true" DataField="ContactTitle" FilterControlAltText="Filter ContactTitle column" HeaderText="ContactTitle" SortExpression="ContactTitle" UniqueName="ContactTitle">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Address" FilterControlAltText="Filter Address column" HeaderText="Address" SortExpression="Address" UniqueName="Address">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterCheckListEnableLoadOnDemand="true" DataField="City" FilterControlAltText="Filter City column" HeaderText="City" SortExpression="City" UniqueName="City">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterCheckListEnableLoadOnDemand="true" DataField="Country" FilterControlAltText="Filter Country column" HeaderText="Country" SortExpression="Country" UniqueName="Country">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</telerik:RadAjaxPanel>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT * FROM [Customers]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
DefaultCS.aspx.cs:
using Telerik.Web.UI;
using System;
using System.Web.UI;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace Telerik.GridExamplesCSharp.Functionality.Filtering.ExcelLikeFiltering
{
public partial class DefaultCS : System.Web.UI.Page
{
protected void RadGrid1_FilterCheckListItemsRequested(object sender, GridFilterCheckListItemsRequestedEventArgs e)
{
string DataField = (e.Column as IGridDataColumn).GetActiveDataField();
e.ListBox.DataSource = GetDataTable(DataField);
e.ListBox.DataKeyField = DataField;
e.ListBox.DataTextField = DataField;
e.ListBox.DataValueField = DataField;
e.ListBox.DataBind();
}
public DataTable GetDataTable(string field)
{
string query = string.Format("SELECT DISTINCT {0} FROM Customers", field);
String ConnString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(ConnString);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = new SqlCommand(query, conn);
DataTable myDataTable = new DataTable();
conn.Open();
try
{
adapter.Fill(myDataTable);
}
finally
{
conn.Close();
}
return myDataTable;
}
}
}
how to add styles for radcalendar asp.net in the javascript
<style type=
"text/css"
>
.RadCalendar .rcTitlebar .rcTitle
{
color
:
#1F3E74
!important
;
}
</style>
This same style i have to give inside javascript during checkbox click..dont know how to continue below
<script type="text/javascript">
function validate() {
if (document.getElementById('cricket').checked) {
alert("checked")
var calendar = document.getElementById("Calendarmain").className
document.getElementById("Calendarmain").style (..dont know how to give the same style above here ?????)
}
}
</script>
<input id="test" title="test" name="test" type="checkbox" onclick="validate()" />
Hi
Due to PT testing on our code, we found an issue with Rad labels that executing a JS code.
Thanks
Merav
In the Excel-like Filtering example for ASP.NET AJAX, the RadGrid utilizes filtering by way of a HeaderContextFilterMenu. In the example, there is a filter icon/button that you'd click on to open the column's context filter menu. Once you apply the filter, the grid filters as you'd expect, but there is nothing to indicate which column is being filtered. For that matter, if there are filters applied to multiple columns, there is no obvious way of knowing which columns are being filtered.
Looking at the attached screenshot, I've filtered CONTACT TITLE column to only display records where the contact is an "Accounting Manager", but when you look at the results there is no visual clue that CONTACT TITLE has been filtered.
Using the provided sample code, how would you alter the code to have it toggle the column's filter icon/button to indicate which column(s) have an actively applied column filter?
DefaultCS.aspx:
<%@ Page Language="c#" AutoEventWireup="false" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.GridExamplesCSharp.Functionality.Filtering.ExcelLikeFiltering.DefaultCS" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
<title>Telerik ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" EnableAJAX="true">
<div class="demo-container no-bg">
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" AllowFilteringByColumn="true" runat="server" FilterType="HeaderContext" EnableHeaderContextMenu="true"
EnableHeaderContextFilterMenu="true" AllowPaging="True" PagerStyle-AlwaysVisible="true" OnFilterCheckListItemsRequested="RadGrid1_FilterCheckListItemsRequested" DataSourceID="SqlDataSource1" AllowSorting="true" GroupingEnabled="true">
<MasterTableView DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="CustomerID">
<Columns>
<telerik:GridBoundColumn FilterCheckListEnableLoadOnDemand="true" DataField="ContactName" FilterControlAltText="Filter ContactName column" HeaderText="ContactName" SortExpression="ContactName" UniqueName="ContactName" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterCheckListEnableLoadOnDemand="true" DataField="ContactTitle" FilterControlAltText="Filter ContactTitle column" HeaderText="ContactTitle" SortExpression="ContactTitle" UniqueName="ContactTitle">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Address" FilterControlAltText="Filter Address column" HeaderText="Address" SortExpression="Address" UniqueName="Address">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterCheckListEnableLoadOnDemand="true" DataField="City" FilterControlAltText="Filter City column" HeaderText="City" SortExpression="City" UniqueName="City">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn FilterCheckListEnableLoadOnDemand="true" DataField="Country" FilterControlAltText="Filter Country column" HeaderText="Country" SortExpression="Country" UniqueName="Country">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</telerik:RadAjaxPanel>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT * FROM [Customers]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
DefaultCS.aspx.cs:
using Telerik.Web.UI;
using System;
using System.Web.UI;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace Telerik.GridExamplesCSharp.Functionality.Filtering.ExcelLikeFiltering
{
public partial class DefaultCS : System.Web.UI.Page
{
protected void RadGrid1_FilterCheckListItemsRequested(object sender, GridFilterCheckListItemsRequestedEventArgs e)
{
string DataField = (e.Column as IGridDataColumn).GetActiveDataField();
e.ListBox.DataSource = GetDataTable(DataField);
e.ListBox.DataKeyField = DataField;
e.ListBox.DataTextField = DataField;
e.ListBox.DataValueField = DataField;
e.ListBox.DataBind();
}
public DataTable GetDataTable(string field)
{
string query = string.Format("SELECT DISTINCT {0} FROM Customers", field);
String ConnString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(ConnString);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = new SqlCommand(query, conn);
DataTable myDataTable = new DataTable();
conn.Open();
try
{
adapter.Fill(myDataTable);
}
finally
{
conn.Close();
}
return myDataTable;
}
}
}
Hi. I have a RadFileExplorer and I would like to expand all of the nodes in its RadTreeView in the left hand panel on page load.
I have tried numerous ways in the code behind as well as JavaScript. The best I could manage was to expand the first node, but nothing more.
I appreciate any suggestions.
Thanks.