Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
161 views

Hi!

 

I'm in need of using the RadOrgChart for showing some data and the point of the Tooltip is to show details of the Item I'm hovering over.

I did a demo just to try and see how it would look with some basic data on a Table.

I used this Demo as a reference...pretty much, I just copied and pasted it and modified it to see how it would look and then I would start doing some changes on it.

My problem: I don't know if its what I'm thinking, that the OnAjaxUpdate is not getting triggered, or if I messed up somewhere else.

I've never tried this before, so I'm pretty new at this and a little help would be useful ^^

OrgChartNew.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OrgChartNew.aspx.cs" Inherits="RadOrgChart3.OrgChartNew" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
    <link href="css/styles.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-wide no-bg">
        <div class="qsf-demo-canvas">
            <h2>
                <span>Test</span>
            </h2>
  
            <telerik:RadOrgChart RenderMode="Lightweight" ID="RadOrgChart1" runat="server" Skin="Default" DataSourceID="SqlDataSource1" EnableDrillDown="true"
                DataFieldID="hijo" DataFieldParentID="padre">
                <ItemTemplate>
                    <asp:Panel runat="server" ID="Panel1" CssClass="TemplateHolder">
                        <div class="rocCustomTextWrap">
                            <span>
                                <%# Eval("nombre")%>
                            </span>
                        </div>
                    </asp:Panel>
                </ItemTemplate>
            </telerik:RadOrgChart>
        </div>
  
    </div>
    <telerik:RadToolTipManager RenderMode="Lightweight" runat="server" ID="RadToolTipManager1" Skin="Default" OnAjaxUpdate="OnAjaxUpdate"
        Position="BottomRight" OffsetX="16" OffsetY="16" EnableShadow="false" Width="195" Height="135" />
  
    <asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:masterConnectionString %>"
        SelectCommand="SELECT [hijo], [padre], [nombre], [edad], [color] FROM [PADREHIJOTABLETEST]"></asp:SqlDataSource>
  
    </form>
</body>
</html>

 

OrgChartNew.aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace RadOrgChart3
{
    public partial class OrgChartNew : System.Web.UI.Page
    {
        private bool isDrillDown = false;
 
        protected void Page_Load(object sender, EventArgs e)
        {
            RadOrgChart1.GroupItemDataBound += new Telerik.Web.UI.OrgChartGroupItemDataBoundEventHandler(RadOrgChart1_GroupItemDataBound);
            RadOrgChart1.DrillDown += RadOrgChart1_DrillDown;
        }
 
        void RadOrgChart1_DrillDown(object sender, OrgChartDrillDownEventArguments e)
        {
            isDrillDown = true;
        }
 
        void RadOrgChart1_GroupItemDataBound(object sender, Telerik.Web.UI.OrgChartGroupItemDataBoundEventArguments e)
        {
            var panel = (Panel)e.Item.FindControl("Panel1");
            RadToolTipManager1.TargetControls.Add(panel.ClientID, e.Item.Node.ID, true);
        }
 
        protected override void OnPreRenderComplete(EventArgs e)
        {
            base.OnPreRenderComplete(e);
 
            if (isDrillDown)
            {
                var nodes = RadOrgChart1.GetAllNodes();
 
                foreach (var node in nodes)
                {
                    var panel = (Panel)node.GroupItems[0].FindControl("Panel1");
                    RadToolTipManager1.TargetControls.Add(panel.ClientID, node.ID, true);
                }
            }
        }
 
        public void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs e)
        {
            Control ctrl = Page.LoadControl("OrgChartUC.ascx");
            ctrl.ID = "OrgChartUC";
 
            e.UpdatePanel.ContentTemplateContainer.Controls.Add(ctrl);
            OrgChartUC details = (OrgChartUC)ctrl;
            details.Hijo = e.Value;
        }
 
    }
}

 

OrgChartUC.ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrgChartUC.ascx.cs" Inherits="RadOrgChart3.OrgChartUC" %>
 
<asp:Repeater runat="server" ID="Repeater1">
    <ItemTemplate>
        <div class="rtCustomTemplate">
            <h3 class="title">
                <asp:Literal runat="server" ID="ltrEdad" Text='<%# Eval("edad")%>' />
            </h3>
            <p class="phone">
                <asp:Literal runat="server" ID="ltrColor" Text='<%# Eval("color")%>' />
            </p>
        </div>
    </ItemTemplate>
</asp:Repeater>
  
<asp:SqlDataSource ID="EmployeesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:masterConnectionString %>"
    ProviderName="System.Data.SqlClient" SelectCommand="SELECT [edad], [color] FROM [PADREHIJOTABLETEST] WHERE hijo = @hijo">
    <SelectParameters>
        <asp:Parameter Name="hijo" Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>

 

OrgChart.ascx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace RadOrgChart3
{
    public partial class OrgChartUC : System.Web.UI.UserControl
    {
        public string Hijo { get; set; }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            EmployeesDataSource.SelectParameters["hijo"].DefaultValue = Hijo;
            Repeater1.DataSource = EmployeesDataSource;
            Repeater1.DataBind();
        }
    }
}

 

Thanks for your help ^^!!!

Andres
Top achievements
Rank 1
 asked on 09 Dec 2016
2 answers
176 views

I have a DropDownTree displaying within a popup window whose contents can be lengthy and scroll.  If the DropDownTree element is near the bottom of the window (due to the scroll position) and the user activates the tree, it is possible for only a tiny bit to show (sometimes even just the "Filter" area).  The control is seems to properly restricting size to keep it within the screen bounds.

Is there any way to have it pop "up" when it would be too small to fit going down (this would be similar to how the RadComboBox would work)?

Thanks for any input or suggestions!
Adam

Adam
Top achievements
Rank 1
 answered on 08 Dec 2016
7 answers
197 views

When I move tasks around it ends up with an error. Especially when I move a task to an earlier point in time.

The problem is: Telerik (let's call it like that) updates automaticly, but a NULL-value is assigned to a random record in the Expanded column.

And the Gantt doesn't allow this value because its a bit so. 1 or 0

 

Help please.

Tom
Top achievements
Rank 1
 answered on 08 Dec 2016
1 answer
98 views

Here's the situation:

I am testing a form using Telerik Test Studio.

There are 3 drop downs (State, City, Building) and what you choose on the previous box decides what is in the next box. Before you choose what is in the drop down box number one, two and three are empty (no choices). When you choose a State, it gives you options for cities, then once you choose a city, the building drop down gets populated with options.

The problem is, when I am testing this with the drop downs, it chooses the state correctly, but it, for some reason, doesn't register that there is a state chosen, so the city drop down does not get populated. I slowed the process down while the test is running to try and see if it was something simple, but I saw myself that it DOES choose a state, so I tried to manually choose the city but there was nothing to populate the drop down options. But, if I choose the state myself, then the cities populate.

Thank you for your help.

M

Boyan Boev
Telerik team
 answered on 08 Dec 2016
2 answers
79 views

Hi, I have created a custom SharePoint 2010 web part using a scheduler with some custom attributes. Everything is working fine except for validation of the custom attributes on the advanced edit/insert form. There are two text boxes which should not be empty and save should not allow the advanced form to be saved back to the SP list. 

I have the following code in the FormCreated event:

RadScheduler scheduler = (RadScheduler)sender;
 
CustomValidator validatorForAttributePhone = new CustomValidator();
validatorForAttributePhone.ValidationGroup = scheduler.ValidationGroup;
validatorForAttributePhone.ControlToValidate = "AttrPhone";
validatorForAttributePhone.ErrorMessage = "Cannot be blank!";
validatorForAttributePhone.ClientValidationFunction = "validationFunctionPhone";
(e.Container.FindControl("AttrPhone") as RadTextBox).Parent.Controls.Add(validatorForAttributePhone);

 

And the jsavascript function is 

function validationFunctionPhone(source, arguments)
{
  if (arguments.Value.length != 0)

  { arguments.IsValid = true; }

  else {arguments.IsValid = false}
}

 

All the validation seems to be created OK but this never fires when the 'Save' button is clicked on the advanced edit/insert form which means that the appointment can be saved when there is no text in the phone field on the form.

What am I missing?

Thanks,

Jonathan

 

Jonathan
Top achievements
Rank 1
 answered on 08 Dec 2016
1 answer
253 views

 

I tried to have Inline editing for radgrid, but when we edit Textboxes are not showing.I need datasource from codebehind. Any sample code is needed.

 

   <telerik:RadGrid ID="RGDCountry" runat="server" ShowStatusBar="true" EnableLinqExpressions="false" RenderMode="Lightweight" AllowPaging="false" AutoGenerateColumns="false" AllowFilteringByColumn="true" MasterTableView-AllowSorting="true"
           AllowAutomaticDeletes="false" AllowAutomaticInserts="True" 
                                        CellPadding="1" OnNeedDataSource="RGDCountry_NeedDataSource"
                                        PageSize="20" >
                                        <GroupingSettings CaseSensitive="false" />
                                        <ExportSettings Excel-Format="ExcelML"
                                            HideStructureColumns="true"
                                            ExportOnlyData="true"
                                            IgnorePaging="true"
                                            OpenInNewWindow="true">
                                        </ExportSettings>
                                        <MasterTableView ItemStyle-HorizontalAlign="Left" AllowFilteringByColumn="true" HeaderStyle-HorizontalAlign="Left" DataKeyNames="Id" CommandItemDisplay="Top" EditMode="InPlace" >
                                            <CommandItemSettings ShowExportToExcelButton="false" ShowAddNewRecordButton="false" ShowRefreshButton="false"  />



                                            <Columns>
                                                <telerik:GridTemplateColumn HeaderText="Sl.No" UniqueName="SlNo" HeaderStyle-Width="20px" FilterControlWidth="20px">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblRowNumber" Text='<%#Container.ItemIndex+1%>' runat="server" />
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>

                                                <%--<telerik:GridBoundColumn UniqueName="Id" DataField="Id" HeaderText="Id" ReadOnly="true" DataType="System.Int64" HeaderStyle-Width="20px" FilterControlWidth="20px" HeaderTooltip="Auto Generate Id From System"></telerik:GridBoundColumn>--%>

                                                <telerik:GridTemplateColumn UniqueName="CountryName" DataField="CountryName" ReadOnly="true" HeaderText="Country Name" DataType="System.String" HeaderStyle-Width="50px" FilterControlWidth="50px">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblCountry" runat="server" CssClass="control-label" Text='<%#Eval("CountryName") %>'></asp:Label>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <telerik:RadTextBox ID="TBEditCountry" CssClass="form-control" MaxLength="200" Text='<%#Eval("CountryName") %>' runat="server"></telerik:RadTextBox>
                                                    </EditItemTemplate>
                                                </telerik:GridTemplateColumn>


                                                <telerik:GridTemplateColumn UniqueName="Nationality" DataField="Nationality" ReadOnly="true" HeaderText="Nationality" DataType="System.String" HeaderStyle-Width="50px" FilterControlWidth="50px">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblNationality" runat="server" CssClass="control-label" Text='<%#Eval("Nationality") %>'></asp:Label>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <telerik:RadTextBox ID="TBEditNationality" CssClass="form-control" MaxLength="200" Text='<%#Eval("Nationality") %>' runat="server"></telerik:RadTextBox>
                                                    </EditItemTemplate>
                                                </telerik:GridTemplateColumn>

                                                <telerik:GridTemplateColumn UniqueName="Abbrv" DataField="Abbrv" ReadOnly="true" HeaderText="Abbrv" DataType="System.String" HeaderStyle-Width="30px" FilterControlWidth="30px">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblAbbrv" runat="server" CssClass="control-label" Text='<%#Eval("Abbrv") %>'></asp:Label>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <telerik:RadTextBox ID="TBEditAbbrv" CssClass="form-control" MaxLength="50" Text='<%#Eval("Abbrv") %>' runat="server"></telerik:RadTextBox>
                                                    </EditItemTemplate>
                                                </telerik:GridTemplateColumn>

                                                <telerik:GridTemplateColumn UniqueName="Status" ReadOnly="true" HeaderText="Status" DataType="System.String" HeaderStyle-Width="40px" FilterControlWidth="40px">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblStatus" runat="server" CssClass="control-label" Text='<%#Eval("Active") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>

                                                <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" EditText="Edit" />
                                            </Columns>
                                        </MasterTableView>






           
                                    </telerik:RadGrid>

Eyup
Telerik team
 answered on 08 Dec 2016
1 answer
175 views

I continue to get this error, but the dll's appear correct to me.

BC30560: 'GridDataItem' is ambiguous in the namespace 'Telerik.Web.UI'.

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 07 Dec 2016
1 answer
249 views

I've been trying to update the data in my RadDataForm for a long time now but without success. 

 

I am using an object called UtilisateurDetailViewModel (code below) and a class name UtilisateurDetailDataObject that takes care of doing the DB calls (CRUD) through a standard BLL-DAL etc. 

 

I bind my data to my form using a double click that calls the select method on ym ObjectDataSource using parameters. 

 

The problem I am facing is that watever I do, clicking my button with the CommandName="Update" in the EditItemTemplate doesn't do anything. I have tried tons of things to make it work but nothing. 

 

Here is all my code, hoping it's only a little mistake or an option that's missing. I know it is a big chunk of code, but the UtilisateurDetailViewModel and RadDataForm have a lot of repitition that doesn't need reading since it's just several radtextboxed for the values.

 

1. My UtilisateurDetailViewModel object

01.namespace CCQ.GestionSEL.Intranet.ZJWEB013.ViewModel
02.{
03.    public class UtilisateurDetailViewModel
04.    {
05.        private Utilisateur _utilisateur;
06.        private Compte _compte;
07. 
08.        public UtilisateurDetailViewModel(Utilisateur us_net, Compte ut_net)
09.        {
10.            if (us_net == null)
11.                throw new ArgumentNullException("us_net");
12. 
13.            if (ut_net == null)
14.                throw new ArgumentNullException("ut_net");
15. 
16.            _utilisateur = us_net;
17.            _compte = ut_net;
18.        }
19.        public string Type
20.        {
21.            get { return _utilisateur.TyUtilNet.Trim(); }
22.            set { _utilisateur.TyUtilNet = value; }
23.        }
24.        public string NumeroUtilisateur
25.        {
26.            get { return _utilisateur.IdentUtilNet.Trim() + "-" + _utilisateur.NoUsagerNet; }
27.            set { _utilisateur.IdentUtilNet = value; }
28.        }
29.        public string NomPrenom
30.        {
31.            set { _utilisateur.NomPrenom = value; }
32.            get { return _utilisateur.NomPrenom.Trim(); }
33.        }
34.        public string Courriel
35.        {
36.            get { if (_utilisateur.AdrCourriel != null) { return _utilisateur.AdrCourriel.Trim(); } else { return ""; }  }
37.            set { _utilisateur.AdrCourriel = value; }
38.        }
39.        public DateTime? DateCreation
40.        {
41.            get { return _utilisateur.DteCreer; }
42.            set { _utilisateur.DteCreer = value; }
43.        }
44.        public DateTime? DateModification
45.        {
46.            get { return _utilisateur.DteModif; }
47.            set { _utilisateur.DteModif = value; }
48.        }
49.        public DateTime? DateUtilisation
50.        {
51.            get { return _utilisateur.DteDernUtilisation; }
52.            set { _utilisateur.DteDernUtilisation = value; }
53.        }
54.        public string Principal
55.        {
56.            get { if (_utilisateur.EstUtilisateurPrincipal) { return "Oui"; } else { return "Non"; } }
57.        }
58.        public string Compte
59.        {
60.            get { return _compte.TyUtilNet + _compte.IdentUtilNet; }
61.        }
62.        public string Statut
63.        {
64.            get { if (_compte.statut == 1) { return "Actif"; } else { return "Inactif"; } }
65.            set { if (value == "Actif") { _compte.statut = 1; } else { _compte.statut = 0; }; }
66.        }
67.        public DateTime? DateStatut
68.        {
69.            get { if (_compte.statut == 1) { return _compte.DteCreer; } else { return _compte.DteInactif; } }
70.        }
71.        public string TypeCompte
72.        {
73.            get { return _utilisateur.NoUsagerNet.Trim() == "00" ? "Principal" : "Secondaire"; }
74.            set { if (value == "Principal") { _utilisateur.NoUsagerNet = "00"; } else { _utilisateur.NoUsagerNet = null; }  }
75.        }
76.    }

 

**************************************************************************************************************************************************************************************

2. My UtilisateurDetailDataObject (Contains CRUD logic)

01.namespace CCQ.GestionSEL.Intranet.ZJWEB013
02.{
03.    [DataObject]
04.    public class UtilisateurDetailDataObject
05.    {
06.        [DataObjectMethod(DataObjectMethodType.Select)]
07.        public UtilisateurDetailViewModel ObtenirUtilisateur(string type, string numeroUtilisateur)
08.        {
09.            string identUtil = "";
10.            string noUsager = "";
11.            string[] splitResult;
12. 
13.            if(type == null || numeroUtilisateur == null)
14.            {
15.                return null;
16.            }
17. 
18.            var listeUtilisateursVM = new List<UtilisateurDetailViewModel>();
19. 
20.            var bllUsNet = new ZJ.AuthentificationSEL.BLL.Utilisateur();
21.            var bllUtNet = new ZJ.AuthentificationSEL.BLL.Compte();
22.            if(numeroUtilisateur != null)
23.            {
24.                splitResult = numeroUtilisateur.Split('-');
25.                if (splitResult.Length > 1)
26.                {
27.                    identUtil = splitResult[0];
28.                    noUsager = splitResult[1];
29.                }
30.                else
31.                {
32.                    return null;
33.                }
34.            }
35.             
36.            Utilisateur utilisateur = bllUsNet.Obtenir(type, identUtil, noUsager);
37.            Compte compte = bllUtNet.Obtenir(utilisateur.TyUtilNet, utilisateur.IdentUtilNet);
38. 
39.            return new UtilisateurDetailViewModel(utilisateur, compte);
40.        }
41. 
42.        [DataObjectMethod(DataObjectMethodType.Update)]
43.        public void Update_DetailsUtilisateurs(UtilisateurDetailViewModel user)
44.        {
45.             
46.        }
47. 
48.        public void Insert(UtilisateurDetailViewModel user)
49.        {
50. 
51.        }
52.    }
53.}

 

**************************************************************************************************************************************************************************************

3. My ObjectDataSource

01.<asp:ObjectDataSource ID="SourceRadDataForm"
02.       runat="server"
03.       DataObjectTypeName="CCQ.GestionSEL.Intranet.ZJWEB013.ViewModel.UtilisateurDetailViewModel"
04.       SelectMethod="ObtenirUtilisateur"
05.       InsertMethod="asas"
06.       UpdateMethod="Update_DetailsUtilisateurs"
07.       TypeName="CCQ.GestionSEL.Intranet.ZJWEB013.UtilisateurDetailDataObject"
08.       OldValuesParameterFormatString="original_{0}">
09.       <SelectParameters>
10.           <asp:Parameter Name="type" Type="String" />
11.           <asp:Parameter Name="numeroUtilisateur" Type="String" />
12.       </SelectParameters>
13.   </asp:ObjectDataSource>

 

**************************************************************************************************************************************************************************************

4. My RadDataForm (contains the data that I bind from my UtilisateurDetailViewModel)

001.<telerik:RadDataForm ID="DetailDataForm"
002.                    runat="server"
003.                    DataSourceID="SourceRadDataForm"                   
004.                    DataKeyNames="Type,NumeroUtilisateur">
005.                    <LayoutTemplate>
006.                        <div id="itemPlaceholder" runat="server" visible="false"/>
007.                    </LayoutTemplate>
008.                    <ItemTemplate>
009.                        <fieldset class="form">
010.                            <div id="teteDroit">
011.                                <h2 class="DetailTitle">Utilisateur</h2>
012.                                <div class="inputwrap">
013.                                    <label for="Type">Type: </label>
014.                                    <telerik:RadTextBox ID="Type"
015.                                        runat="server"
016.                                        Enabled="false"
017.                                        EmptyMessage="Type"
018.                                        AutoPostBack="false"
019.                                        Text='<%# Eval("Type") %>'>
020.                                    </telerik:RadTextBox>
021.                                </div>
022.                                <div class="inputwrap">
023.                                    <label for="Principal">Principal: </label>
024.                                    <telerik:RadTextBox ID="Principal"
025.                                        runat="server"
026.                                        Enabled="false"
027.                                        AutoPostBack="false"
028.                                        Text='<%# Eval("Principal") %>'>
029.                                    </telerik:RadTextBox>
030.                                </div>
031.                            </div>
032.                            <div class="inputwrap">
033.                                <label for="NumeroUtilisateur">Numéro d'utilisateur:  </label>
034.                                <telerik:RadTextBox ID="NumeroUtilisateur"
035.                                    runat="server"
036.                                    Enabled="false"
037.                                    EmptyMessage="Type"
038.                                    AutoPostBack="false"
039.                                    Text='<%# Eval("NumeroUtilisateur") %>'>
040.                                </telerik:RadTextBox>
041.                            </div>
042.                            <div class="inputwrap">
043.                                <label for="NomPrenom">Nom: </label>
044.                                <telerik:RadTextBox ID="NomPrenom"
045.                                    runat="server"
046.                                    Enabled="false"
047.                                    EmptyMessage="NomPrenom"
048.                                    AutoPostBack="false"
049.                                    Text='<%# Eval("NomPrenom") %>'>
050.                                </telerik:RadTextBox>
051.                            </div>
052.                            <div class="inputwrap">
053.                                <label for="Courriel">Courriel: </label>
054.                                <telerik:RadTextBox ID="Courriel"
055.                                    runat="server"
056.                                    Enabled="false"
057.                                    EmptyMessage="Courriel"
058.                                    AutoPostBack="false"
059.                                    Text='<%# Eval("Courriel") %>'>
060.                                </telerik:RadTextBox>
061.                            </div>
062.                            <div class="inputwrap">
063.                                <label for="CompteCentral">Compte Central: </label>
064.                                <telerik:RadTextBox ID="CompteCentral"
065.                                    runat="server"
066.                                    Enabled="false"
067.                                    EmptyMessage="Compte Central"
068.                                    AutoPostBack="false"
069.                                    Text="ND">
070.                                </telerik:RadTextBox>
071.                            </div>
072.                            <div class="inputwrap">
073.                                <label for="DateModification">Date Modification: </label>
074.                                <telerik:RadTextBox ID="DateModification"
075.                                    runat="server"
076.                                    Enabled="false"
077.                                    EmptyMessage="DateModification"
078.                                    AutoPostBack="false"
079.                                    Text='<%# Eval("DateModification") %>'>
080.                                </telerik:RadTextBox>
081.                            </div>
082.                            <div class="inputwrap">
083.                                <label for="DateUtilisation">Dernière utilisation: </label>
084.                                <telerik:RadTextBox ID="DateUtilisation"
085.                                    runat="server"
086.                                    Enabled="false"
087.                                    EmptyMessage="DateUtilisation"
088.                                    AutoPostBack="false"
089.                                    Text='<%# Eval("DateUtilisation") %>'>
090.                                </telerik:RadTextBox>
091.                            </div>
092.                            <h2 class="DetailTitle">Compte</h2>
093.                            <br>
094.                            <div class="inputwrap">
095.                                <label for="Compte">Compte: </label>
096.                                <telerik:RadTextBox ID="Compte"
097.                                    runat="server"
098.                                    Enabled="false"
099.                                    EmptyMessage="Compte"
100.                                    AutoPostBack="false"
101.                                    Text='<%# Eval("Compte") %>'>
102.                                </telerik:RadTextBox>
103.                            </div>
104.                            <div class="inputwrap">
105.                                <label for="TypeCompte">Type de compte: </label>
106.                                <telerik:RadTextBox ID="TypeCompte"
107.                                    runat="server"
108.                                    Enabled="false"
109.                                    EmptyMessage="TypeCompte"
110.                                    AutoPostBack="false"
111.                                    Text='<%# Eval("TypeCompte") %>'>                    
112.                                </telerik:RadTextBox>
113.                            </div>
114.                            <div class="inputwrap">
115.                                <label for="Statut">Statut: </label>
116.                                <telerik:RadTextBox ID="Statut"
117.                                    runat="server"
118.                                    Enabled="false"
119.                                    EmptyMessage="Statut"
120.                                    AutoPostBack="false"
121.                                    Text='<%# Eval("Statut") %>'>
122.                                </telerik:RadTextBox>
123.                            </div>
124.                            <div class="inputwrap">
125.                                <label for="DateStatut">Depuis: </label>
126.                                <telerik:RadTextBox ID="DateStatut"
127.                                    runat="server"
128.                                    Enabled="false"
129.                                    EmptyMessage="DateStatut"
130.                                    AutoPostBack="false"
131.                                    Text='<%# Eval("DateStatut") %>'>
132.                                </telerik:RadTextBox>
133.                            </div>
134.                            <telerik:RadButton RenderMode="Lightweight"
135.                                runat="server"
136.                                ID="BoutonModifier"
137.                                Visible="true"
138.                                Text="Modifier"
139.                                CommandName="Edit"
140.                                CssClass="detailButton" >
141.                            <Icon SecondaryIconCssClass="rbEdit"></Icon>
142.                                </telerik:RadButton>
143.                        </fieldset>
144.                    </ItemTemplate>
145.                    <EditItemTemplate>
146.                        <fieldset class="form">
147.                            <div id="teteDroit" runat="server">
148.                                <h2 class="DetailTitle">Utilisateur</h2>
149.                                <div class="inputwrap">
150.                                    <label for="Type">Type: </label>
151.                                    <telerik:RadTextBox ID="Type"
152.                                        runat="server"
153.                                        AutoPostBack="false"
154.                                        Text='<%# Bind("Type") %>'/>
155.                                </div>
156.                                <div class="inputwrap">
157.                                    <label for="Principal">Principal: </label>
158.                                    <telerik:RadTextBox ID="Principal"
159.                                        runat="server"
160.                                        AutoPostBack="false"
161.                                        Text='<%# Bind("Principal") %>'>
162.                                    </telerik:RadTextBox>
163.                                </div>
164.                            </div>
165.                            <div class="inputwrap">
166.                                <label for="NumeroUtilisateur">Numéro d'utilisateur:  </label>
167.                                <telerik:RadTextBox ID="NumeroUtilisateur"
168.                                    runat="server"
169.                                    AutoPostBack="false"
170.                                    Text='<%# Bind("NumeroUtilisateur") %>'>
171.                                </telerik:RadTextBox>
172.                            </div>
173.                            <div class="inputwrap">
174.                                <label for="NomPrenom">Nom: </label>
175.                                <telerik:RadTextBox ID="NomPrenom"
176.                                    runat="server"
177.                                    AutoPostBack="false"
178.                                    Text='<%# Bind("NomPrenom") %>'>
179.                                </telerik:RadTextBox>
180.                            </div>
181.                            <div class="inputwrap">
182.                                <label for="Courriel">Courriel: </label>
183.                                <telerik:RadTextBox ID="Courriel"
184.                                    runat="server"
185.                                    AutoPostBack="false"
186.                                    Text='<%# Bind("Courriel") %>'>
187.                                </telerik:RadTextBox>
188.                            </div>
189.                            <div class="inputwrap">
190.                                <label for="CompteCentral">Compte Central: </label>
191.                                <telerik:RadTextBox ID="CompteCentral"
192.                                    runat="server"
193.                                    AutoPostBack="false"
194.                                    Text="ND">
195.                                </telerik:RadTextBox>
196.                            </div>
197.                            <div class="inputwrap">
198.                                <label for="DateModification">Date Modification: </label>
199.                                <telerik:RadTextBox ID="DateModification"
200.                                    runat="server"
201.                                    AutoPostBack="false"
202.                                    Text='<%# Bind("DateModification") %>'>
203.                                </telerik:RadTextBox>
204.                            </div>
205.                            <div class="inputwrap">
206.                                <label for="DateUtilisation">Dernière utilisation: </label>
207.                                <telerik:RadTextBox ID="DateUtilisation"
208.                                    runat="server"
209.                                    AutoPostBack="false"
210.                                    Text='<%# Bind("DateUtilisation") %>'>
211.                                </telerik:RadTextBox>
212.                            </div>
213.                            <h2 class="DetailTitle">Compte</h2>
214.                            <br>
215.                            <div class="inputwrap">
216.                                <label for="Compte">Compte: </label>
217.                                <telerik:RadTextBox ID="Compte"
218.                                    runat="server"
219.                                    AutoPostBack="false"                                 
220.                                    Text='<%# Bind("Compte") %>'>
221.                                </telerik:RadTextBox>
222.                            </div>
223.                            <div class="inputwrap">
224.                                <label for="TypeCompte">Type de compte: </label>
225.                                <telerik:RadTextBox ID="TypeCompte"
226.                                    runat="server"
227.                                    AutoPostBack="false"
228.                                    Text='<%# Bind("TypeCompte") %>'>
229.                                </telerik:RadTextBox>
230.                            </div>
231.                            <div class="inputwrap">
232.                                <label for="Statut">Statut: </label>
233.                                <telerik:RadTextBox ID="Statut"
234.                                    runat="server"
235.                                    AutoPostBack="false"
236.                                    Text='<%# Bind("Statut") %>'>
237.                                </telerik:RadTextBox>
238.                            </div>
239.                            <div class="inputwrap">
240.                                <label for="DateStatut">Depuis: </label>
241.                                <telerik:RadTextBox ID="DateStatut"
242.                                    runat="server"
243.                                    AutoPostBack="false"
244.                                    Text='<%# Bind("DateStatut") %>'>
245.                                </telerik:RadTextBox>
246.                            </div>
247.                            </div>
248.                            <telerik:RadButton RenderMode="Lightweight"
249.                                ID="updateBouton"
250.                                Text="Enregistrer"
251.                                runat="server"
252.                                OnClick="updateBouton_Click">
253.                            <Icon SecondaryIconCssClass="rbSave"></Icon>
254.                                </telerik:RadButton>
255.                            <telerik:RadButton RenderMode="Lightweight"
256.                                ID="BoutonInsert"
257.                                Text="Insert"
258.                                runat="server"
259.                                CommandName="Insert"
260.                                AutoPostBack="true" >
261.                                <Icon SecondaryIconCssClass="rbAdd"></Icon>
262.                                </telerik:RadButton>
263.                            <telerik:RadButton RenderMode="Lightweight"
264.                                ID="BoutonAnnuler"
265.                                Text="Annuler"
266.                                runat="server"
267.                                CausesValidation="false"
268.                                CommandName="Cancel" >
269.                                <Icon SecondaryIconCssClass="rbCancel"></Icon>
270.                                </telerik:RadButton>
271.                        </fieldset>
272.                    </EditItemTemplate>
273.                </telerik:RadDataForm>

 

 

Konstantin Dikov
Telerik team
 answered on 07 Dec 2016
1 answer
256 views

I'm hoping that someone can help me. I have a radgrid with a Add New Sales Opportunity button on the command bar at the top of the MasterTableView. When clicked the ItemCreated event is fired. I have a JavaScript alert that asks if the user wants to create another record after they have saved their first. I am using a HiddenField on the user control to send the response back to the server side. What I need to do is raise the ItemCreated event in the code behind to open a new add form if the user options to create a new record. 

Here's a snippet of how my grid is created in the user control:

<telerik:RadGrid  runat="server" ID="grdSalesOpportunity" CssClass="grdSalesOpportunityClass" AllowPaging="True" AllowCustomPaging="true" 
                AutoGenerateColumns="false" EnableLinqExpressions="false"
                AllowSorting="true" GridLines="Both" OnNeedDataSource="grdSalesOpportunity_NeedDataSource" CommandItemStyle-CssClass="swrap"
                OnItemDataBound="grdSalesOpportunity_ItemDataBound"
                NonExportingColumns="EditCommandColumn,DeleteColumn,AddNotes" ShowAllExportButtons="false"
                OnSortCommand="grdSalesOpportunity_SortCommand" OnPageSizeChanged="grdSalesOpportunity_PageSizeChanged"
                OnUpdateCommand="grdSalesOpportunity_UpdateCommand" OnInsertCommand="grdSalesOpportunity_InsertCommand"
                OnItemCommand="grdSalesOpportunity_ItemCommand" OnItemCreated="grdSalesOpportunity_ItemCreated" ShowExtraButtons="true">
                <ClientSettings Scrolling-AllowScroll="true" Scrolling-UseStaticHeaders="true"></ClientSettings>
                <GroupingSettings CaseSensitive="false" />
                <ExportSettings ExportOnlyData="True" IgnorePaging="True" OpenInNewWindow="True"
                    Pdf-PageWidth="350mm" Pdf-PageHeight="210mm" Pdf-PageLeftMargin="20mm" Pdf-PageRightMargin="20mm">
                </ExportSettings>

                <MasterTableView CommandItemDisplay="Top" DataKeyNames="SOID" AllowFilteringByColumn="true"
                    ClientDataKeyNames="SOID">
                    <CommandItemSettings ShowAddNewRecordButton="true" AddNewRecordText="Add New Sales Opportunity"
                        ShowExportToCsvButton="true" ShowExportToExcelButton="true" ShowExportToPdfButton="true"
                        ShowExportToWordButton="false" />

 

 

 

 

Eyup
Telerik team
 answered on 07 Dec 2016
6 answers
327 views

Hello,

I'm trying to get a working RadHtmlChart. But as soon as i'm using a LinQ-DataSource, i'm getting an Javascript-Exception "0x800a03f7: Unterminated String Constant" and the Chart is empty

Here's the Code of the .aspx:

<telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="800px" Height="500px">
          <PlotArea>
             <Series>
                <telerik:ColumnSeries DataFieldY="PriceVk">
                </telerik:ColumnSeries>
              </Series>
            <XAxis DataLabelsField="Name"></XAxis>
       </PlotArea>
</telerik:RadHtmlChart>

 

And this is the Code Behind:

protected void Page_Load(object sender, EventArgs e)
        {
            var context = new StuffrulerDataContext(this.Connection);
            var data = context.StuffItems.Where(i => i.PriceVk > 0).Take(5).ToList();
            this.RadHtmlChart1.DataSource = data;
           // this.RadHtmlChart1.DataSource = GetData();
            this.RadHtmlChart1.DataBind();
 
        }
 
        protected DataTable GetData()
        {
            DataTable tbl = new DataTable();
            tbl.Columns.Add(new DataColumn("PriceVk", typeof(decimal)));
            tbl.Columns.Add(new DataColumn("Name", typeof(string)));
 
            tbl.Rows.Add(new object[] { 100, "First" });
            tbl.Rows.Add(new object[] { 200, "Second" });
            return tbl;
        }

 

When I'm using GetData() as Source, it works fine.

 

Roland Klug
Top achievements
Rank 1
 answered on 07 Dec 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?