Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
239 views

Tried to add custom buttons to toolbar.

rightsButton = new RadToolBarButton();
rightsButton.ToolTip = CreaSoft.CommonServices.ResourceHelpers.GetGlobalResourceObject("FileExplorerControl.DirectoryRights");
rightsButton.Value = "ManageRightsFolder";
rightsButton.CommandName = "ManageRightsFolder";
 
Explorer.ToolBar.Items.Add(rightsButton);

 

Then I found it doesn't work as expected. Seems that icons are missing (ok, I didn't define any, but found now way how to do it), but based on html, it generates tooltip as css class :-) 

Then I found some strange code in Telerik_UI_for_ASP.NET_AJAX_2018_3_910_Source\Telerik.Web.UI\FileExplorer\RadFileExplorer.cs.

private void ConfigureToolbarButtons()
{
    bool isClassicMode = RenderMode == UI.RenderMode.Classic;
 
    if (!isClassicMode)
    {
        _toolbar.EnableImageSprites = true;
    }
 
    string icn = "icn";
    foreach (RadToolBarItem button in _toolbar.Items)
    {
        bool hasText = !String.IsNullOrEmpty(button.Text) && button.Text != Nbsp;
        string iconCssClass = String.Concat(icn, button.ToolTip);
        if (isClassicMode)
        {
            button.CssClass += hasText ? string.Empty : " rtbIconOnly ";
            button.CssClass += iconCssClass;
        }
        else
        {
            button.ShowText = hasText ? ToolBarShowPosition.Toolbar : ToolBarShowPosition.OverFlow;
            button.SpriteCssClass = iconCssClass;
        }
    }
}

 

So it seems to be a bug in this method. Css class should not be generated from Tooltip :-)

Please see attachments.

 

Rumen
Telerik team
 answered on 09 Jan 2020
16 answers
627 views
Picking up from the previous thread, what I'm trying to do is insert a chunk of HTML just beyond the closing tag where the cursor is sitting.

Consider the following sample:
Telerik.Web.UI.Editor.CommandList["Sidebox"] = function(commandName, editor, args) 
     editor.pasteHtml("<div style='float: right; height: 100px; witdth: 100px; background-color: red; color: yellow'>A box on the right</div>"); 
     return
 




Assuming your cursor is sitting between an opening and closing <p> tag when the command is invoked, the HTML is also pasted between the p tags. What I would like is to have it paste just after the closing </p>.

Any advice on how to achieve this?

Thanks,
Jeff
Rumen
Telerik team
 answered on 09 Jan 2020
5 answers
217 views
Hi,

The old link to RSS release history not working, someone have the new link?

ty
Rumen
Telerik team
 answered on 09 Jan 2020
5 answers
127 views

Hi,

    When the fonts dropdown is visible and then zoom the page, its doesn't align properly. https://demos.telerik.com/aspnet-ajax/editor/examples/overview/defaultcs.aspx

Will it be possible to keep it under under the controls that triggered it.

Thanks,

Lakpa

Rumen
Telerik team
 answered on 09 Jan 2020
8 answers
401 views
Hi, is it possible to change the name of the file before uploading to Azure?
Peter Milchev
Telerik team
 answered on 09 Jan 2020
2 answers
292 views

I've created a new web project using 'Telerik Web Site', added an existing web page (.aspx) which had a RadGrid added to it.

When I open up this page in Design, I get the following error. The Bin folder was created by the project and does have all DLLs including Telerik.Web.UI/Design

Error Creating Control - RadGrid

Unknown server tag:RadGrid

Error: Could not load file or assembly 'RadGrid.Net2' or one of its dependencies.

MSQ
Top achievements
Rank 1
 answered on 09 Jan 2020
1 answer
343 views

I have a radgrid with a CommandItemTemplate with three buttons. When a user clicks the 'Add Run' button it triggers the InitInsert.
After the user enters the data and clicks the check image button to insert the data, a check is performed in the RadGrid.InsertCommand to see if the user entered a value in the Number column that already exists.  If the Number does exists the user needs to be prompted and asked if they want to renumber the already existing rows and insert this one, or cancel.

I need to be able to display a message and capture the result and either exit the sub or do other processing.

 

Some script attempts

       //function confirmCallBackFn(arg) {
        //    radalert("<strong>radconfirm</strong> returned the following result: <h3 style='color: #ff0000;'>" + arg + "</h3>", 350, 250, "Result");
        //}
        function RadResequence(sender, args) {
            var callBackFunction = Function.createDelegate(sender, function (shouldSubmit) {
                if (shouldSubmit) {
                    this.click();
                }
            });
            var text = "<%= ResequenceAssignments %>";;
            radconfirm(text, callBackFunction, 500, 100, null, "Confirm Close");
            args.set_cancel(true);
        }


        function RadResequence2() {
            var confirmValue = document.createElement("INPUT");
            confirmValue.type = "hidden";
            confirmValue.name = "confirmValue";
            if (confirm("Do you want to Resequence? If you click yes, blah blah blah")) {
                confirmValue.value = "OK";
            }
            else {
                confirmValue.value = "Cancel";
            }
            document.forms[0].appendChild(confirmValue);
        }

 

 

 

THE RADGRID

<telerik:RadGrid ID="rdgrdDetailRS" OnSelectedIndexChanged="rdgrdDetailRS_SelectedIndexChanged" ClientSettings-EnablePostBackOnRowClick="true" runat="server" Width="275" AutoGenerateColumns="false" AllowPaging="true" PageSize="75" AllowFilteringByColumn="false" GridLines="Horizontal" CssClass="ctbGridHeader" AllowAutomaticUpdates="false">
                                    <GroupingSettings CaseSensitive="False" />
                                    <SelectedItemStyle CssClass="MySelectedClass" />
                                    <ClientSettings>
                                        <Selecting AllowRowSelect="True" />
                                        <Resizing EnableNextColumnResize="false" />
                                        <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" />
                                    </ClientSettings>
                                    <%--<MasterTableView DataKeyNames="DateCode, Number, Assigned" CommandItemDisplay="Top" EditMode="InPlace">--%>
                                    <MasterTableView DataKeyNames="DateCode, Number, Assigned" CommandItemDisplay="Top">
                                        <AlternatingItemStyle CssClass="MyRowClass" />
                                        <CommandItemTemplate>
                                            a a                                          
                                            <div id="divButtons" style="padding: 5px 0 5px 5px">
                                                <telerik:RadButton ID="btnAddAssignment" OnClientClicking="RadCreateRequest" runat="server" Text="Insert Assignment" CommandName="InsertAssignment">
                                                </telerik:RadButton>
                                                <%--<telerik:RadButton ID="btnAddRun" runat="server" Text="Add Run" CommandName="AddRun">
                                                </telerik:RadButton>--%>
                                                <telerik:RadButton ID="btnAddRun" runat="server" Text="Add Run" CommandName="InitInsert">
                                                </telerik:RadButton>
                                                <telerik:RadButton ID="btnSplitRun" runat="server" Text="Split Run" CommandName="SplitRun">
                                                </telerik:RadButton>
                                            </div>
                                        </CommandItemTemplate>
                                        <Columns>
                                            <telerik:GridBoundColumn DataField="DateCode" Display="false" FilterControlAltText="Filter colDateCode column" UniqueName="colDateCode" ReadOnly="True">
                                                <ColumnValidationSettings>
                                                    <ModelErrorMessage Text="" />
                                                </ColumnValidationSettings>
                                            </telerik:GridBoundColumn>
                                            <telerik:GridEditCommandColumn FilterControlAltText="Filter EditCommandColumn column"
                                                ButtonType="ImageButton">
                                                <ItemStyle Width="3%" />
                                            </telerik:GridEditCommandColumn>
                                            <telerik:GridBoundColumn DataField="Number" FilterControlAltText="Filter colBusNumber column" UniqueName="colBusNumber" HeaderText="Number" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                                                FilterControlToolTip="Press Enter or Tab key to search for value entered." FilterControlWidth="98%" ReadOnly="True">
                                                <HeaderStyle HorizontalAlign="Center" />
                                            </telerik:GridBoundColumn>
                                            <telerik:GridTemplateColumn DataField="Assigned" HeaderText="Assigned" UniqueName="Assigned">
                                                <ItemTemplate>
                                                    <%#DataBinder.Eval(Container.DataItem, "Assigned")%>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <telerik:RadComboBox ID="cmbActiveDrivers" EmptyMessage="" runat="server" Width="100%" Text='<%# Bind("Assigned") %>' DataSourceID="dsActiveDrivers" DataValueField="FullName" DataTextField="FullName">
                                                    </telerik:RadComboBox>
                                                </EditItemTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridButtonColumn ConfirmText="Delete this details record?" ButtonType="ImageButton"
                                                CommandName="Delete" Text="Delete" UniqueName="DeleteColumn2">
                                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" Width="3%" />
                                            </telerik:GridButtonColumn>
                                        </Columns>
                                        <EditFormSettings EditColumn-ButtonType="ImageButton">
                                        </EditFormSettings>
                                    </MasterTableView>
                                </telerik:RadGrid>

 

 

THE RADGRID.INSERTCOMMAND SUB. I'm just worried about the For next loop checking for a duplicate value in the radgrid then displaying a message and capturing the result.

 

    Private Sub rdgrdDetailRS_InsertCommand(sender As Object, e As GridCommandEventArgs) Handles rdgrdDetailRS.InsertCommand
        If TypeOf e.Item Is GridEditableItem Then
            Dim insertedItem As Telerik.Web.UI.GridEditableItem = CType(e.Item, Telerik.Web.UI.GridEditableItem)
            Dim newValues As Hashtable = New Hashtable
            e.Item.OwnerTableView.ExtractValuesFromItem(newValues, insertedItem)
            Try
                Dim strNewValue As String = newValues("Assigned").ToString
                Dim strID2 As String = newValues("Number").ToString
                If Len(strID2) <> 2 Then
                    rwmAdministration.RadAlert("Number must be Two digtis Only.", 500, 100, "Add Error", "null")
                    Exit Sub
                End If
                If Not IsNumeric(strID2) Then
                    rwmAdministration.RadAlert("Number must be a numerical value.", 500, 100, "Add Error", "null")
                    Exit Sub
                End If
                For Each row In rdgrdDetailRS.Items
                    If row.Cells(4).text = strID2 Then
                        'TODO need to figure out how to ask the user if they want ot resequence
                        ' rwmAdministration.RadAlert("Sorry, Run number " & strID2 & " already exists. Do you want to resequence", 500, 100, "Add Error", "null")
                        '  rwmAdministration.RadConfirm("Server radconfirm: Are you sure?", "confirmCallBackFn", 330, 180, Nothing, "Server RadConfirm", Nothing)
                        ' rwmAdministration.RadConfirm("Do you want to resequence. Are you sure?", "RadResequence", 330, 180, Nothing, "Server RadConfirm", Nothing)
                        rwmAdministration.RadConfirm("Do you want to resequence. Are you sure?", "RadResequence2", 330, 180, Nothing, "Server RadConfirm", Nothing)
                        Dim confirmValue As String = Request.Form("confirmValue")
                        If confirmValue = "Ok" Then
                            Dim value As String = "Ok"
                        Else
                            Dim value As String = "Cancel"
                        End If
                        ' Exit Sub
                    End If
                Next




                Dim cmd As New SqlCommand
                cmd.CommandType = CommandType.StoredProcedure
                cmd.CommandText = "InsertDetailRS"
                cmd.Parameters.Add(New SqlParameter("@DateCode", SqlDbType.Date)).Value = BasicUtil.GetQueryString 'CType(strID, Date)
                cmd.Parameters.Add(New SqlParameter("@Number", SqlDbType.VarChar)).Value = CType(strID2, String)
                cmd.Parameters.Add(New SqlParameter("@LastModifiedBy", SqlDbType.NVarChar)).Value = ADUtil.GetCurrentUser
                ' cmd.Parameters.Add(New SqlParameter("@ID", SqlDbType.Date)).Value = BasicUtil.GetQueryString
                cmd.Parameters.Add(New SqlParameter("@Assigned", SqlDbType.NVarChar)).Value = strNewValue
                Dim bolOk As Boolean = SQLUtil.ExecuteNonQuery(cmd, BasicUtil.csAppDB)
                If bolOk Then
                    rdgrdDetailRS.Rebind()
                Else
                    rwmAdministration.RadAlert("There was an error trying to insert a New Run record.", 500, 100, "Update Error", "null")
                    e.Canceled = True
                End If
                ' Else
                '  rdgrdDetailRS.Rebind()
                'End If
            Catch ex As Exception
                e.Canceled = True
                rwmAdministration.RadAlert("There was an error trying to insert a New Run record.", 500, 100, "Update Error", "null")
            End Try
            rdgrdDetailRS.Rebind()
        End If
    End Sub

Dan
Top achievements
Rank 1
 answered on 08 Jan 2020
3 answers
205 views

Hello all,

I have a grid with two checkboxcolumns that I am trying to export to PDF. The two columns are empty in the export, all other columns are populated. I have set ExportOnlyData="false", but that did not make any difference.

I should probably add that this is a grouped grid - not sure if that makes any difference.

Thx in advance for help and/or pointers!
M.

Eyup
Telerik team
 answered on 08 Jan 2020
8 answers
1.3K+ views

Hi,

I've implemented a nested view template very similar to the example Nested View Template however I am implementing Edit and Insert of items into grids that reside in the template.  On updates I'll be fine but on inserts, what I need is the datakey of the expanded row of the grid in the MasterTable.

Please see aspx below.  When the user issues an Insert from the UserControl of grdEndorsements (AddEditEndorsement.ascx), what I need in order to complete the insert is the DataKeyNames="EntityID" from the expanded row of grdEntities.  So the logic here is, the user expands the nested view under a given row in grdEntities, they see the grdEndorsements in the RadTabStrip/Multipage and they can insert a new item into grdEndorsements.

I know I can get the datakey name for grdEntities when it expands but I want to get it when the user actually inserts.  It is possible that the user may expand more than one row in grdEntities and then go and insert into a row previously expanded.  I've thought of a few possible solutions but open to suggestions.

What I've left out for brevity is the SQL data source of grdEndorsements.  However, I bring it up since the Label ID="LabelEntityID" is the value I need to complete the insert, I use it as the parameter for the Data Source that feeds grdEndorsements and it works just fine.  I'm just not sure how to get that value on insert.

Thanks.

<telerik:RadGrid ID="grdEntities" runat="server" Skin="Telerik" 
GridLines="None" AllowPaging="True" AllowSorting="True" Width="99%" AutoGenerateColumns="False" 
ShowStatusBar="True" Visible ="true" ShowFooter="True">  
<ClientSettings> 
    <Scrolling AllowScroll="False" /> 
    <ClientEvents OnPopUpShowing="PopUpShowing" /> 
</ClientSettings> 
<AlternatingItemStyle HorizontalAlign="Left" VerticalAlign="Middle" /> 
<MasterTableView GridLines="None" Width="100%" CommandItemDisplay="Top"   
   DataKeyNames="EntityID" NoMasterRecordsText="No Entities to Display." EditMode="PopUp" EditFormSettings-CaptionFormatString="Add or Edit Entity">  
<RowIndicatorColumn> 
    <HeaderStyle Width="20px" /> 
</RowIndicatorColumn> 
<CommandItemSettings AddNewRecordText="Add New Entity" /> 
<ExpandCollapseColumn> 
    <HeaderStyle Width="20px" /> 
</ExpandCollapseColumn> 
<Columns> 
    <telerik:GridEditCommandColumn> 
    </telerik:GridEditCommandColumn> 
    <telerik:GridBoundColumn UniqueName="EntityID" HeaderText="EntityID" DataField="EntityID" Visible="False" > 
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn UniqueName="EntityType" HeaderText="EntityType" DataField="EntityType" Visible="False" > 
    </telerik:GridBoundColumn> 
     <telerik:GridBoundColumn UniqueName="EntityName" HeaderText="Name" DataField="EntityName" Visible="True" > 
    </telerik:GridBoundColumn> 
 
</Columns> 
<EditFormSettings  UserControlName="~/UserControls/AddEditEntity.ascx" EditFormType="WebUserControl" 
PopUpSettings-Modal="True" PopUpSettings-Width="550px" PopUpSettings-ZIndex="9900">  
<EditColumn UniqueName="EditCommandColumn1">  
</EditColumn> 
 
<PopUpSettings Modal="True" ZIndex="9900" Width="550px"></PopUpSettings> 
</EditFormSettings> 
<NestedViewTemplate> 
 
<asp:Label ID="LabelEntityID" Font-Bold="true" Font-Italic="true" Text='<%# Eval("EntityID") %>' Visible="false" runat="server" /> 
 
<asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap">  

<
telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0" Skin="Vista">  
<Tabs> 
<telerik:RadTab runat="server" Text="Endorsements" PageViewID="PageView1">  
</telerik:RadTab> 
</Tabs> 
</telerik:RadTabStrip> 
<telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">  
<telerik:RadPageView runat="server" ID="PageView1">  

<
telerik:RadGrid ID="grdEndorsements" runat="server" Skin="Web20" 
GridLines="None" AllowPaging="True" AllowSorting="True" Width="99%" AutoGenerateColumns="False" 
ShowStatusBar="True" Visible ="true" ShowFooter="True" DataSourceID="SDSGetEndorsements">  
<MasterTableView GridLines="None" Width="100%" CommandItemDisplay="Top" HierarchyLoadMode="ServerOnDemand"   
DataKeyNames="EndorsementID" NoMasterRecordsText="No Endorsements to Display." PageSize="5" 
EditMode="PopUp" EditFormSettings-CaptionFormatString="Add or Edit Endorsement">  
<CommandItemSettings AddNewRecordText="Add New Endorsement" /> 
<Columns> 
<telerik:GridEditCommandColumn> 
</telerik:GridEditCommandColumn> 
<telerik:GridBoundColumn UniqueName="EndorsementID" HeaderText="EndorsementID" DataField="EndorsementID" Visible="False" > 
</telerik:GridBoundColumn> 
<telerik:GridBoundColumn UniqueName="EntityID" HeaderText="EntityID" DataField="EntityID" Visible="False" > 
</telerik:GridBoundColumn> 
<telerik:GridBoundColumn UniqueName="EndorsementName" HeaderText="Name" DataField="EndorsementName" Visible="True" > 
</telerik:GridBoundColumn> 
</Columns> 
<EditFormSettings  UserControlName="~/UserControls/AddEditEndorsement.ascx" EditFormType="WebUserControl">  
<EditColumn UniqueName="EditCommandColumnE1">  
</EditColumn> 
<PopUpSettings Modal="True" ZIndex="9900" Width="550px"></PopUpSettings> 
</EditFormSettings> 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px" /> 
</ExpandCollapseColumn> 
<RowIndicatorColumn> 
<HeaderStyle Width="20px" /> 
</RowIndicatorColumn> 
 
</MasterTableView> 
 
<ClientSettings> 
<ClientEvents OnPopUpShowing="PopUpShowing" /> 
<Scrolling AllowScroll="False" /> 
</ClientSettings> 
<PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="True" /> 
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" /> 
<AlternatingItemStyle HorizontalAlign="Left" VerticalAlign="Middle" /> 
</telerik:RadGrid> 
 
</telerik:RadPageView> 
 
</telerik:RadMultiPage> 
</asp:Panel> 
</NestedViewTemplate> 
</MasterTableView> 
<ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" /> 
<PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="True" />                 
</telerik:RadGrid> 
Eyup
Telerik team
 answered on 07 Jan 2020
3 answers
161 views

Hi,

We are using RadWindow as modals in our appliction. We have overload RadWindow in a custom control and then use that control thoughout our application. So it worked fantastic but recently something went wrong. All the modals are opening as a tiny modal and have url in status bar and other button in titlebar. which we didn't have initially. So the modal is not applying any properties we have set on server side. It looks like it is creating modal with default settings.

 

Here is our code for overload:

 public class ECxModalWindow : RadWindow
    {
        protected override void OnInit(EventArgs e)
        {
            ReloadOnShow = true;
            ShowContentDuringLoad = false;
            VisibleStatusbar = false;
            Title = "";
            Behaviors = WindowBehaviors.Close | WindowBehaviors.Move;
            AutoSize = false;
            Modal = true;
            OnClientShow = "InitWindow";
            CenterIfModal = true;
            if (Width.IsEmpty)
            {
                Width = new Unit(650, UnitType.Pixel);
            }
            if (Height.IsEmpty)
            {
                Height = new Unit(300, UnitType.Pixel);
            }
            base.OnInit(e);
        }

 

Here is the code we use for opening modal:

function ShowModal(sender, args, modalName) {
    var url;
    if (typeof(args.get_commandArgument) != "undefined") {
        url = args.get_commandArgument();
        modalName = args.get_commandName();
    } else {
        url = args;
    }
    AdjustContentPosition();
    window.radopen(url, modalName);
 //   var oWnd = window.radopen(url,modaln); 
    if (typeof(args.set_cancel) != "undefined") {
        args.set_cancel(true);
    } else {
        return false;
    }
}

HEre is how I declare it:

 <telerik:RadWindowManager ID="windowManager" runat="server" VisibleStatusbar="false">
            <Windows>
                <econometrix:ECxModalWindow ID="NotifyModal" runat="server" Height="480px" Width="440px">
                </econometrix:ECxModalWindow>

 

Please let me know what can be done to fix this issue.

 

Thanks,

Vandana

Rumen
Telerik team
 answered on 06 Jan 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?