Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
1.0K+ views
As per the post in this discussion:
http://www.telerik.com/community/forums/aspnet/upload/is-there-a-max-filename-length.aspx 

"The limit of 255 characters for Windows XP or 260 character limit for Windows Vista applies to the entire filepath and not just the filename. "

How can I check that on client side, and inform the clients that the filename along with file path is too long?
Peter Milchev
Telerik team
 answered on 22 May 2020
1 answer
6.7K+ views
Good day all,

I have a radtextbox.
how this radtextbox can be restricted to only numbers.

means only numbers should be entered in textbox.



thanks to all.
Rumen
Telerik team
 answered on 22 May 2020
3 answers
617 views

I have a radcombobox in a modal.  The combobox is hidden when the modal first opens.  After the user clicks a button to display the modal, then makes a selection in an asp:DropdownList, the div containing the combobox displays and works properly.  After a "save" button click, modal closes and the div containing the Radcombobox is set to Visible=false again from codebehind.  However, if the user attempts to repeat the aforementioned process, then Visible is set to "true" on the div containing the RadComboBox, the ComboBox no longer displays correctly.  I have attached a screenshot of the issue.

 

Here is the modal code:

   <div id="modalFindAndReplace" class="md-modal colored-header custom-width md-effect-9 primary">
       <div class="md-content">
           <div class="modal-header">
               <button type="button" data-dismiss="modal" aria-hidden="true" class="close md-close"><i class="icon s7-close"></i></button>
               <h3 class="modal-title">Find and Replace</h3>
           </div>
           <div class="panel panel-alt3 panel-transparent">
               <div class="panel-heading panel-heading-cg">
                   <button runat="server" id="btnSearchandReplace" data-dismiss="modal" type="button" class="btn btn-alt3" onserverclick="btnSearchandReplace_ServerClick" ><i class="icon s7-search"></i> Find and Replace</button>
                   <button type="button" id="btnCancelTargetField" data-dismiss="modal" class="btn btn-alt3 md-close" runat="server"><i class="icon s7-close"></i> Cancel</button>
               </div>
           </div>
           <div class="modal-body form">
               <div class="panel-body" style="margin: 0 auto;">
                   <div>
                       <asp:UpdatePanel runat="server" >
                           <ContentTemplate>
                               <div class="form-group">
                                   <span> <label for="ddlSearchColumn" class="control-label text-danger">Search Column</label>
                                   <asp:DropDownList runat="server" ID="ddlSearchColumn" AutoPostBack="true"  OnSelectedIndexChanged="ddlSearchColumn_SelectedIndexChanged"></asp:DropDownList></span>
                                  <span class="pull-right">
                                      <asp:CheckBox ID="CheckBox1" runat="server" Text="Include Headers" /></span>
                               </div>
                               <div class="form-group" id="divSearchText" runat="server">
                                   <label for="txtSearchText" class="control-label">Find Text:</label>
                                   <asp:TextBox ID="txtSearchText" runat="server" CssClass="form-control" ></asp:TextBox>
                               </div>
                               <div class="form-group" id="divSearchList" runat="server" visible="false">
                                   <label for="ddlSearchList" class="control-label">Find Text:</label>
                                   <asp:DropDownList runat="server" ID="ddlSearchList"></asp:DropDownList>
                               </div>
                               <div class="form-group" id="replaceWithTextBox" runat="server">
                                   <label for="txtReplaceText" class="control-label">Replace With:</label>
                                   <asp:TextBox ID="txtReplaceText" runat="server" CssClass="form-control" ></asp:TextBox>
                               </div>
                               <div class="form-group" id="divAssetType" runat="server" visible="false">
                                   <label for="ddlReplaceAssetType" class="control-label">Replace Asset Type Name With:</label>
                                   <asp:DropDownList runat="server" ID="ddlReplaceAssetType"></asp:DropDownList>
                               </div>
                               <div class="form-group" id="divAssetStatus" runat="server" visible="false">
                                   <label for="ddlReplaceStatus" class="control-label">Replace Status With:</label>
                                   <asp:DropDownList runat="server" ID="ddlReplaceStatus"></asp:DropDownList>
                               </div>
                               <div class="form-group" id="divAssetUsage" runat="server" visible="false">
                                   <label for="ddlReplaceUsage" class="control-label">Replace Usage Type  With:</label>
                                   <asp:DropDownList runat="server" ID="ddlReplaceUsage"></asp:DropDownList>
                               </div>
                               <div class="form-group" id="divChargeType" runat="server" visible="false">
                                   <label for="ddlReplaceChargeType" class="control-label">Replace Charge Type  With:</label>
                                   <asp:DropDownList runat="server" ID="ddlReplaceChargeType"></asp:DropDownList>
                               </div>
                               <div class="form-group" id="divPositionList" runat="server" visible="false">
                                   <label for="ddlPositionList" class="control-label">Replace Position List Name  With:</label>
                                   <asp:DropDownList runat="server" ID="ddlPositionList"></asp:DropDownList>
                               </div>
                               <div class="form-group" id="divAssets" runat="server" visible="false">
                                   <label for="ddlAssets" class="control-label">Replace Asset Name  With:</label>
                                   <asp:DropDownList runat="server" ID="ddlAssets"></asp:DropDownList>
                               </div>
                               <div class="form-group" id="divPayrollTime" runat="server" visible="false">
                                   <label for="ddlPayrollTime" class="control-label">Replace Generates Payroll Time With:</label>
                                   <asp:DropDownList runat="server" ID="ddlPayrollTime"></asp:DropDownList>
                               </div>
                               <div class="form-group" id="divPayrollTimeFor" runat="server" visible="false">
                                   <label for="ddlPayrollTimeFor" class="control-label">Replace Generates Payroll Time For With:</label>
                                   <asp:DropDownList runat="server" ID="ddlPayrollTimeFor"></asp:DropDownList>
                               </div>
                               <div class="form-group" id="divUOM" runat="server" visible="false">
                                   <label for="ddlUOM" class="control-label">Replace Charge Item Unit of Measure Name With:</label>
                                   <asp:DropDownList runat="server" ID="ddlUOM"></asp:DropDownList>
                               </div>
                           <div class="form-group" id="divCompany" runat="server" visible="false">
                                   <label for="cmbCompany">Replace Company Name With:</label>
                                   <div class="input-group">
                                       <telerik:RadComboBox DropDownAutoWidth="Enabled" RenderMode="Lightweight" ID="cmbCompany" EmptyMessage="Type to Select..." runat="server" Width="100%" EnableLoadOnDemand="true" AllowCustomText="true" ShowMoreResultsBox="true" EnableVirtualScrolling="true" >
                                           <WebServiceSettings Method="GetCompanies" Path="~/Portal/Ajax/COGS.asmx" />
                                       </telerik:RadComboBox>
                                       <span class="input-group-btn">
                                           <button runat="server" id="btnClearCompany" type="button" class="btn btn-default" onclick="javascript:ClearCompany();" title="Clear Selected Customer"><span class="s7-close" style="font-size: 20px;"></span></button>
                                       </span>
                                   </div>
                                   <asp:TextBox ID="hidCompany" runat="server" Style="display: none;"></asp:TextBox>
                               </div>
                           </div>
                           </ContentTemplate>
                       </asp:UpdatePanel>
               </div>
           </div>
       </div>
   </div>
</div>
Peter Milchev
Telerik team
 answered on 22 May 2020
3 answers
246 views

Hi,

 

For years I used the following code:

 

            Dim dropDown As RadToolBarDropDown = New RadToolBarDropDown("PageSize")
            dropDown.CssClass = "perPageDropDown"
            dropDown.EnableImageSprite = False
            dropDown.Text = GetGlobalResourceObject("Insight", "Per pagina")
            dropDown.ToolTip = GetGlobalResourceObject("Insight", "Per pagina")
            RadFileExplorer1.ToolBar.Items.Add(dropDown)

 

But after upgrading to R1 2020 i get the error:

 

Bericht: Value property is not supported by RadToolBarDropDown

Stack Trace:
at Telerik.Web.UI.RadToolBarDropDown.get_Value() at Telerik.Web.UI.RadFileExplorer.ConfigureToolbarButtons() at Telerik.Web.UI.RadFileExplorer.ControlPreRender() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

Any clues?

Marc

Peter Milchev
Telerik team
 answered on 22 May 2020
3 answers
209 views
How to change the icon of the collapse/Expand in the radGantt?
bassam
Top achievements
Rank 1
Veteran
 answered on 21 May 2020
10 answers
279 views
Hi,

I'm trying to build a RadGrid and I wanted to use Template columns programmatically, so I followed the tutorial here and everything worked brilliantly. I even got as far as beginning to create a template for the editing and adding of new records. The problem however has occurred that I've added a series of detail tables to my grid and now when I click to expand in to one of the detail tables the Bound columns that I've added to the Master Table still maintain their values but the Template columns completely lose their values.

I don't know if I'm missing something or I'm doing something in an incorrect way but the template columns display so perfectly and the fact that they disappear whenever you expand the grid is really disheartening.

Here's the code:
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
    RenderOrderGrid()
End Sub
Private Sub RenderOrderGrid()
    Dim myDataSet As DataSet
    Dim rgdOrders As RadGrid
    myDataSet = DataManager.OrderList
    '===Set values for RadGrid===
    rgdOrders = New RadGrid
    rgdOrders.AllowPaging = True
    rgdOrders.AutoGenerateColumns = False
    rgdOrders.GroupingEnabled = False
    rgdOrders.ShowGroupPanel = True
    rgdOrders.AllowSorting = False
    rgdOrders.PagerStyle.AlwaysVisible = True
    rgdOrders.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric
    rgdOrders.ClientSettings.AllowDragToGroup = False
    rgdOrders.MasterTableView.PageSize = 20
    rgdOrders.MasterTableView.Name = "OrdersMasterTable"
    rgdOrders.AutoGenerateEditColumn = True
    rgdOrders.AutoGenerateDeleteColumn = False
    rgdOrders.Skin = Session("TelerikSkin")
    rgdOrders.DataSource = myDataSet.Tables("OrderList")
    '===Set values for Master Table===
    rgdOrders.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top
    rgdOrders.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = False
    rgdOrders.MasterTableView.CommandItemSettings.ShowRefreshButton = True
    rgdOrders.MasterTableView.CommandItemSettings.RefreshImageUrl = "../img/Refresh.gif"
    rgdOrders.MasterTableView.CommandItemSettings.RefreshText = "Refresh Grid"
    '===Create Columns===
    RenderColumns(rgdOrders)
    '===Create a table view to use as detail table===
    Dim myDetailTable As Telerik.Web.UI.GridTableView
    myDetailTable = New GridTableView
    myDetailTable.Width = Unit.Percentage(100)
    myDetailTable.Name = "AdminOrdersOrderlinesDetailTable"
    rgdOrders.MasterTableView.DetailTables.Add(myDetailTable)
    myDetailTable = New GridTableView
    myDetailTable.Width = Unit.Percentage(100)
    myDetailTable.Name = "AdminOrdersNotesDetailTable"
    rgdOrders.MasterTableView.DetailTables.Add(myDetailTable)
    AddHandler rgdOrders.ColumnCreated, AddressOf rgdOrders_ColumnCreated
    AddHandler rgdOrders.DetailTableDataBind, AddressOf rgdOrders_DetailTableDataBind
    rgdOrders.MasterTableView.TableLayout = GridTableLayout.Fixed
    divOrders.Controls.Add(rgdOrders)
End Sub
Private Sub RenderColumns(ByRef rgdOrders As RadGrid)
    '===Create Columns===
    Dim orderIDColumn, statusColumn As GridBoundColumn
    Dim customerTemplateColumn, dateTemplateColumn, repCodeScanNoTemplateColumn, contactLettersTemplateColumn As GridTemplateColumn
    'Order ID Column
    orderIDColumn = New GridBoundColumn()
    orderIDColumn.HeaderText = "Order ID"
    orderIDColumn.UniqueName = "mkOrderId"
    orderIDColumn.DataField = "mkOrderId"
    orderIDColumn.HeaderStyle.CssClass = "gridFont"
    orderIDColumn.HeaderStyle.Width = 60
    orderIDColumn.ItemStyle.CssClass = "gridFont"
    'Customer Details Column
    customerTemplateColumn = New GridTemplateColumn()
    customerTemplateColumn.ItemTemplate = New CustomerTemplate("CustomerName")
    customerTemplateColumn.HeaderText = "Customer Details"
    customerTemplateColumn.UniqueName = "CustomerDetails"
    customerTemplateColumn.HeaderStyle.CssClass = "gridFont"
    customerTemplateColumn.ItemStyle.CssClass = "gridFont"
    'Dates Column
    dateTemplateColumn = New GridTemplateColumn()
    dateTemplateColumn.ItemTemplate = New DateTemplate("Dates")
    dateTemplateColumn.HeaderText = "Dates"
    dateTemplateColumn.UniqueName = "Dates"
    dateTemplateColumn.HeaderStyle.CssClass = "gridFont"
    dateTemplateColumn.HeaderStyle.Width = 150
    dateTemplateColumn.ItemStyle.CssClass = "gridFont"
    'Status Column
    statusColumn = New GridBoundColumn()
    statusColumn.DataField = "Status"
    statusColumn.HeaderText = "Status"
    statusColumn.UniqueName = "Status"
    statusColumn.HeaderStyle.CssClass = "gridFont"
    statusColumn.HeaderStyle.Width = 120
    statusColumn.ItemStyle.CssClass = "gridFont"
    'RepCode/ScanNo Column
    repCodeScanNoTemplateColumn = New GridTemplateColumn()
    repCodeScanNoTemplateColumn.ItemTemplate = New RepCodeScanNoTemplate("RepCodeScanNo")
    repCodeScanNoTemplateColumn.HeaderText = "Rep Code / Scan No"
    repCodeScanNoTemplateColumn.UniqueName = "RepCode"
    repCodeScanNoTemplateColumn.HeaderStyle.CssClass = "gridFont"
    repCodeScanNoTemplateColumn.HeaderStyle.Width = 150
    repCodeScanNoTemplateColumn.ItemStyle.CssClass = "gridFont"
    'Print Letters
    contactLettersTemplateColumn = New GridTemplateColumn()
    contactLettersTemplateColumn.ItemTemplate = New ContactLettersTemplate("PrintLetters")
    contactLettersTemplateColumn.HeaderText = "Print Letters"
    contactLettersTemplateColumn.UniqueName = "PrintLetters"
    contactLettersTemplateColumn.HeaderStyle.CssClass = "gridFont"
    contactLettersTemplateColumn.HeaderStyle.Width = 80
    contactLettersTemplateColumn.ItemStyle.CssClass = "gridFont"
    'Add Columns To Grid
    rgdOrders.MasterTableView.Columns.Add(orderIDColumn)
    rgdOrders.MasterTableView.Columns.Add(customerTemplateColumn)
    rgdOrders.MasterTableView.Columns.Add(dateTemplateColumn)
    rgdOrders.MasterTableView.Columns.Add(statusColumn)
    rgdOrders.MasterTableView.Columns.Add(repCodeScanNoTemplateColumn)
    rgdOrders.MasterTableView.Columns.Add(contactLettersTemplateColumn)
End Sub
Private Sub rgdOrders_DetailTableDataBind(ByVal source As Object, ByVal e As GridDetailTableDataBindEventArgs)
    Dim dataItem As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem)
    Select Case e.DetailTableView.DetailTableIndex
        Case 0
            Dim myOrderId As Decimal = CDec(dataItem.Item("mkOrderId").Text)
            Dim myDataSet As New DataSet
            '===Get the DetailTable data===
            myDataSet = DataManager.OrderLinesGet(myOrderId)
            e.DetailTableView.DataSource = myDataSet.Tables("OrderLines")
            e.DetailTableView.AutoGenerateColumns = False
            e.DetailTableView.CommandItemDisplay = GridCommandItemDisplay.Top
            e.DetailTableView.CommandItemSettings.ShowAddNewRecordButton = False
            e.DetailTableView.CommandItemSettings.ShowRefreshButton = False
            e.DetailTableView.Name = "AdminOrdersOrderlinesDetailTable"
            e.DetailTableView.AllowPaging = True
            Dim boundColumn As GridBoundColumn
            'Product Name Column
            boundColumn = New GridBoundColumn()
            boundColumn.HeaderText = "Product Name"
            boundColumn.UniqueName = "ProductName"
            boundColumn.DataField = "ProductName"
            boundColumn.HeaderStyle.CssClass = "gridFont"
            boundColumn.ItemStyle.CssClass = "gridFont"
            e.DetailTableView.Columns.Add(boundColumn)
            'Quantity Column
            boundColumn = New GridBoundColumn()
            boundColumn.HeaderText = "Quantity"
            boundColumn.UniqueName = "Quantity"
            boundColumn.DataField = "Quantity"
            boundColumn.HeaderStyle.CssClass = "gridFont"
            boundColumn.HeaderStyle.Width = 120
            boundColumn.ItemStyle.CssClass = "gridFont"
            e.DetailTableView.Columns.Add(boundColumn)
            'Unit Price Column
            boundColumn = New GridBoundColumn()
            boundColumn.HeaderText = "Unit Price"
            boundColumn.UniqueName = "UnitPrice"
            boundColumn.DataField = "UnitPrice"
            boundColumn.HeaderStyle.CssClass = "gridFont"
            boundColumn.HeaderStyle.Width = 120
            boundColumn.ItemStyle.CssClass = "gridFont"
            e.DetailTableView.Columns.Add(boundColumn)
            'Line Total Column
            boundColumn = New GridBoundColumn()
            boundColumn.HeaderText = "Line Total"
            boundColumn.UniqueName = "LineTotal"
            boundColumn.DataField = "LineTotal"
            boundColumn.HeaderStyle.CssClass = "gridFont"
            boundColumn.HeaderStyle.Width = 120
            boundColumn.ItemStyle.CssClass = "gridFont"
            e.DetailTableView.Columns.Add(boundColumn)
        Case 1
            Dim myOrderId As Decimal = CDec(dataItem.Item("mkOrderId").Text)
            Dim myDataSet As New DataSet
            '===Get the DetailTable data===
            myDataSet = DataManager.OrderNotesGet(myOrderId)
            e.DetailTableView.DataSource = myDataSet.Tables("OrderNotesGet")
            e.DetailTableView.AutoGenerateColumns = False
            e.DetailTableView.CommandItemDisplay = GridCommandItemDisplay.Top
            e.DetailTableView.CommandItemSettings.AddNewRecordImageUrl = "../img/AddRecord.gif"
            e.DetailTableView.CommandItemSettings.AddNewRecordText = "Add New Record"
            e.DetailTableView.CommandItemSettings.ShowRefreshButton = False
            e.DetailTableView.Name = "AdminOrdersNotesDetailTable"
            e.DetailTableView.AllowPaging = True
            Dim boundColumn As GridBoundColumn
            'Date / Time Added Column
            boundColumn = New GridBoundColumn()
            boundColumn.HeaderText = "Date / Time Added"
            boundColumn.UniqueName = "DateTimeAdded"
            boundColumn.DataField = "DateTimeAdded"
            boundColumn.HeaderStyle.CssClass = "gridFont"
            boundColumn.HeaderStyle.Width = 120
            boundColumn.ItemStyle.CssClass = "gridFont"
            e.DetailTableView.Columns.Add(boundColumn)
            'Note Type Column
            boundColumn = New GridBoundColumn()
            boundColumn.HeaderText = "Note Type"
            boundColumn.UniqueName = "Type"
            boundColumn.DataField = "Type"
            boundColumn.HeaderStyle.CssClass = "gridFont"
            boundColumn.HeaderStyle.Width = 80
            boundColumn.ItemStyle.CssClass = "gridFont"
            e.DetailTableView.Columns.Add(boundColumn)
            'Note Column
            boundColumn = New GridBoundColumn()
            boundColumn.HeaderText = "Note"
            boundColumn.UniqueName = "Note"
            boundColumn.DataField = "Note"
            boundColumn.HeaderStyle.CssClass = "gridFont"
            boundColumn.ItemStyle.CssClass = "gridFont"
            e.DetailTableView.Columns.Add(boundColumn)
            'User Column
            boundColumn = New GridBoundColumn()
            boundColumn.HeaderText = "User"
            boundColumn.UniqueName = "UserName"
            boundColumn.DataField = "UserName"
            boundColumn.HeaderStyle.CssClass = "gridFont"
            boundColumn.HeaderStyle.Width = 80
            boundColumn.ItemStyle.CssClass = "gridFont"
            e.DetailTableView.Columns.Add(boundColumn)
    End Select
End Sub

Any help on this problem would be greatly appreciated.
Rahul
Top achievements
Rank 1
 answered on 21 May 2020
2 answers
423 views

Hello.

I have to support old legacy project based on Telerik.Web.UI, 2011.3.1115.40.

 

Please help: where i can find documentation for controls ?

Andrew
Top achievements
Rank 1
 answered on 21 May 2020
1 answer
513 views

Hi!

I am using a radgrid in batch EditMode with EditType Cell.

Inside the grid i have several GridTemplateColumns with a raddropdown control each, which should change style according to the value selected on each.

I am trying to find a way on BatchEditClosed or BatchEditCellValueChanged events to re-attach the css class that i use in ItemTemplate for dislpaying the selected value.

Here is my grid:

<telerik:RadGrid
                            RenderMode="Lightweight"
                            runat="server"
                            ID="RadGridLesions"
                            AllowPaging="True"
                            AllowSorting="True"
                            AutoGenerateColumns="False"
                            Skin="BlackMetroTouch"
                            CssClass="dark-grey"
                            OnNeedDataSource="RadGridLesions_NeedDataSource"
                            OnPreRender="RadGridLesions_PreRender"
                            OnItemDataBound="RadGridLesions_ItemDataBound"
                            ShowStatusBar="True"
                             
                            AllowAutomaticInserts="False"
                            AllowAutomaticDeletes="True"
                            AllowAutomaticUpdates="True"
                             
                            ItemCommand="RadGridLesions_ItemCommand"
                            UpdateCommand="RadGridLesions_UpdateCommand"
                            DeleteCommand="RadGridLesions_DeleteCommand"
                            OnBatchEditCommand="RadGridLesions_BatchEditCommand"
                            >
                            <MasterTableView
                                CommandItemDisplay="Top"
                                EditMode="Batch"
                                DataKeyNames="Id, Segment, Level, Side"
                                Name="GradesTable"
                                >
                                <PagerStyle />
 
                                <BatchEditingSettings
                                    SaveAllHierarchyLevels="false"
                                    HighlightDeletedRows="false"
                                    EditType="Cell"
                                    OpenEditingEvent="Click" />
                                <Columns>
 
                                       <telerik:GridTemplateColumn
                                        HeaderText="T2"
                                        HeaderStyle-Width="70px"
                                        ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
                                        UniqueName="T2Grade"
                                        DataField="T2Grade">
                                        <ItemTemplate>
                                            <div id="T2Grade-container" class='<%# "grade a" & Eval("T2Grade") %>'>
                                                <%# Eval("T2Grade") %>
                                            </div>
                                        </ItemTemplate>
                                        <EditItemTemplate>
                                            <telerik:RadDropDownList
                                                RenderMode="Lightweight"
                                                runat="server"
                                                ID="T2GradeDropDownList"
                                                AutoPostBack="false"
                                                Skin="BlackMetroTouch"
                                                SelectedValue='<%# Eval("T2Grade") %>'>
                                                <Items>
                                                    <telerik:DropDownListItem Text="1" Value="1" CssClass="one" />
                                                    <telerik:DropDownListItem Text="2" Value="2" CssClass="two" />
                                                    <telerik:DropDownListItem Text="3" Value="3" CssClass="three" />
                                                    <telerik:DropDownListItem Text="4" Value="4" CssClass="four" />
                                                    <telerik:DropDownListItem Text="5" Value="5" CssClass="five" />
                                                </Items>
                                            </telerik:RadDropDownList>
                                        </EditItemTemplate>
                                    </telerik:GridTemplateColumn>

 

The issue i have now is that if i select a different value in the drop-down the styling of the "old" one remains and changes only when i press the save button.

I would like to re-evaluate the expression attaching the css class to the div (class='<%# "grade a" & Eval("T2Grade") %>') on client side, when the value is changed in the drop down.

I assume i can do that like:

function BatchEditCellValueChanged(sender, args) {
 
                    //alert(BatchEditCellValueChanged);
                    var grid = sender;
                    var masterTableView = sender.get_masterTableView();
                    var batchEditingManager = sender.get_batchEditingManager();
 
                    var row = args.get_row();
                    var cell = args.get_cell();
                    var tableView = args.get_tableView();
                    var column = args.get_column();
                    var columnUniqueName = args.get_columnUniqueName();
                    //new value
                    var editorValue = args.get_editorValue();
                    //old value
                    var cellValue = args.get_cellValue();
                     
 
                    if (args.get_columnUniqueName() === "T2Grade") {
 
                        //try and change css class of edited cell -
    //something like: cell.findElement("T2Grade-container").className = "<%re-evaluate expression%>";
                         
                    }     
                     
                }

 

Any ideas on how i can achieve that? Up to the moment i have not found a way to grad the div element inside the itemTemplate and change its css class.

 

 

 

Doncho
Telerik team
 answered on 21 May 2020
2 answers
159 views
I spent some time looking around for info on this and didn't find a good answer as to how to do this without having to use the detailstable databinding and databound events. In all the examples I found they all used the radgrid.MasterTableView.Items collection specifically. My solution turned out to be simpler by using e.Column.Owner.Items from the GridCustomAggregateEventArgs. By checking the e.Owner.Name that is set in the designer properties I can then tell which table that I'm trying to preform the custom Aggregate for and return different results.

In an effort to save others some time here, I'm posting some example code for this.

Protected Sub rg_CustomAggregate(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCustomAggregateEventArgs) Handles rg.CustomAggregate
 
    Dim i, j, k, l, m, n As Integer
    For Each di As GridDataItem In e.Column.Owner.Items
        If e.Column.Owner.Name = "MainTableName" Then
            'preform you custom aggregation calculations
            i += CType(di.GetDataKeyValue("maintablecolumn1"), Integer)
            j += CType(di.GetDataKeyValue("maintablecolumn2"), Integer)
            k += CType(di.GetDataKeyValue("maintablecolumn3"), Integer)
            e.Result = Decimal.Round(Convert.ToDecimal((i + j) / k * 100), 2)
        End If
        If e.Column.Owner.Name = "DetailTableName" Then
            l += CType(di.GetDataKeyValue("detailtablecolumn1"), Integer)
            m += CType(di.GetDataKeyValue("detailtablecolumn2"), Integer)
            n += CType(di.GetDataKeyValue("detailtablecolumn3"), Integer)
            e.Result = Decimal.Round(Convert.ToDecimal((i + j) / k * 100), 2)
        End If
    Next
End Sub
Key
Top achievements
Rank 1
 answered on 21 May 2020
6 answers
166 views

Im creating an user control. In my control I need to create programmatically some Combo Boxes. In some cases, I need a Calendar as a Template in my comboBox but im facing two situations.

1. I cannot deselect dates in my calendar. Once I make a selection, calendar has always at least one selected date and if I click the selected day, this day remains selected.

As you can see in the 1.gif file attached, I can select dates normally but I try to deselect by clicking on 15th several times and I'm not able to. I can change the date selection (I moved to 12th) but is not possible to unselect.

2. When I clic Calendar header to choose years and mothes, the popup appears behind the combobox. See 2.gif

 

Javascript fucntions

function OnClientDropDownClosing(sender, args) {
        if (args.get_domEvent().target == sender.get_imageDomElement()) {
            args.set_cancel(false);
        }
        else {
            args.set_cancel(true);
        }
    }
 
    function OnClientDropDownClosed(sender, args) {
        var SenderId = sender.get_id().replace("FiltrosNativos_","");
        var CalId = SenderId.replace("RadComboBox", "RadCalendar");
        var Cal = sender.get_items().getItem(0).findControl(CalId);
 
        var dates = Cal.get_selectedDates();
         
        if (dates.length == 0) { sender.set_emptyMessage("Elija Fechas"); }
        else {
            var dt1 = dates[0];
            var dt2 = dates[dates.length - 1];
            var rango = dt1[2] + '/' + dt1[1] + '/' + dt1[0] + ' -- ' + dt2[2] + '/' + dt2[1] + '/' + dt2[0];
            sender.set_emptyMessage(rango);
             
        }
         
    }

 

 

 

 

VB

Private Sub CrearObjetos()
 
        Dim uPass As New UtilSecurity
        Dim sCnnStr As String = uPass.Desencrit(ConfigurationManager.AppSettings("CnnStringSE").Trim)
        Dim uDBA As New UtilBDAccess(sCnnStr)
        Tabla = New Table
 
        Tabla.ID = "TbFiltros"
 
 
 
        For Each row As DataRow In _dtFiltros.Rows
            Dim CBO As New RadComboBox
 
            Dim sLabel As String = row("Label").ToString.Trim
            Dim Label As New Label
            Dim Tr As New TableRow
            Dim TcLabel As New TableCell
            Dim TcObj As New TableCell
 
            Label.Text = sLabel & ":" & RepetirCadena(" ", 15 - sLabel.Length - 1)
            'Label.Text = sLabel & ":" & RepetirCadena(" ", 15 - sLabel.Length - 1)
 
            TcLabel.Controls.Add(Label)
 
            CBO.ID = "RadComboBox" & row("TargetCatField")
            CBO.Width = Unit.Pixel(IIf(_Width = 0, 500, _Width))
            CBO.RenderMode = RenderMode.Lightweight
            CBO.Skin = _Skin
            CBO.Label = ""
 
 
 
            If row("TargetType") = "DATE" Then
                CBO.EmptyMessage = "Elija Fechas"
                CBO.OnClientDropDownClosing = "OnClientDropDownClosing"
                CBO.OnClientDropDownClosed = "OnClientDropDownClosed"
                CBO.ItemTemplate = New CboTmplCalendar("RadCalendar" & row("TargetCatField"), _Skin)
                CBO.Items.Add(New RadComboBoxItem(""))
 
                CBO.DataBind()
            Else
                CBO.MarkFirstMatch = True
                CBO.EnableLoadOnDemand = True
                CBO.Filter = RadComboBoxFilter.Contains
                CBO.EmptyMessage = "Elija " & row("Label")
                uDBA.BindOnjectDB(CBO, row("Query"), row("DataTextField"), row("DataValueField"))
            End If
 
 
            TcObj.Controls.Add(CBO)
            Tr.Cells.Add(TcLabel)
            Tr.Cells.Add(TcObj)
 
            Tabla.Rows.Add(Tr)
 
 
        Next
        PHCbosFiltros.Controls.Add(Tabla)
    End Sub
 
Private Class CboTmplCalendar
        Implements ITemplate
        Protected MyCalendar As RadCalendar
 
        Private _ObjName As String
        Private _Skin As String
        Public Sub New(ByVal objName As String, Skin As String)
            _ObjName = objName
            _Skin = Skin
        End Sub
        Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn
 
            MyCalendar = New RadCalendar()
            With MyCalendar
 
                .EnableViewState = True
                .ID = _ObjName
                .Skin = _Skin
                .RenderMode = RenderMode.Lightweight
                .AutoPostBack = False
                .RangeSelectionMode = Calendar.RangeSelectionMode.ConsecutiveClicks
 
 
            End With
            container.Controls.Add(MyCalendar)
        End Sub
 
    End Class
Gilberto
Top achievements
Rank 1
Veteran
 answered on 21 May 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?