Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
115 views

is there any way to save edited document in HTML3 format?

thank you

hepek
Top achievements
Rank 1
Iron
 answered on 19 Feb 2020
2 answers
165 views

I am trying to enable "delete control" functionality via right-click menu.
so far I have a code like this, but I cannot find the appropriate function like editor.DeleteSelectedElement (or something like that):

 Telerik.Web.UI.Editor.CommandList["Remove Hyperlink"] = function (commandName, editor) {
            var hyperLink = editor.getSelectedElement(); // get the selected Hyperlink element.   
            editor.selectElement(hyperLink); // select the hyperlink
            *I need to delete selected element here. how do I do that? 
 };

 

thank you

hepek
Top achievements
Rank 1
Iron
 answered on 19 Feb 2020
6 answers
283 views

Hello,

We are currently using the RadHtmlChart for displaying financial data (we use many different types, i.e. Line, Bar, Pie, etc). At the moment, we only use categorical types, not scatter charts etc.

One thing we are going to implement is to have the notion of a "selected" series/category combination.

For instance, the attached picture is an example of what it could look like if the selection is Sales/2008. (it's not a pretty mockup, just showing the idea).

I think I have to use Javascript for this, since the only thing I think I can control on the series/category combination is the color, and that is not enough.

Also, given that I need to "select-hightlight" many different types of points to indicate its selection state (the select marker in a Line or Area, the bar on a Bar, the bar segment on a stacked bar, the segment in a pie, etc. it would be great if there was some kind of common feature that I could use, like that imagined "kendoWidget.series[0].category[1].select = true;"

I know that property doesn't exist, but is there something I could use and not have to write lots of Javascript code that is specific for each chart type?

For instance, I am thinking about the highlighting that takes place when you hover the mouse over the chart, i.e the hovered series/category becomes a little dimmer than the rest. Can I "hook" into that mechanism somehow?

A little difficult to explain, but I hope you get my idea.

Thanks,

Fredrik

 

Mikael
Top achievements
Rank 1
 answered on 19 Feb 2020
9 answers
1.3K+ views

Hi,

How do I set the path of ImageUrl in ImageEditor from code behind? radImageEditor.ImageUrl="<file path>" did not load the image.

Also, how do I export the image to a custom file path?

Vessy
Telerik team
 answered on 18 Feb 2020
5 answers
130 views
Uncaught TypeError: b.Application._doInitialize is not a function
    at Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3
    at Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3
    at q (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3)
    at Object.H.b._2Pass (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3)
    at F (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3)
    at HTMLDocument.d (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3)
    at HTMLDocument.c (Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl08_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.60919.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aee051b62-9cd6-49a5-87bb-93c07bc43d63%3aea597d4b%3ab25378d2:3)
Attila Antal
Telerik team
 answered on 18 Feb 2020
1 answer
606 views

Hello

I have a RadGrid ("rgPart") with Insert, Edit and Delete implemented on it and fully functional.

I have been trying to move those commands to modals independent from the radgrid, so far I have been able to implement modals for Insert and Delete, but Im having problems with showing the information of the radgrid into de Edit modal textboxes.

Anyone can help me with that?

 

RadGrid Code:

 

<asp:ImageButton ID="btnInsertar" runat="server"   OnClick="btnInsertar_Click" CommandName="InitInsert" ImageUrl="~/images/add.png" />

 

 <asp:UpdatePanel ID="upPart" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                    <ContentTemplate>
                        
                        <telerik:RadGrid ID="rgPart" runat="server" GroupingSettings-CaseSensitive="false"  AllowPaging="True" RenderMode="Lightweight"
                            AllowSorting="true" AllowFilteringByColumn="True"  PageSize="10 " OnNeedDataSource="rgPart_NeedDataSource" OnItemCommand="ItemCommand" OnItemDataBound="rgPart_ItemDataBound"
                                CssClass="RadGrid_Silk" EnableHeaderContextMenu="true" GridLines="Horizontal" Width="100%" AllowAutomaticDeletes="True" AllowAutomaticInserts="False" AllowAutomaticUpdates="False">
                            <HeaderContextMenu Enabled="false"></HeaderContextMenu>
                            <MasterTableView AutoGenerateColumns="false" DataKeyNames="IdPartNumber" ItemStyle-HorizontalAlign="Center" AlternatingItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" CommandItemDisplay="Top" NoMasterRecordsText="<%$ Resources:Language, lbl_tablaVacia %>">
                                <CommandItemSettings AddNewRecordImageUrl="~/images/add.png" AddNewRecordText="" RefreshText="<%$ Resources:Language, lbl_actualizar %>"/>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="IdPartNumber" HeaderText="ID" ReadOnly="true" Display="false" AutoPostBackOnFilter="true" CurrentFilterFunction="contains" ShowFilterIcon="false" FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" ></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Part" HeaderText="<%$ Resources:Language, lbl_rg_part %>" Display="true" AutoPostBackOnFilter="true" CurrentFilterFunction="contains" ShowFilterIcon="false" FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
                                    
                                    <telerik:GridEditCommandColumn UniqueName="EditColumn" CancelText="Cancel" UpdateText="Update" InsertText="Insert" EditText="Edit" EditFormColumnIndex="3" ButtonType="ImageButton" EditImageUrl="~/images/edit.png">
                                    </telerik:GridEditCommandColumn>

                                   <telerik:GridTemplateColumn DataField="" HeaderText=""  HeaderStyle-Width="3%"  AllowFiltering="false">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="imgEditar" runat="server" CausesValidation="False" CommandArgument='<%# Eval("IdPartNumber") %>' CommandName="Editar" ImageUrl="~/images/edit.png"  ItemStyle-Wrap="True"  
                                                OnClientClick="btnEditar_Click"/>
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" Width="3%" />
                                    </telerik:GridTemplateColumn>

                                    <telerik:GridTemplateColumn DataField="" HeaderText=""  HeaderStyle-Width="3%"  AllowFiltering="false">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="imgEliminar" runat="server" CausesValidation="False" CommandArgument='<%# Eval("IdPartNumber") %>' CommandName="Delete" ImageUrl="~/images/delete.png" Width="30px" Height="30px" ItemStyle-Wrap="True"  ToolTip="<%$ Resources:Language, tt_eliminar %>" 
                                                OnClientClick="javascript:if(!confirm('Eliminar/Delete')){return false;}"/>
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" Width="3%" />
                                    </telerik:GridTemplateColumn>
                                </Columns>
                               
                            </MasterTableView>
                        </telerik:RadGrid>
                    </ContentTemplate>
                </asp:UpdatePanel>

 

Modal Insert Code

<div class="modal fade" id="mdlPartInsert" role="dialog" data-backdrop="static" data-keyboard="false">
        <div class="modal-dialog">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                    <div class="modal-content">
                        <div class="modal-header">
                        </div>
                        <div class="modal-body text-center">
                            <div class="row">
                                <asp:Label for="txtIdpn" CssClass="col-12 text-left lbl_form" ID="Label1" runat="server" Text="<%$ Resources:Language, lbl_rg_part%>" ForeColor="Black"></asp:Label>
                                <div class="col-12 text-left">
                                    <asp:TextBox ID="txtIdpn" runat="server" CssClass="form-control form-control-sm"></asp:TextBox>
                                </div>
                            </div>
                            <div class="row">
                                <asp:Label for="txtPn" CssClass="col-12 text-left lbl_form" ID="Label3" runat="server" Text="<%$ Resources:Language, lbl_rg_pn %>" ForeColor="Black"></asp:Label>
                                <div class="col-12 text-left">
                                    <asp:TextBox ID="txtPn" runat="server" CssClass="form-control form-control-sm"></asp:TextBox>
                                </div>
                            </div>
                        <div class="modal-footer">
                            <asp:Button ID="btnAutorizar" CssClass="btn btn-info btn-sm" runat="server" Text="<%$ Resources:Language, btn_Autorizar %>" OnClick="btnAutorizar_OnClick" />
                            <asp:Button ID="btnCancelar" CssClass="btn btn-danger btn-sm" runat="server" Text="<%$ Resources:Language, btn_Cancelar %>" OnClick="btnCancelar_OnClick" />
                        </div>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>

 

Modal Edit Code

<div class="modal fade" id="mdlPartEdit" role="dialog" data-backdrop="static" data-keyboard="false">
        <div class="modal-dialog">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                    <div class="modal-content">
                        <div class="modal-header">
                        </div>
                        <div class="modal-body text-center">
                            <div class="row">
                                <asp:Label for="editIdpn" CssClass="col-12 text-left lbl_form" ID="Label7" runat="server" Text="<%$ Resources:Language, lbl_rg_part%>" ForeColor="Black"></asp:Label>
                                <div class="col-12 text-left">
                                    <asp:TextBox ID="editIdpn" runat="server" CssClass="form-control form-control-sm"></asp:TextBox>
                                </div>
                            </div>
                            <div class="row">
                                <asp:Label for="editPn" CssClass="col-12 text-left lbl_form" ID="Label8" runat="server" Text="<%$ Resources:Language, lbl_rg_pn %>" ForeColor="Black"></asp:Label>
                                <div class="col-12 text-left">
                                    <asp:TextBox ID="editPn" runat="server" CssClass="form-control form-control-sm"></asp:TextBox>
                                </div>
                            </div>
                        <div class="modal-footer">
                            <asp:Button ID="btnMdlEditar" CssClass="btn btn-info btn-sm" runat="server" Text="<%$ Resources:Language, btn_Autorizar %>" OnClick="btnMdlEditar_OnClick"/>
                            <asp:Button ID="btnCancelarEditar" CssClass="btn btn-danger btn-sm" runat="server" Text="<%$ Resources:Language, btn_Cancelar %>" OnClick="btnCancelar_OnClick" />
                        </div>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>

 

Modal Delete Code

<div class="modal fade" id="mdlPartDelete" role="dialog" data-backdrop="static" data-keyboard="false">
        <div class="modal-dialog">
            <asp:UpdatePanel ID="UpdatePanel3" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                    <div class="modal-content">
                        <div class="modal-header">
                        </div>
                       
                        <div class="modal-footer">
                            <asp:Button ID="btnMdlDelete" CssClass="btn btn-info btn-sm" runat="server" Text="<%$ Resources:Language, btn_Autorizar %>" OnClick="btnMdlDelete_Click" CommandName="MdlDelete" CommandArgument='<%# Eval("IdIdPartNumber") %>'/>
                            <asp:Button ID="btnCancelarDelete" CssClass="btn btn-danger btn-sm" runat="server" Text="<%$ Resources:Language, btn_Cancelar %>" OnClick="btnMdlDelete_Click" CommandName="MdlDelCancel"/>
                        </div>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>

 

Behind code

protected void rgPart_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            try
            {
                this.rgPart.DataSource = CDatos.SP_PeticionesAlmacen.SP_ObtenerPartNumbers();
                this.upPart.Update();
            }
            catch (Exception ex) { this.ShowMessage("Err. load grid rgPart." + ex.Message, "danger"); }
        }

 

 protected void btnCancelar_OnClick(object sender, EventArgs e)
        {

            this.CloseModal("mdlPartInsert");

            this.CloseModal("mdlPartEdit");
        }

 

protected void ItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                int IdPartNumber;
                int.TryParse(e.CommandArgument.ToString(), out IdPartNumber);

                if (e.CommandName.Equals("Delete"))
                {
                    this.OpenModal("mdlPartDelete");
                    txtId.Text = IdPartNumber.ToString();
                }
                if (e.CommandName.Equals("InitInsert"))
                {
                    this.OpenModal("mdlPartInsert");
                }
                else if (e.CommandName.Equals("Update"))
                {
                    int.TryParse(((GridEditFormItem)e.Item).GetDataKeyValue("IdPartNumber").ToString(), out IdPartNumber);
                    this.rgNotas_ItemUpdated(IdPartNumber, (GridEditFormItem)e.Item);
                }
                else if (e.CommandName.Equals("Editar"))
                {
                    this.OpenModal("mdlPartEdit");
                    txtId.Text = IdPartNumber.ToString();
                    int.TryParse(((GridEditFormItem)e.Item).GetDataKeyValue("IdPartNumber").ToString(), out IdPartNumber);
                }
                else if (e.CommandName.Equals("MdlDelete"))
                {
                    this.eliminaPart(IdPartNumber);
                }
            }
            catch (Exception ex) { this.ShowMessage("Err. grid rgPart." + ex.Message, "danger"); }
        }

 

protected void btnInsertar_Click(object sender, EventArgs e)
        {
            this.OpenModal("mdlPartInsert");
        }

 

protected void btnAutorizar_OnClick(object sender, EventArgs e)
        {
            var part = txtPart.Text;
            try
            {
                var id = CDatos.DHerramientas.InsertPart(txtpart.Text);
                this.upDatos.Update();
                this.ShowMessage(Resources.Language.mess_insert, "success");
            }
            catch (Exception ex){this.ShowMessage(ex.Message, "danger"); }
            this.CloseModal("mdlPartInsert");
        }

 

protected void btnEliminar_Click(object sender, ImageClickEventArgs e)
        {
            this.OpenModal("mdlPartDelete");
        }

        protected void btnMdlDelete_Click(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            switch (btn.CommandName)
            {
                case "MdlDelete":
                    eliminaPart(int.Parse(txtId.Text));
                    break;
                case "MdlDelCancel":
                    this.CloseModal("mdlPartDelete");
                    break;
            }
        }

 

private void eliminaPart(int IdPartNumber)
        {
            try
            {
                Boolean eliminar = CDatos.DHerramientas.DeletePart(IdPartNumber);
                rgPart.Rebind();
                this.upDatos.Update();
                this.ShowMessage(Resources.Language.mess_delete, "success");
            }
            catch (Exception ex) { this.ShowMessage(ex.Message, "danger"); }
            this.CloseModal("mdlPartDelete");
        }

 

private void rgPart_ItemUpdated(int IdPartNumber, GridEditFormItem editar)
        {
            var part = ((TextBox)editar["Part"].Controls[0]).Text;

try
            {
                var id = CDatos.DPartNumbers.UpdatePartNumbers(IdPartNumber, part);
                this.upDatos.Update();
                this.ShowMessage(Resources.Language.mess_update, "success");
            }
            catch (Exception ex) { this.ShowMessage(ex.Message, "danger"); }
        }

 

Modal Edit method is not implemented yet, just the Edit method from the Grid, what I need to do is to get the data from the grid into the textbox of the modal

Attila Antal
Telerik team
 answered on 18 Feb 2020
2 answers
2.2K+ views

Hello

 

I have a radgrid which allows the user to select a row with 2 methods: by clicking on the row and by clicking a button in the row, so the user can edit or delete the information in those rows and to display information in another radgrid related to the row selected (Radgrid1 = Requests, Radgrid2 = Details, so if Request #2 is selected, the details of that requests are displayed in the other grid)

 

I have no issues if the user uses the "click on the row method", but if the user tries using the button it shows me the error:

     "Unable to cast object of type 'Telerik.Web.UI.GridDataItem' to type 'Telerik.Web.UI.GridEditFormItem'"

 

The button method by itself works, it still updates, deletes and populates the second grid in a correct way, but if the user edits, it doesnt show the results until the radgrid is refreshed or until the row is selected again. I need help to fix that, even if it still works in some way.

 

RadGrid1

<asp:UpdatePanel ID="upPeticiones" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                    <ContentTemplate>
                        <telerik:RadGrid ID="rgPeticiones" runat="server" GroupingSettings-CaseSensitive="false"  AllowPaging="True" RenderMode="Lightweight"
                            AllowSorting="true" AllowFilteringByColumn="True"  PageSize="5 " OnNeedDataSource="rgPeticiones_NeedDataSource" OnItemCommand="ItemCommand" OnItemDataBound="rgPeticiones_ItemDataBound" OnSelectedIndexChanged="rgPeticiones_SelectedIndexChanged"
                                CssClass="RadGrid_Silk" EnableHeaderContextMenu="true" GridLines="Horizontal" Width="100%" AllowAutomaticDeletes="True" AllowAutomaticInserts="False" AllowAutomaticUpdates="False" AllowMultiRowSelection="false" MasterTableView-AllowSorting="false">
                            <ClientSettings Selecting-AllowRowSelect="true" EnablePostBackOnRowClick="true">
                            </ClientSettings>
                            <HeaderContextMenu Enabled="false"></HeaderContextMenu>
                            <MasterTableView AutoGenerateColumns="false" DataKeyNames="Folio" ItemStyle-HorizontalAlign="Center" AlternatingItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" NoMasterRecordsText="<%$ Resources:Language, lbl_tablaVacia %>" CommandItemDisplay="Top"  EditMode="PopUp" EditFormSettings-CaptionFormatString="<%$ Resources:Language, lbl_rg_termino %>">
                                <CommandItemSettings ShowAddNewRecordButton="false" AddNewRecordText="" RefreshText="<%$ Resources:Language, lbl_actualizar %>"/>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="Folio" HeaderText="<%$ Resources:Language, lbl_rg_folio %>" Display="true" ReadOnly="true" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo" ShowFilterIcon="false" FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" DataType="System.String" AllowSorting="false"></telerik:GridBoundColumn>

                                    .....

 

                                    (Button for selection)
                                    <telerik:GridTemplateColumn DataField="" HeaderText=""  HeaderStyle-Width="3%"  AllowFiltering="false" UniqueName="Detalles">
                                        <ItemTemplate>
                                            <asp:ImageButton  ID="imgDetalle" runat="server" CausesValidation="False" CommandArgument='<%# Eval("Folio") %>' CommandName="Detalle" ImageUrl="~/images/detail.png" ItemStyle-Wrap="True"  ToolTip="<%$ Resources:Language, lbl_rg_detalle %>" OnClick="imgDetalle_Click" OnClientClick="deselectrows();"/>
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" Width="3%" />
                                    </telerik:GridTemplateColumn>

                                    
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
                    </ContentTemplate>
                </asp:UpdatePanel>

 

RadGrid2

 <asp:UpdatePanel ID="upNota" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                    <ContentTemplate>
                        <telerik:RadGrid ID="rgNota" runat="server" GroupingSettings-CaseSensitive="false"  AllowPaging="True" RenderMode="Lightweight"
                            AllowSorting="true" AllowFilteringByColumn="True"  PageSize="10" OnNeedDataSource="rgNota_NeedDataSource"  OnItemDataBound="rgNota_ItemDataBound"
                                CssClass="RadGrid_Silk" EnableHeaderContextMenu="false" GridLines="Horizontal" Width="100%"  MasterTableView-EditFormSettings-FormTableButtonRowStyle-HorizontalAlign="Right">
                            <HeaderContextMenu Enabled="false"></HeaderContextMenu>
                            <MasterTableView AutoGenerateColumns="false" DataKeyNames="Folio" ItemStyle-HorizontalAlign="Center" AlternatingItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" NoMasterRecordsText="<%$ Resources:Language, lbl_tablaVacia %>" CommandItemDisplay="Top">
                                <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false"/>
                                <EditFormSettings  FormTableStyle-HorizontalAlign="Right" FormTableButtonRowStyle-HorizontalAlign="Right" >
                                </EditFormSettings>
                                <Columns>
                                    
                                    <telerik:GridBoundColumn DataField="Folio" HeaderText="<%$ Resources:Language, lbl_rg_folio %>" Display="false" ReadOnly="true" AutoPostBackOnFilter="true" AllowFiltering="false" CurrentFilterFunction="EqualTo" ShowFilterIcon="false" FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" DataType="System.String">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Nota" HeaderText="<%$ Resources:Language, lbl_rg_nota %>" Display="true" AllowFiltering="false" ReadOnly="true" AutoPostBackOnFilter="true" CurrentFilterFunction="contains" ShowFilterIcon="false" FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center"></telerik:GridBoundColumn>
                                    
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
                    </ContentTemplate>
                </asp:UpdatePanel>

 

protected void ItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                int Folio;
                int.TryParse(e.CommandArgument.ToString(), out Folio);

                if (e.CommandName.Equals("Delete")) this.eliminaPeticion(Folio);
                else if (e.CommandName.Equals("Update"))
                {
                    int.TryParse(((GridEditFormItem)e.Item).GetDataKeyValue("Folio").ToString(), out Folio);
                    this.rgPeticiones_ItemUpdated(Folio, (GridEditFormItem)e.Item);
                }
                else if (e.CommandName.Equals("Detalle"))
                {
                    int.TryParse(((GridEditFormItem)e.Item).GetDataKeyValue("Folio").ToString(), out Folio); *Here is where I get the Error Message
                    this.rgPeticiones_ItemUpdated(Folio, (GridEditFormItem)e.Item);
                }
            }
            catch (Exception ex) { this.ShowMessage("Err. grid rgPeticiones." + ex.Message, "danger"); }
        }

 

I have another error showing, this time in the NeedDataSource when the user tries to update the second RadGrid with the button method

"Index was out of range. Must be non-negative and less than the size of the collection parameter name:index"

 

protected void rgNota_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            try
            {
                Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)rgPeticiones.SelectedItems[0]; *Here is where I get the second error
                foreach (Telerik.Web.UI.GridDataItem items in rgPeticiones.SelectedItems)
                {
                    var Folio = items["Folio"].Text;
                    int FolioInt = int.Parse(Folio.ToString());
                    try
                    {
                        rgDetalles.DataSource = CDatos.SP_PeticionesAlmacen.SP_ObtenerDetalle(FolioInt);
                        upDetalles.Update();
                    }
                    catch (Exception ex) { this.ShowMessage("Err. load grid rgDetalles." + ex.Message, "danger"); }
                }
            }
            catch (Exception ex) { this.ShowMessage("Err. load grid rgDetalles." + ex.Message, "danger"); }
        }

 

The method works perfectly if the "Click on row" method is used

 

Would be possible to have a "false button"? An image in the radgrid for the user just to click, selecting the row? I have tried with a "telerik:GridImageColumn" in my radgrid, it display the image but doesnt select the row if its clicked

Attila Antal
Telerik team
 answered on 18 Feb 2020
2 answers
276 views
Hello everyone, I'm encountering some issues when I tried to export excel from Grid. I added three GridTemplateColumn which contained buttons in those template columns. The Export To Excel button is added with Telerik RadButton separately because of user requirement. When I clicked the export to excel button, the button inside of the GridTemplateColumn becomes null value. Can someone help me how to solve it?

The following code is my Telerik Grid
<telerik:RadGrid ID="RadGridSalesOrder" runat="server" Width="100%" Height="600px"
                        OnNeedDataSource="RadGridSalesOrder_NeedDataSource" OnItemDataBound="RadGridSalesOrder_ItemDataBound"
                        OnBiffExporting="RadGridSalesOrder_BiffExporting" OnPreRender="RadGridSalesOrder_PreRender"
                        GridLines="None" AllowSorting="false" ShowGroupPanel="false" ShowFooter="false"
                        CellSpacing="0" AutoGenerateColumns="False" RenderMode="Auto"
                        ClientSettings-Selecting-AllowRowSelect="true" FooterStyle-Height="20px"
                        EnableHeaderContextFilterMenu="True" AllowPaging="true" PageSize="2000" AllowMultiRowSelection="false"
                        MasterTableView-EnableHeaderContextFilterMenu="true" EnableLinqExpressions="False" EnableHeaderContextMenu="True">
                        <ClientSettings AllowRowsDragDrop="false" AllowColumnsReorder="true" Resizing-AllowColumnResize="true" ReorderColumnsOnClient="true">
                            <ClientEvents OnCommand="GridCommand" />
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="false" ScrollHeight="250"></Scrolling>
                            <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                        </ClientSettings>
                        <ExportSettings FileName="SalesOrderApprovalList" IgnorePaging="true">
                            <Excel Format="Biff" />
                        </ExportSettings>
                        <GroupingSettings CaseSensitive="false" />
                        <MasterTableView DataKeyNames="OrderID,BranchID,CustomerID,CustomerInfo,OrderDate,DeliveryDate,Address"
                            AllowMultiColumnSorting="True" AllowPaging="true"
                            ClientDataKeyNames="OrderID,BranchID,CustomerID,CustomerInfo,Address,SalesPersonID,Remark,OrderDate,DeliveryDate"
                             PagerStyle-PageSizes="500,1000,1500,2000" AllowFilteringByColumn="true" AutoGenerateColumns="false" ShowHeadersWhenNoRecords="true">
                            <Columns>
                                <telerik:GridButtonColumn UniqueName="Update" ButtonType="ImageButton" ImageUrl="../images/icons8-window-settings-20.png" HeaderText="Open" Text="Open" CommandName="Open">
                                    <HeaderStyle Width="40px" />
                                    <ItemStyle Width="40px" HorizontalAlign="Center" />
                                </telerik:GridButtonColumn>
 
                                <telerik:GridTemplateColumn HeaderText="No" UniqueName="RowNumber" AllowFiltering="false">
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblRowNumber" Width="50px" Text='<%# Container.DataSetIndex+1 %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="30px" />
                                    <HeaderStyle Width="30px" />
                                </telerik:GridTemplateColumn>
 
                                 <telerik:GridTemplateColumn UniqueName="Approve" HeaderStyle-Width="90px" ShowFilterIcon="false" AllowFiltering="false">
                                    <ItemTemplate>
                                        <div style="text-align: center;">
                                            <telerik:RadButton ID="btnApprove" runat="server" AutoPostBack="true" Text="Approve" OnClientClicking="OnClientClicking" OnClick="btnApprove_Click">
                                            </telerik:RadButton>
                                        </div>
                                    </ItemTemplate>
                                    <ItemStyle Width="90px" />
                                </telerik:GridTemplateColumn>
 
                                <telerik:GridTemplateColumn UniqueName="BatchExpiry" AllowFiltering="false">
                                        <ItemTemplate>
                                       <%-- <asp:LinkButton ID="btnAddBatch" Text="Add Batch" runat="server">
                                        </asp:LinkButton>--%>
                                         <%-- <telerik:RadLinkButton ID="btnAddBatch" runat="server" Text="Add Batch">
                                               
                                          </telerik:RadLinkButton>--%>
                                          <telerik:RadButton ID="btnAddBatch" runat="server" Text="Add Batch" AutoPostBack="true" OnClick="btnAddBatch_Click"></telerik:RadButton>
                                    </ItemTemplate>
                                    <ItemStyle Width="45px" />
                                    <HeaderStyle Width="45px" />
                                </telerik:GridTemplateColumn>
 
                                <telerik:GridBoundColumn DataField="IsReserved" AllowFiltering="true" HeaderText="Is Reserved" UniqueName="IsReserved"
                                    ShowFilterIcon="false" FilterControlWidth="75px"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                    <HeaderStyle Width="90px" />
                                    <ItemStyle Width="90px" />
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn DataField="OrderID" AllowFiltering="true" HeaderText="Order ID" UniqueName="OrderID"
                                    ShowFilterIcon="false" FilterControlWidth="100px"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                    <HeaderStyle Width="110px" />
                                    <ItemStyle Width="110px" />
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn DataField="BranchID" AllowFiltering="false" HeaderText="Branch ID" UniqueName="BranchID"
                                    ShowFilterIcon="false" FilterControlWidth="100px" Visible="false"
                                    AutoPostBackOnFilter="false" CurrentFilterFunction="Contains">
                                    <HeaderStyle Width="110px" />
                                    <ItemStyle Width="110px" />
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn DataField="SalesPersonName" HeaderText="Sales Person" UniqueName="SalesPersonName"
                                    ShowFilterIcon="false" FilterControlWidth="105px" AllowFiltering="true"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                    <HeaderStyle Width="120px" />
                                    <ItemStyle Width="120px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="CustomerID" AllowFiltering="true" HeaderText="Customer ID" Visible="true" UniqueName="CustomerID"
                                    ShowFilterIcon="false" FilterControlWidth="110px"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                    <HeaderStyle Width="130px" />
                                    <ItemStyle Width="130px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="CustomerName" HeaderText="Name" UniqueName="CustomerName"
                                    ShowFilterIcon="false" FilterControlWidth="150px" AllowFiltering="true"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                    <HeaderStyle Width="189px" />
                                    <ItemStyle Width="189px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="CustomerInfo" HeaderText="Customer Info" UniqueName="CustomerInfo"
                                    ShowFilterIcon="false" FilterControlWidth="150px" AllowFiltering="false" Visible="false"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                    <HeaderStyle Width="189px" />
                                    <ItemStyle Width="189px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Address" HeaderText="Address" UniqueName="Address"
                                    ShowFilterIcon="false" FilterControlWidth="170px" AllowFiltering="true" Visible="true"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                    <HeaderStyle Width="189px" />
                                    <ItemStyle Width="189px" />
                                </telerik:GridBoundColumn>
 
                                 <telerik:GridBoundColumn DataField="Township" HeaderText="Township" UniqueName="Township"
                                    ShowFilterIcon="false" FilterControlWidth="120px" AllowFiltering="true" Visible="true"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
                                    <HeaderStyle Width="150px" />
                                    <ItemStyle Width="150px" />
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn DataField="OrderDate" AllowFiltering="false" HeaderText="Order Date" UniqueName="OrderDate"
                                    ShowFilterIcon="false" FilterControlWidth="110px"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="85px" />
                                    <ItemStyle Width="85px" />
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn DataField="DeliveryDate" AllowFiltering="false" HeaderText="Delivery Date" UniqueName="DeliveryDate"
                                    ShowFilterIcon="false" FilterControlWidth="110px"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="85px" />
                                    <ItemStyle Width="85px" />
                                </telerik:GridBoundColumn>
 
 
                                <telerik:GridBoundColumn DataField="DeliveryVan" AllowFiltering="true" HeaderText="Delivery Van" UniqueName="DeliveryVan"
                                    ShowFilterIcon="false" FilterControlWidth="100px"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="110px" />
                                    <ItemStyle Width="110px" />
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn UniqueName="SalesPersonID" DataField="SalesPersonID" AllowFiltering="true" ShowFilterIcon="false" FilterControlWidth="100px"
                                    HeaderText="SalesPerson ID" Visible="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true">
                                </telerik:GridBoundColumn>
 
                                 <telerik:GridBoundColumn DataField="Remark" HeaderText="Remark" UniqueName="Remark"
                                    ShowFilterIcon="false" FilterControlWidth="84px" AllowFiltering="true"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="104px" />
                                    <ItemStyle Width="104px" />
                                </telerik:GridBoundColumn>
 
                                 <telerik:GridBoundColumn DataField="SyncDateTime" HeaderText="Sync Date" UniqueName="SyncDateTime"
                                    ShowFilterIcon="false" FilterControlWidth="84px" AllowFiltering="false"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="85px" />
                                    <ItemStyle Width="85px" />
                                </telerik:GridBoundColumn>
 
                                 <telerik:GridBoundColumn DataField="ExportDateTime" HeaderText="Export Date" UniqueName="ExportDateTime"
                                    ShowFilterIcon="false" FilterControlWidth="84px" AllowFiltering="false"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="85px" />
                                    <ItemStyle Width="85px" />
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn DataField="ExportStatus" HeaderText="Export Status" UniqueName="ExportStatus"
                                    ShowFilterIcon="false" FilterControlWidth="75px" AllowFiltering="true"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="85px" />
                                    <ItemStyle Width="85px" />
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn DataField="ExportRemark" HeaderText="Export Remark" UniqueName="ExportRemark"
                                    ShowFilterIcon="false" FilterControlWidth="84px" AllowFiltering="true"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="104px" />
                                    <ItemStyle Width="104px" />
                                </telerik:GridBoundColumn>
 
                               <telerik:GridBoundColumn DataField="ApprovedBy" HeaderText="Approved By" UniqueName="ApprovedBy"
                                    ShowFilterIcon="false" FilterControlWidth="84px" AllowFiltering="true"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="104px" />
                                    <ItemStyle Width="104px" />
                                </telerik:GridBoundColumn>
 
                                 <telerik:GridBoundColumn DataField="ApprovedDate" HeaderText="Approved Date" UniqueName="ApprovedDate"
                                    ShowFilterIcon="false" FilterControlWidth="84px" AllowFiltering="false"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="85px" />
                                    <ItemStyle Width="85px" />
                                </telerik:GridBoundColumn>
 
                                <telerik:GridBoundColumn DataField="RejectedBy" HeaderText="Rejected By" UniqueName="RejectedBy"
                                    ShowFilterIcon="false" FilterControlWidth="84px" AllowFiltering="true"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="104px" />
                                    <ItemStyle Width="104px" />
                                </telerik:GridBoundColumn>
 
                                 <telerik:GridBoundColumn DataField="RejectedDate" HeaderText="Rejected Date" UniqueName="RejectedDate"
                                    ShowFilterIcon="false" FilterControlWidth="84px" AllowFiltering="false"
                                    AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" >
                                    <HeaderStyle Width="85px" />
                                    <ItemStyle Width="85px" />
                                </telerik:GridBoundColumn>
 
 
 
                                 
 
                                <%--<telerik:GridBoundColumn DataField="DeliveryStatus" HeaderText="Status" UniqueName="Status" Visible="false"
                                    ShowFilterIcon="false" FilterControlWidth="170px" AllowFiltering="true" AutoPostBackOnFilter="true">
                                    <HeaderStyle Width="50px" />
                                    <ItemStyle Width="50px" />
                                </telerik:GridBoundColumn>--%>
                            </Columns>
                            <PagerStyle AlwaysVisible="True"></PagerStyle>
                            <GroupFooterTemplate>
                            </GroupFooterTemplate>
                        </MasterTableView>
                        <PagerStyle UseRouting="True" Mode="NumericPages" ShowPagerText="False" />
 
                    </telerik:RadGrid>

 

Nelson
Top achievements
Rank 1
 answered on 18 Feb 2020
1 answer
109 views

I am trying to write a function that if a condition exists,  it cancels the selection and provides an alert("something is wrong") to the user.  This works; however, when the selection is cleared from the destination box, it no longer appears in the source box.

Here is html for Listbox:

 <telerik:RadListBox RenderMode="Lightweight" runat="server" ID="boxSource" Height="350px" Width="250px"
                                    AllowReorder="false"
                                    AllowTransfer="true"
                                    AllowTransferDuplicates="false"
                                    SelectionMode="Multiple"
                                    TransferMode="Move"
                                    TransferToID="boxDestination">
                                    <HeaderTemplate>
                                        Available Fields
                                    </HeaderTemplate>
                                </telerik:RadListBox>
                                <%-- Selected Fields --%>
                                <telerik:RadListBox RenderMode="Lightweight" runat="server" ID="boxDestination" Height="350px" Width="250px"
                                    SelectionMode="Multiple"
                                    AllowReorder="true">
                                    <HeaderTemplate>
                                        Zone Fields
                                    </HeaderTemplate>
                                </telerik:RadListBox>

 

Here is jQuery:

            var zoneNo = $("table.template td.active").attr("data-zone");

            var listBox = $find("<%= boxDestination.ClientID %>");
            //get current selected items
            var items = listBox.get_items(); 
            
            //store
            if (items.get_count() > 0) {
                if(zoneNo == undefined )
                {
                    items.clear();
                    return alert("Please select a zone");
                }
                let itemsCopy = Object.assign({}, items);
                $.data(listBox, zoneNo, itemsCopy);
            }

Eric R | Senior Technical Support Engineer
Telerik team
 answered on 17 Feb 2020
1 answer
158 views

Hi,

Spreadsheet is working fine on our evaluation server, but not is production server.

I think that it might be missing a dll file. What dll files are needed?

Br. Mikko

 

Peter Milchev
Telerik team
 answered on 17 Feb 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?