Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
354 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
454 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
115 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
115 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
1 answer
561 views

Hello,

I have read the other threads, and I am not having much success. I can export a URL as text, but I haven't been able to get it to show up as a clickable link in an xlsx file. Can someone please help me? Below are the examples preceded by a note about its behavior:

 

[ This one doesn't show anything in the text cell. I read on an old post that this is to be expected. ]
<telerik:GridHyperLinkColumn AllowFiltering="False" AllowSorting="False" Visible="true"
 HeaderText="View0.0"
 Text="View Page"
 Target="_blank"
 DataNavigateUrlFormatString="page.aspx?autoid={0}"
 DataNavigateUrlFields="SpecimenAutoID">
    <HeaderStyle Width="50px" HorizontalAlign="Center"></HeaderStyle>
</telerik:GridHyperLinkColumn>

[This displays the cell as source html.]
<telerik:GridTemplateColumn HeaderText="View1.0" >
    <ItemTemplate>
        <a href="https://www.google.com">Click here to open the folder</a>
    </ItemTemplate>
    <HeaderStyle Width="200px" HorizontalAlign="Center"></HeaderStyle>
</telerik:GridTemplateColumn>

[This displays the cell as source html.]
<telerik:GridTemplateColumn HeaderText="View1.1" >
    <ItemTemplate>
        <a href="https://www.google.com">https://www.google.com</a>
    </ItemTemplate>
    <HeaderStyle Width="200px" HorizontalAlign="Center"></HeaderStyle>
</telerik:GridTemplateColumn>

 

[This displays the link as a text string.]
<telerik:GridTemplateColumn HeaderText="View1.2" >
    <ItemTemplate>
        https://www.google.com
    </ItemTemplate>
    <HeaderStyle Width="200px" HorizontalAlign="Center"></HeaderStyle>
</telerik:GridTemplateColumn>

[This displays the data field as text string]
<telerik:GridBoundColumn Visible="false" SortExpression="directURL" HeaderText="View Specimen" HeaderButtonType="TextButton"
                         DataField="directURL" Exportable="True" UniqueName="hiddenDirectURL" >
    <HeaderStyle Width="200px" HorizontalAlign="Center"></HeaderStyle>
</telerik:GridBoundColumn>

Any suggestions would be appreciated. Thanks.

Dan

 

Doncho
Telerik team
 answered on 21 May 2020
3 answers
439 views
i am trying to use two rad grid on the same page. the grid is working fine but i am unable to see the second grid. i am getting the value from the first grid and then on button click i am filling the other grid. any idea why i am not getting the second grid on the run time. as i can still both of the grids in design mode.

if you need i can post the coding also.

thanks & Regards
Doncho
Telerik team
 answered on 20 May 2020
1 answer
183 views

Hi

I am using the asp.net charting control.  I am plotting data over time, sometimes over days, weeks, months and years.  I would like th X axis (which shows time) on the graph to be sequential even if the data is not.  eg, if a week/month/year is missing it will plot a the item on the X axis but not have a value (hope that makes sense).  So effectively the chart looks like a timeline of data, the gaps shows missing data

 

Is this possible with the chart control?

Many thanks in advance

 

 

 

 


Vessy
Telerik team
 answered on 20 May 2020
2 answers
525 views
I have a grid form in ASP.Net VB.Net with the following Special Char "≤". It is appearing fine in the Web form and Excel export but the PDF it replaces with a # char. How can I get this character, â‰¤ to display.
Chuck
Top achievements
Rank 1
Veteran
 answered on 20 May 2020
11 answers
365 views
Hi,

From client side code, Is it possible to retrieve data from the current datasource of the HtmlChart to an array of JSON objects and store it in a variable?

Thanks,
Teena.
Vessy
Telerik team
 answered on 20 May 2020
1 answer
188 views

I have a AdvandeForm with a radComboBox

 <li class="rfbRow">
                   <asp:Label runat="server" Text="Empleado" CssClass="rfbLabel" />
                    <telerik:RadComboBox runat="server" ID="RadUser" Type="User" Filter="Contains" />
 </li>

 

And i want to fill this combo on the Default.aspx.vb and not on the AdvanceForm.ascx.vb.

How can I get the radComboBox and fill it?

Peter Milchev
Telerik team
 answered on 20 May 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?