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

Hi,
I have a master page with a grid that inherits the form template from a content page. The fields are displayed correctly in edit and all valued but when I press update it says that the fields cannot be null.
This problem occurs only if the form template is on the content page while if you put the template directly on the master page then everything works.
I used a code similar to the demo https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/form-template-update/defaultcs.aspx as an example.
What I do wrong and how I can fix it?
Thanks

 

ASPX Content Page

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MasterTKTest2.master" AutoEventWireup="true" CodeFile="ChildTKTest2.aspx.cs" Inherits="ChildTKTest2" %>
 
<asp:Content ID="mycontent" ContentPlaceHolderID="FormTemplatePlaceHolder" runat="server">
     
   <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
    style="border-collapse: collapse;">
    <tr class="EditFormHeader">
        <td colspan="2">
            <b>Cat1</b>
        </td>
    </tr>
    <tr>
        <td>
            <table id="Table3" width="450px" border="0" class="module">
                <tr>
                    <td class="title" style="font-weight: bold;" colspan="2">Company Info:</td>
                </tr>
                <tr>
                    <td>Descrizione:
                    </td>
                    <td>
                        <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("CatDesc1") %>'>
                        </asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>Libero 1a:
                    </td>
                    <td>
                        <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("Libero1a") %>' TabIndex="1">
                        </asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>Libero 1b:
                    </td>
                    <td>
                        <asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("Libero1b") %>' TabIndex="2">
                        </asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <b>Campi default:</b>
                    </td>
                </tr>
                <tr>
                    <td>Data ora ins:
                    </td>
                    <td>
                        <telerik:RadDatePicker RenderMode="Lightweight" ID="BirthDatePicker" runat="server" MinDate="1/1/1900" DbSelectedDate='<%# Bind("DataOraIns") %>'
                            TabIndex="4">
                        </telerik:RadDatePicker>
                    </td>
                </tr>
                <tr>
                    <td>Data ora mod:
                    </td>
                    <td>
                        <telerik:RadDatePicker RenderMode="Lightweight" ID="HireDatePicker" DbSelectedDate='<%# Bind( "DataOraMod") %>'
                            runat="server" TabIndex="10">
                        </telerik:RadDatePicker>
                    </td>
                </tr>
                <tr>
                    <td>Utente:
                    </td>
                    <td>
                        <asp:TextBox ID="TextBox4" Text='<%# Bind( "IDUtente") %>' runat="server" TabIndex="11">
                        </asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:TextBox ID="TextBox2" Text='<%# Bind( "IDUtenteUltimaMod") %>' runat="server" TabIndex="12">
                        </asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:TextBox ID="TextBox3" Text='<%# Bind( "NumMod") %>' runat="server" TabIndex="13">
                        </asp:TextBox>
                    </td>
                </tr>
            </table>
        </td>
                                 
    </tr>
    <tr>
        <td colspan="2"></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
    </tr>
    <tr>
        <td align="right" colspan="2">
            <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button
            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                CommandName="Cancel"></asp:Button>
        </td>
    </tr>
</table>
            
        
</asp:Content>

 

CS Master Page

public partial class MasterPages_MasterTKTest2 : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlDataSource1.ConnectionString = Siseco.GatEnv.Environment.Database.GetConnectionString(string.Empty, false);
    }
 
    protected void RadGrid1_ItemUpdated(object source, Telerik.Web.UI.GridUpdatedEventArgs e)
    {
        if (e.Exception != null)
        {
            e.KeepInEditMode = true;
            e.ExceptionHandled = true;
            DisplayMessage(true, "Cat1 " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["IDCat1"] + " cannot be updated. Reason: " + e.Exception.Message);
        }
        else
        {
            DisplayMessage(false, "Cat1 " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["IDCat1"] + " updated");
        }
    }
 
    protected void RadGrid1_ItemInserted(object source, GridInsertedEventArgs e)
    {
        if (e.Exception != null)
        {
            e.ExceptionHandled = true;
            e.KeepInInsertMode = true;
            DisplayMessage(true, "Cat1 cannot be inserted. Reason: " + e.Exception.Message);
        }
        else
        {
            DisplayMessage(false, "Cat1 inserted");
        }
    }
 
    protected void RadGrid1_ItemDeleted(object source, GridDeletedEventArgs e)
    {
        if (e.Exception != null)
        {
            e.ExceptionHandled = true;
            DisplayMessage(true, "Cat1 " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["IDCat1"] + " cannot be deleted. Reason: " + e.Exception.Message);
        }
        else
        {
            DisplayMessage(false, "Cat1 " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["IDCat1"] + " deleted");
        }
    }
 
    private void DisplayMessage(bool isError, string text)
    {
        Label label = (isError) ? this.Label1 : this.Label2;
        label.Text = text;
    }
 
 
 
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.InitInsertCommandName) //"Add new" button clicked
        {
            GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");
            editColumn.Visible = false;
        }
        else if (e.CommandName == RadGrid.RebindGridCommandName && e.Item.OwnerTableView.IsItemInserted)
        {
            e.Canceled = true;
        }
        else
        {
            GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");
            if (!editColumn.Visible)
                editColumn.Visible = true;
        }
 
    }
    protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            RadGrid1.EditIndexes.Add(0);
            RadGrid1.Rebind();
        }
    }
}

 

ASPX Master Page

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterTKTest2.master.cs" Inherits="MasterPages_MasterTKTest2" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function RowDblClick(sender, eventArgs) {
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
        </script>
    </telerik:RadCodeBlock>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <p id="divMsgs" runat="server">
        <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080">
        </asp:Label>
        <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000">
        </asp:Label>
    </p>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="divMsgs"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecorationZoneID="demo" DecoratedControls="All" EnableRoundedCorners="false" />
    <div id="demo" class="demo-container no-bg">
        <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server" CssClass="RadGrid" GridLines="None"
            AllowPaging="True" PageSize="20" AllowSorting="True" AutoGenerateColumns="False"
            ShowStatusBar="true" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
            AllowAutomaticUpdates="True" DataSourceID="SqlDataSource1" OnItemDeleted="RadGrid1_ItemDeleted"
            OnItemInserted="RadGrid1_ItemInserted" OnItemUpdated="RadGrid1_ItemUpdated" OnItemCommand="RadGrid1_ItemCommand"
            OnPreRender="RadGrid1_PreRender">
            <MasterTableView CommandItemDisplay="TopAndBottom" DataSourceID="SqlDataSource1"
                DataKeyNames="IDCat1">
                <Columns>
                    <telerik:GridEditCommandColumn>
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn UniqueName="IDCat1" HeaderText="ID" DataField="IDCat1">
                        <HeaderStyle Width="70px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="CatDesc1" HeaderText="Desc" DataField="CatDesc1">
                        <HeaderStyle Width="80px"></HeaderStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="Libero1a" HeaderText="Libero1a" DataField="Libero1a">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="Libero1b" HeaderText="Libero1b" DataField="Libero1b">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="DataOraIns" HeaderText="DataOraIns" DataField="DataOraIns"
                        DataFormatString="{0:d}">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="DataOraMod" HeaderText="DataOraMod" DataField="DataOraMod"
                        DataFormatString="{0:d}">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="IDUtente" HeaderText="IDUtente" DataField="IDUtente">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="IDUtenteUltimaMod" HeaderText="IDUtenteUltimaMod" DataField="IDUtenteUltimaMod">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="NumMod" HeaderText="NumMod" DataField="NumMod">
                    </telerik:GridBoundColumn>
                     
                    <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="column">
                    </telerik:GridButtonColumn>
                </Columns>
                <EditFormSettings EditFormType="Template">
                    <FormTemplate>
                        <asp:ContentPlaceHolder ID="FormTemplatePlaceHolder" runat="server">
                        </asp:ContentPlaceHolder>
                    </FormTemplate>
                </EditFormSettings>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick"></ClientEvents>
            </ClientSettings>
        </telerik:RadGrid>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        DeleteCommand="DELETE FROM [Cat1] WHERE [IDCat1] = @IDCat1"
        InsertCommand="INSERT INTO [Cat1] ([CatDesc1], [Libero1a], [Libero1b], [DataOraIns], [DataOraMod], [IDUtente], [IDUtenteUltimaMod], [NumMod]) VALUES (@CatDesc1, @Libero1a, @Libero1b, @DataOraIns, @DataOraMod, @IDUtente, @IDUtenteUltimaMod, @NumMod)"
        SelectCommand="SELECT * FROM [Cat1]" UpdateCommand="UPDATE [Cat1] SET [CatDesc1] = @CatDesc1, [Libero1a] = @Libero1a, [Libero1b] = @Libero1b, [DataOraIns] = @DataOraIns, [DataOraMod] = @DataOraMod, [IDUtente] = @IDUtente, [IDUtenteUltimaMod] = @IDUtenteUltimaMod, [NumMod] = @NumMod WHERE [IDCat1] = @IDCat1">
        <DeleteParameters>
            <asp:Parameter Name="IDCat1" Type="Int32"></asp:Parameter>
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="CatDesc1" Type="String"></asp:Parameter>
            <asp:Parameter Name="Libero1a" Type="String"></asp:Parameter>
            <asp:Parameter Name="Libero1b" Type="String"></asp:Parameter>
            <asp:Parameter Name="DataOraIns" Type="DateTime"></asp:Parameter>
            <asp:Parameter Name="DataOraMod" Type="DateTime"></asp:Parameter>
            <asp:Parameter Name="IDUtente" Type="String"></asp:Parameter>
            <asp:Parameter Name="IDUtenteUltimaMod" Type="String"></asp:Parameter>
            <asp:Parameter Name="NumMod" Type="String"></asp:Parameter>
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="CatDesc1" Type="String"></asp:Parameter>
            <asp:Parameter Name="Libero1a" Type="String"></asp:Parameter>
            <asp:Parameter Name="Libero1b" Type="String"></asp:Parameter>
            <asp:Parameter Name="DataOraIns" Type="DateTime"></asp:Parameter>
            <asp:Parameter Name="DataOraMod" Type="DateTime"></asp:Parameter>
            <asp:Parameter Name="IDUtente" Type="String"></asp:Parameter>
            <asp:Parameter Name="IDUtenteUltimaMod" Type="String"></asp:Parameter>
            <asp:Parameter Name="NumMod" Type="String"></asp:Parameter>
            <asp:Parameter Name="IDCat1" Type="Int32"></asp:Parameter>
        </UpdateParameters>
    </asp:SqlDataSource>
    <br />
    </form>
</body>
</html>
Doncho
Telerik team
 answered on 03 Dec 2020
7 answers
166 views

We use the NextPrevNumericAndAdvanced pager, and need to add a textbox / button similar to Page Size, which we want to use for number of rows displayed (effectively changing grid height)

I'm guessing we need to use a custom pagertemplate, but don't want to try and recreate the NextPrevNumericAndAdvanced from scratch, so do you have the html content for the default, so that we can modify that?

 

Attila Antal
Telerik team
 answered on 02 Dec 2020
9 answers
855 views
One of our testers just caught an issue with RadGrid where Oracle is returning the data set sorting NULL values last.  RadGrid, however, is positioning null values first.  It appers to be an option on the Oracle side that can be controlled.  In our app I think the thing that makes sense is to sort the null's last.  Is it possible to modify the RadGrid behavior to treat NULL values in this manner?

Thanks,
Colin
Attila Antal
Telerik team
 answered on 02 Dec 2020
2 answers
136 views

I'd like to create a tag/keyword editor similar to the one used on sites like StackOverflow, where tags are formatted differently into the textbox and autocomplete is available as the user types (see attached screenshot).

What's the best way to do something like this with Telerik UI for ASP.NET?

 

 

Bryce
Top achievements
Rank 1
 answered on 02 Dec 2020
1 answer
80 views

Hello Telerik-Team,

I am trying to find a way to enable rotate option in diagram.
Saw this example: https://www.telerik.com/forums/shape-rotate-style
There you can see a rotate button, but on my project rotate button doesn't appear.

A toolbar like in kendo ui would be even better as the aspnet variant is based on kendo.

Regards

 

Vessy
Telerik team
 answered on 02 Dec 2020
1 answer
260 views

I'm using the Rad Grid's ExportToPDF functionality in that i want to set left padding to header text. i tried to set programmatically but it doesn't work.

any solution for this..? please check attachment for your understanding.

Doncho
Telerik team
 answered on 02 Dec 2020
1 answer
202 views

Hi, i've a problem sorting a RadGrid

When i try to sort, rows data are sorted all except the last column "Allegati" that remains fixed. That column is compiled on the ItemDataBound event, based on the datatable. How can I correct this behavior? Radgrid is under Ajax. Thanks

<telerik:RadGrid ID="rgRichieste" runat="server" CellSpacing="-1" Culture="it-IT" GridLines="Both" AllowSorting="True" AutoGenerateColumns="False" PageSize="5" ShowStatusBar="True" AllowPaging="True"
        MasterTableView-NoMasterRecordsText="Nessun record da visualizzare." RenderMode="Lightweight" OnItemDataBound="rgRichieste_ItemDataBound" OnNeedDataSource="rgRichieste_NeedDataSource" FilterMenu-EnableScreenBoundaryDetection="True" Enabled="True">
    <SortingSettings SortToolTip="Click qui per ordinare" SortedAscToolTip="ordinato crescente" SortedDescToolTip="ordinato decrescente"></SortingSettings>
 
    <ExportSettings FileName="richieste" IgnorePaging="True" ExportOnlyData="True" OpenInNewWindow="True">
        <Pdf PageWidth="" AllowPrinting="False"></Pdf>
    </ExportSettings>
 
    <MasterTableView DataKeyNames="IDCompilazione">
 
        <RowIndicatorColumn Visible="False">
        </RowIndicatorColumn>
        <ExpandCollapseColumn Created="True">
        </ExpandCollapseColumn>
     
        <Columns>
            <telerik:GridBoundColumn DataField="IDModulo" HeaderText="ID" SortExpression="IDModulo" UniqueName="IDModulo" FilterControlAltText="Filter IDModulo column" Visible="False">
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn DataField="IDCompilazione" HeaderText="ID" SortExpression="IDCompilazione" UniqueName="IDCompilazione" FilterControlAltText="Filter IDCompilazione column" Visible="False">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="NumeroDomanda" HeaderText="#" SortExpression="NumeroDomanda" UniqueName="NumeroDomanda" FilterControlAltText="Filter NumeroDomanda column" Visible="True">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Data" HeaderText="Data" SortExpression="Data" UniqueName="Data" DataType="System.DateTime" FilterControlAltText="Filter Data column" DataFormatString="{0:dd/MM/yyyy}">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Nome" HeaderText="Nome" SortExpression="Nome" UniqueName="Nome" FilterControlAltText="Filter Nome column">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Cognome" HeaderText="Cognome" SortExpression="Cognome" UniqueName="Cognome" FilterControlAltText="Filter Cognome column" >
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="CodCorso" HeaderText="Codice CdS" SortExpression="CodCorso" UniqueName="CodCorso" FilterControlAltText="Filter CodCorso column" >
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn HeaderText="Allegati" UniqueName="Allegati" >
            </telerik:GridBoundColumn>
 
            <telerik:GridTemplateColumn HeaderText="Azione" AllowFiltering="false" UniqueName="Azione" Visible="True">
                <ItemTemplate>
                     
                    <telerik:RadButton ID="btnMerge" runat="server" CssClass="rbLeftMargin" Text="Unisce file" ButtonType="StandardButton" ToolTip="unisce i file allegati in un unico PDF" OnClick="btnMerge_Click" CommandArgument='<%# Eval("IDCompilazione").ToString()%>'>
                        <ContentTemplate>
                            <i class="fa fa-compress"></i>
                        </ContentTemplate>
                    </telerik:RadButton>
 
                    <telerik:RadButton ID="btnDownloadFile" runat="server" CssClass="rbLeftMargin" Text="Scarica file" ButtonType="LinkButton" ToolTip="scarica PDF unico" CommandArgument='<%# Eval("IDCompilazione").ToString()%>' Target="_blank" UseSubmitBehavior="False" AutoPostBack="False">
                        <ContentTemplate>
                            <i class="fa fa-file-pdf-o"></i>
                        </ContentTemplate>
                    </telerik:RadButton>
 
                    <telerik:RadButton ID="btnModificaAllegati" runat="server" CssClass="rbLeftMargin" Text="Modifica allegati" ButtonType="LinkButton" ToolTip="modifica allegati" CommandArgument='<%# Eval("IDCompilazione").ToString()%>' Target="_blank" UseSubmitBehavior="False" AutoPostBack="False" OnClientClicked="ShowExistingW">
                        <ContentTemplate>
                            <i class="fa fa-files-o"></i>
                        </ContentTemplate>
                    </telerik:RadButton>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
     </MasterTableView>
</telerik:RadGrid>

 

Here the code:

protected void rgRichieste_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
     // salva i dati in memoria
    _dt = pc.GetDataTable(_query, connDb);
    // bind
    rgRichieste.DataSource = _dt;
}
 
protected void rgRichieste_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    int i = 0;
 
    string path = Master.targetFolder;
 
    if (e.Item is GridDataItem) // GridDataItem
    {
        GridDataItem item = (GridDataItem)e.Item;
 
        int id = (int)item.OwnerTableView.DataKeyValues[item.ItemIndex]["IDCompilazione"];
        int indiceRiga = item.DataSetIndex;
 
        // link ai file allegati
 
         // IDCorsoDiStudio serve per puntare alla cartella corretta
        string idCdS = _dt.Rows[indiceRiga]["IDCorsoDiStudio"].ToString();
 
        // imposta lista campi in funzione del modulo
        string listaCampi = "";
        int idModulo = Convert.ToInt32(_dt.Rows[indiceRiga]["IDModulo"].ToString());
        if (idModulo == 1)
            listaCampi = ProcComuni.listaCampiNome[0]; //"FileCurriculumVitae,FileBachelorDegree,FilePersonalStatement";
        else
            listaCampi = ProcComuni.listaCampiNome[1]; // "FileDeclarationForm,FileCurriculumVitae,FileResidenceCertificate,FileUniversityDegree,FileAcademicRecord,FileEnglishProficiency,FileIdentityDocument,FileMotivationLetter,FileReferenceLetter1,FileReferenceLetter2,FileOther";
 
        string[] hlFields = listaCampi.Split(new Char[] { ',' });
        int nFields = hlFields.Count<string>();
        // per ogni campo crea il link
        int nCampi = 0;
        foreach (string hlField in hlFields)
        {
            nCampi++;
            string nomeCampo = hlField.Trim();
            // questo valore potrebbe essere a sua volta una lista separata da '|'
            string valoreCampo = _dt.Rows[indiceRiga][nomeCampo].ToString();
 
            if (valoreCampo != "")
            {
                string[] nomiSingoli = valoreCampo.Split(new Char[] { '|' });
 
                int nNomi = 0;
                foreach (string nomeSingolo in nomiSingoli)
                {
                    nNomi++;
                    string nome = nomeSingolo.Trim();
 
                    HyperLink lnkFile = new HyperLink();
                    lnkFile.Text = nome;
                    lnkFile.NavigateUrl = path + idCdS + "/" + lnkFile.Text;
                    lnkFile.Target = "_blank";
 
                    if (nNomi > 1)
                        item["Allegati"].Controls.Add(new LiteralControl(" | "));
 
                    item["Allegati"].Controls.Add(lnkFile);
                }
 
                if (nCampi < nFields)
                    item["Allegati"].Controls.Add(new LiteralControl("<br />"));
            }
        }
 
        // imposta i pulsanti per la gestione del pdf unico
        string fileUnito = _dt.Rows[indiceRiga]["FileUnito"].ToString();
        RadButton rbMerge = (RadButton)item["Azione"].FindControl("btnMerge");
        RadButton rbDownloadFile = (RadButton)item["Azione"].FindControl("btnDownloadFile");
 
        if (idModulo < 2)
        {
            rbMerge.Visible = false;
            rbDownloadFile.Visible = false;
        }
        else
        {
            // modulo 2,3: gestione abilitata
 
            switch (fileUnito)
            {
                case "":
                    rbDownloadFile.Visible = false;
                    break;
 
                case "ERRORE":
                    rbDownloadFile.Visible = false;
                    rbMerge.BackColor = System.Drawing.Color.Bisque;
                    rbMerge.ToolTip = "Ci sono stati problemi nell'ultimo tentativo di unione.";
                    break;
 
                default:
                    rbMerge.Visible = false;
                    rbDownloadFile.NavigateUrl = path + idCdS + "/" + fileUnito;
                    break;
            }
        }
    }
}

 

Vessy
Telerik team
 answered on 02 Dec 2020
1 answer
347 views
Randomly, I'm getting the this error when the tree is getting loaded in Chrome. Never saw this in other browsers, it happens only in chrome.
Doncho
Telerik team
 answered on 01 Dec 2020
3 answers
200 views
Hi,

In my User Control I got a ScriptManagerProxy with a ScriptReference property in which I load a Javascript file.

 

<asp:ScriptManagerProxy ID="smp" runat="server">  
    <Scripts> 
        <asp:ScriptReference Path="~/Scripts/myScript.js" />    
    </Scripts> 
</asp:ScriptManagerProxy> 

This Javascript file contains this function:

 

function onNodeClicked(sender, args) {  
    ...  

Finally, in my User Control, I have a RadTreeView:

<telerik:RadTreeView ID="myTree" runat="server OnClientNodeClicked="onNodeClicked"> 
    ...  
</telerik:RadTreeView> 


This control is loaded dynamically in a aspx page. When I execute this, I receive this message:
                
                            Microsoft JScript runtime error: 'onNodeClicked' is undefined

What's wrong ?



 

 

 

 

Peter Milchev
Telerik team
 answered on 30 Nov 2020
1 answer
882 views

While I am dragging a node from a RadTreeView, I want the page to scroll up or down when the element hits a certain position on either the top or bottom area of the inner height of the page.

The best solution thus far has been this post: https://www.telerik.com/forums/radtreeview-drag-and-drop-scrolling

01.function nodeDragging(sender, args)
02.        {
03.            var container = sender.get_element();
04.            var divYCoord = $telerik.getLocation(container).y;
05. 
06.            var currentYCoord = args.get_domEvent().clientY;
07.            var textbox = $get("textbox");
08.                     
09.            if (currentYCoord > (document.body.clientHeight - 20))
10.                window.scrollBy(0, 20);
11.           
12.            window.status = "document.body.clientHeight:" + document.body.clientHeight + ":currentYCoord:" + currentYCoord + ":document.body.scrollTop:" + document.body.scrollTop + ":iTop:" + (currentYCoord - document.body.scrollTop) + ":" + args.get_domEvent().screenY + ":" + divYCoord;
13.            if(currentYCoord < 20)
14.                window.scrollBy(0, -20);
15.        }

 

I placed a code in a client node dragging function, but the issue is that the scrolling only happens once until I move the cursor again.

I would like to know if there is a way where the page continues to scroll while the dragging tree node remains within an area of the page. 

 

 

 

 

Peter Milchev
Telerik team
 answered on 27 Nov 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?