Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
275 views

there is any way to set visible or invisible in the control through javascript?

there is a method set_enabled, but I want to hide the control

I've tried with querySelector in the event onClientLoad

sender._element.querySelector('.RadMultiSelect');

but the resul is null

thanks

Doncho
Telerik team
 answered on 03 Jun 2020
5 answers
2.0K+ views

I have did app scan on a ASP.Net Application developed with Telerik Controls,

 I received following vulnerabilities related to telerik Controls 

 

1. Catchable SSL Page Found

2. Client Side (Javascript) Cookie References 

3.Query parameter in SSL Request

 

As per our Security feedback , these issues should be rectified, I had already explained that these are just assemblies which doesnt do any database operation and can be treated as false positive. But they suggested to refer Australian Cyber Security Centre report on Advisory: Vulnerable versions of Telerik
UI being actively exploited by APT actor.

 

Please support in order to resolve the issue. 

Rumen
Telerik team
 answered on 03 Jun 2020
4 answers
200 views

I have the following treeview

<telerik:RadTreeView ID="tvProcInst" runat="server" CheckBoxes="True" CausesValidation="False"
    DataTextField="LEVEL_NAME" DataValueField="LEVEL_CODE" RenderMode="Lightweight"
    CssClass="Left" MultipleSelect="True">
</telerik:RadTreeView>

 

that is loaded from a linq query once in the page load.  That all works fine.  Each time a user checks a node I add a combobox with the following code

Private Sub tvProcInst_NodeCheck(sender As Object, e As RadTreeNodeEventArgs) Handles tvProcInst.NodeCheck
    Dim cb As New RadComboBox
    Dim cn As New RadTreeNode
 
    If e.Node.ParentNode IsNot Nothing Then
        Return
    End If
 
    If e.Node.HasControls Then
        If Not e.Node.Checked Then
            e.Node.Controls.Clear()
        End If
        Return
    End If
 
    Dim row As New RadComboBoxItem
    row.Value = "R"
    row.Text = "Recurring"
    cb.Items.Add(row)
 
    row = New RadComboBoxItem
    row.Value = "N"
    row.Text = "Non-Recurring"
 
    cb.Items.Add(row)
    cb.ID = "cb" & e.Node.Value
 
    cn.Controls.Add(cb)
    cn.Checkable = False
 
    e.Node.Nodes.Add(cn)
    e.Node.Expanded = True
End Sub

 

it will add the combobox no problem, but will not clear it upon unchecking the checkbox, and when checking another checkbox it will create the new one, but the previously created combobox goes away or goes invisible I can't figure out which because the controls.count is still 1 but yet I can't see it.

Hopefully this makes sense.  If screen shots will help I can supply them if needed.

SSirica
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 03 Jun 2020
3 answers
498 views

Hi, I want to move my styles to a css class:

 

From:

<EnabledStyle BorderColor="#e0e0e0" BorderWidth="1" Width="48" Height="36px" HorizontalAlign="Center" />

To:

<EnabledStyle CssClass="my-class" />

    .my-class {
        border: 12px solid #e0e0e0; 
        width: 48px; 
        height: 36px;
        text-align: center;
    }

But that is not working, the NumericTextbox never gets styled ....

Please enlightenme what I have to do to make it work, thank you!

Tom

Rumen
Telerik team
 answered on 03 Jun 2020
1 answer
144 views

I am having a problem that I have been trying for a while to figure out.

I have a RadGrid that has a GridButtonColumn connected to c# function that I use to pull path and file info from a database and open the file from a file server.

If I use this on an ASPX page by itself, it works like a charm.

If I include this same RadGrid control and code in another RadGrid Edit Form, the function runs and appears to complete successfully.

I debug it and it runs and completes just the same, the file.FullName is right, just like when it tuns in the other form, but the Response.Flush does not open the file.

When the Response.Flush runs in the debugger, I see the focus go back to the browser for a flash and back to the debugger, but no file open dialog or anything else.

I bet someone out there knows what is going on.  Help!

Thanks!

Here is my ItemCommand call:

protected void OpenAttchTable_ItemCommand(object sender, GridCommandEventArgs e)
{
 
    if (e.CommandName == "Open")// CommandName of LinkButton
    {
 
        GridDataItem item = e.Item as GridDataItem;
        String filePath = @item["filePath"].Text;
        String fileName = item["fileName"].Text;
        String FullFilePath = @filePath + fileName;
        FileInfo file = new FileInfo(FullFilePath);
 
        String fileExt = file.Extension;
        switch (fileExt)
        {
            case ".csv":
                Response.ContentType = "text/csv";
                break;
            case ".doc":
                Response.ContentType = "application/msword";
                break;
            case ".docx":
                Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
                break;
            case ".gif":
                Response.ContentType = "image/gif";
                break;
            case ".jpeg":
                Response.ContentType = "image/jpeg";
                break;
            case ".jpg":
                Response.ContentType = "image/jpeg";
                break;
            case ".pdf":
                Response.ContentType = "application/pdf";
                break;
            case ".png":
                Response.ContentType = "image/png";
                break;
            case ".ppt":
                Response.ContentType = "application/vnd.ms-powerpoint";
                break;
            case ".pptx":
                Response.ContentType = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
                break;
            case ".txt":
                Response.ContentType = "text/plain";
                break;
            case ".xls":
                Response.ContentType = "application/vnd.ms-excel";
                break;
            case ".xlsx":
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                break;
            default:
                Response.ContentType = "application/octet-stream";
                break;
        }
 
        if (file.Exists)
        {
            if (file.Length > 30000000)
            {
                String Message = "The file exceeds the Maximum length of 30 Megabytess.";
                ClientScript.RegisterStartupScript(this.GetType(), "Warnings", "alert('" + Message + "');", true);
            }
            else
            {
                Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
                Response.AddHeader("Content-Length", file.Length.ToString());
                Response.ClearContent();
                Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
                Response.AddHeader("Content-Length", file.Length.ToString());
                Response.TransmitFile(file.FullName);
                Response.Flush();
                Response.End();
 
            }
        }
    }
}

 

 Here is my ASPX Markup:
<asp:Panel runat="server" Visible="true">
    <div class="row">
        <div class="col-sm-12">
        <div id="OpenAttchGridDiv" runat="server" Visible ="true">
        <telerik:RadGrid ID="OpenAttchTable" EnableViewState="true" runat="server" AutoGenerateColumns="false" GridLines="Both" AllowPaging="false"
        PageSize="10" AllowFilteringByColumn="False" AllowSorting="true" ShowStatusBar="false" MasterTableView-CommandItemDisplay="None"
        AllowAutomaticDeletes="true" AllowAutomaticInserts="false" AllowAutomaticUpdates="false"
        MasterTableView-EditMode="EditForms" Skin="Metro"
        OnNeedDataSource="OpenAttchTable_NeedDataSource"
        OnItemCommand="OpenAttchTable_ItemCommand" >
        <GroupingSettings CaseSensitive="false" />
            <ClientSettings>
                    <ClientEvents OnPopUpShowing="PopUpShowing" />
            </ClientSettings>
            <MasterTableView Width="100%" UseAllDataFields="true" ShowHeader="true" InsertItemDisplay="Top" CommandItemDisplay="None" InsertItemPageIndexAction="ShowItemOnFirstPage">
                <EditFormSettings>
                    <PopUpSettings Modal="true" ZIndex="10" ScrollBars="Vertical" />
                </EditFormSettings>
                <Columns>
                    <%--<telerik:GridEditCommandColumn UniqueName="EditCommandcolumn"></telerik:GridEditCommandColumn>--%>
                    <telerik:GridBoundColumn UniqueName="helpDeskTicketID" DataField="helpDeskTicketID" Visible="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="helpDeskAttachmentID" DataField="helpDeskAttachmentID" Display="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="attachmentTypeID" DataField="attachmentTypeID" Visible="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="attachmentTypeDesc" DataField="attachmentTypeDesc" Visible="true" HeaderText="Attachment Type" AllowFiltering="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="attachmentVersionID" DataField="attachmentVersionID" Visible="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="attachmentVersionDesc" DataField="attachmentVersionDesc" Visible="false" HeaderText="Version" AllowFiltering="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="fileDescription" DataField="fileDescription" Visible="true" HeaderText="Description" AllowFiltering="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="filePath" DataField="filePath" Display="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="fileName" DataField="fileName" Display="false"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="originalFileName" DataField="originalFileName" Visible="false" HeaderText="Original File Name"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="active" DataField="active" Visible="false"></telerik:GridBoundColumn>
                    <telerik:GridButtonColumn CommandName="Open" Text="Open" UniqueName="OpenFile" HeaderText=""></telerik:GridButtonColumn>
                </Columns>
                <CommandItemSettings AddNewRecordText="Add New Attachment" RefreshText="Refresh" ShowAddNewRecordButton="false" />
                <EditFormSettings EditFormType="Template"  FormStyle-Height="100%" FormStyle-Width="100%" PopUpSettings-ScrollBars="Vertical">
                    <FormTemplate>
                        <div class="row" style="padding-left:10px">
                            <div class="col-sm-1"> 
                                    <asp:TextBox ID="FileNameText" runat="server"
                                        CssClass="form-control"
                                        Text='<%# Bind("fileName") %>' >
                                    </asp:TextBox>                              
 
                                </div>
                                <div class="col-sm-1"> 
                                    <asp:TextBox ID="FilePathText" runat="server"
                                        CssClass="form-control"
                                        Text='<%# Bind("filePath") %>' >
                                    </asp:TextBox>                              
                                </div>
                            </div>
 
                            <div class="col-sm-3" > 
                                <div class="form-group">
                                    <label>Version<span style="color:red; font-size:large"> *</span></label>
                                    <asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server"
                                    ControlToValidate="attachmentVersionList"
                                    ErrorMessage="REQUIRED!"
                                    ForeColor="Red"
                                    Font-Size="Medium"
                                    Font-Bold="true" >
                                    </asp:RequiredFieldValidator>
                                    <asp:DropDownList ID="attachmentVersionList" runat="server" CssClass="form-control"
                                        AutoPostBack="false" ToolTip="Required" Width="66%"></asp:DropDownList>
                                </div>
                            </div>
                            <div class="col-sm-1">
                            <asp:TextBox ID ="TextBox1" runat="server" Visible="true" Text='<%# Bind("filePath") %>'></asp:TextBox>
                            <asp:TextBox ID ="TextBox2" runat="server" Visible="true" Text='<%# Bind("fileName") %>'></asp:TextBox>
 
                            </div>
                        </div>
                </FormTemplate>
            </EditFormSettings>
            <NoRecordsTemplate>
                <div>
                    There are no attachments for this ticket.
                </div>
            </NoRecordsTemplate>        
        </MasterTableView>
    </telerik:RadGrid>
 
    </div>
 </div>
</div>
</asp:Panel>


 

 

 

 

Eyup
Telerik team
 answered on 03 Jun 2020
5 answers
562 views
hi,
I need to show only tokens in single html row. 
How can I remove the border of RadAutoCompleteBoxx control? Not the border of tokens!.
I tried with following css class "ReadOnlyAutoCompleteBox", but it didn't work.

[Markup]
<telerik:RadAutoCompleteBox ID="AutoCompleteBox1" runat="server" 
InputType="Token" Width="280" CssClass="ReadOnlyAutoCompleteBox" Enabled="false" >
<Entries>
<telerik:AutoCompleteBoxEntry Text="Token 1" />
<telerik:AutoCompleteBoxEntry Text="Token 2" />
<telerik:AutoCompleteBoxEntry Text="Token 3" />
</Entries>
</telerik:RadAutoCompleteBox>

[Css]
.ReadOnlyAutoCompleteBox {
    outline: none!important;
    border-style: none!important;
    border-width: 0px!important;
}


Thanks in advanced.
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
 answered on 02 Jun 2020
1 answer
431 views

Hi,

We might be missing something but when saving Gantt, containing Cyrillic fonts, those are not showing correctly. Could you please advice?

Fonts are showing correctly on the form.

Best regards, Mikko

Peter Milchev
Telerik team
 answered on 02 Jun 2020
2 answers
206 views

Hello,

Is there a way to persist the uploaded files after redirecting to another page and returning?

Setting the PostbackTriggers property doesn't work as this is not a postback but a redirect and return.

I tried using session to do this by saving the UploadedFileCollection to session and setting it back after returning from a redirect but I can't find a way to set the UploadedFiles property of the RadAsyncUpload control in code behind. I know this behavior is not supported due to browser security.

Please let me know if there is any other way to do this.

Thanks.

Gautam
Top achievements
Rank 1
 answered on 01 Jun 2020
3 answers
526 views

I have tried to get the validation to work with this control, but have failed miserably trying to implement as you have described here - https://docs.telerik.com/devtools/aspnet-ajax/controls/checkboxlist/functionality/aspnet-validators-support

It never validates on the client. I have two controls, one a textbox the other a checkboxlist. the textbox does fail correctly, the checkboxlist never fails. Using your code, i can still not get to happen what you describe - "To use the RequiredFieldValidator, you just need to set the ControlToValidate property to the CheckBoxList's ID. This will trigger validation when the user submits and the validation control will validate against the SelectedItem property and return the appropriate validation result."

1) Please help get this thing to validate correctly using the asp validators are described in your documentation.

2) Seems there is indeed an issue with the get_selectedIndex(), as it should have the correct index after the "checked" has been fired. use my code below and checkout what the alert sends back. At the checked changed event it should have the correct index, no? I even get "undefined" when after unchecking and checking a box. It should always be "-1" or a number of the first selected item index number, if checked. This issue breaking the validation?

 

 

<div style="float: left; width: 100%;">
    <telerik:RadCheckBoxList runat="server" ID="RadCheckBoxListMembers" AutoPostBack="false" RenderMode="Lightweight" ClientIDMode="Static">
        <ClientEvents OnItemCheckedChanged="OnItemCheckedChanged" OnLoad="function(sender) { radCheckBoxList = sender; }" />
        <Items>
            <telerik:ButtonListItem Text="All Family" Value="-1" />
            <telerik:ButtonListItem Text="Bob" Value="0" />
            <telerik:ButtonListItem Text="Mary" Value="1" />
            <telerik:ButtonListItem Text="Jimmy" Value="2" />
        </Items>
    </telerik:RadCheckBoxList>
 
    <asp:RequiredFieldValidator runat="server" ErrorMessage="Please select a member(s)" ValidationGroup="ValidationGroup"
        Display="None" ControlToValidate="RadCheckBoxListMembers" EnableClientScript="true" />
</div>
     
<div style="float: left; width: 100%;">
    <telerik:RadTextBox runat="server" ID="RadTextBoxName" Label="Name:" />
    <asp:RequiredFieldValidator runat="server" ErrorMessage="Please enter a name" ValidationGroup="ValidationGroup"
        Display="None" ControlToValidate="RadTextBoxName" EnableClientScript="true" />
</div>
 
<div style="float: left; width: 100%;">
    <telerik:RadButton runat="server" ID="RadButtonSubmit" CausesValidation="true" ValidationGroup="ValidationGroup" Text="Submit"
        RenderMode="Lightweight" AutoPostBack="true" Width="200px" Enabled="true" OnClick="RadButtonSubmit_Click">
        <Icon PrimaryIconCssClass="rbOk" />
    </telerik:RadButton>
</div>           
 
<div style="float: left; width: 100%;">
    <asp:ValidationSummary runat="server" ValidationGroup="ValidationGroup" />
</div>
 
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">
        //![CDATA[
 
        var radCheckBoxList;
 
        function OnItemCheckedChanged(sender, args) {                       
 
            alert(radCheckBoxList.get_selectedIndex());
             
        }
 
//]]>
    </script>
</telerik:RadScriptBlock>

 

 

 

Doncho
Telerik team
 answered on 01 Jun 2020
6 answers
815 views

A very very strange problem. I have RadContextMenu that are identical working on two page, but failing on another page. It was working fine and then just stopped giving a "contextMenu.show is not a function" error in javascript. 

Here is the code

<p>
    Touch the <asp:Button  OnClientClick="javascript:HelpExplainSelected(event)" runat="server" CssClass='EditP' UseSubmitBehavior="False"/> buttons to access menus for creating form fields.
</p>

 

I add RadCodeBlock on the suggestion of another post with a similar problem

<telerik:RadCodeBlock ID="RadCodeBlockMenu" runat="server">
<script type="text/javascript">
    function HelpExplainSelected(event) {
        var contextMenu = document.getElementById("<%= HelpExplainMenu.ClientID %>");
        contextMenu.show(event);
    }

 

<telerik:RadContextMenu ID="HelpExplainMenu" CssClass="RadContextMenu1" runat="server">
    <ExpandAnimation Type="None" Duration="0" />
    <CollapseAnimation Type="None" Duration="0" />
    <DataBindings>
        <telerik:RadMenuItemBinding   />
    </DataBindings>
    <Items>
        <telerik:RadMenuItem Text="Edit the Properties"  PostBack="False" ></telerik:RadMenuItem>
        <telerik:RadMenuItem Text="Add a Form Row for some Type" PostBack="False" ></telerik:RadMenuItem>
        <telerik:RadMenuItem Text="Insert a Form Row of Another Type"  PostBack="False" ></telerik:RadMenuItem>
        <telerik:RadMenuItem Text="Remove the Form Row"  PostBack="False" ></telerik:RadMenuItem>
   </Items>
</telerik:RadContextMenu>

 

This exact code works fine on two pages but on the third page, gives the function show() an error on contextMenu.show(event) that show is not found.

I tried re-starting Visual Studio, rebooting the computer. Solutions that have fixed other flaky Telerik problems.  I stare endlessly the code in the working and not working page, but it the same, except for the RadCodeBlock.

In the HTML generated for the menu (in all three pages),

<div tabindex="0" id="ctl00_MainContent_HelpExplainMenu">
    <div class="RadMenu RadMenu_MetroTouch RadMenu_Context RadMenu_MetroTouch_Context    RadContextMenu1">
        <ul class="rmActive rmVertical rmGroup rmLevel1">
            <li class="rmItem rmFirst"><a class="rmLink" href="#"><span class="rmText">Edit the Properties</span></a></li><li class="rmItem "><a class="rmLink" href="#"><span class="rmText">Add a Form Row for some Type</span></a></li><li class="rmItem "><a class="rmLink" href="#"><span class="rmText">Insert a Form Row of Another Type</span></a></li><li class="rmItem rmLast"><a class="rmLink" href="#"><span class="rmText">Remove the Form Row</span></a></li>
        </ul>
    </div><input id="ctl00_MainContent_HelpExplainMenu_ClientState" name="ctl00_MainContent_HelpExplainMenu_ClientState" type="hidden" />
</div>

 

HelpExplainMenu is a div.  How does the div object get a Show function?  What plumbing can be broken? Ideas on how to debug it? Every example I can find uses EventArgs with eventArgs.get_domEvent(); to get the event, could this be an issue?  If so how should a anchor supposed to open a RadContextMenu.

It was working and died with no apparent reason, will the other pages die in time too? Programming is not supposed to be like this.

Please do not ask for a project with the problem, off course it will not be possible since it does work fine elsewhere.

Please suggest how to debug this.

Doncho
Telerik team
 answered on 01 Jun 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?