Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
88 views
Hi,

I am using radgrid asp.net control for inplace editing and to bind cascaded data from sharepoint list.

 When user clicks on any cell the cell should goes to editable mode. In editable mode there will be any
control like check box, drop down list, radio buttons, etc. and the control should get populated with sharepoint list data.
Once the value is specified next column cell should goes in editable mode and the data for that control will come from sharepoint list,
but the data will be depend on the selection of previous column cell.
 
Whatever the demo examples you have provided that uses the
SQLDataSource and AJAX.
But I want CRUD operation should happen with inplace editing.
And the data source should be Sharepoint list.

Please suggest me to interacting with radgridview with sharepoint list.

Thanks.
Tsvetoslav
Telerik team
 answered on 07 Nov 2012
2 answers
190 views
Hello,

I programmed a RadGrid with grouping and paging.

With an older version of Telerik the paging was working well with the grouping. 
Since the upgrade from the last version, if I keep the grouping, the paging doesn't work.

I use a SqlDataSource that I programme in the code behind.

This is my code :
ASPX:
<%@ Page Title="Suivi des tickets" Language="C#" MasterPageFile="~/MasterPage.master"
    AutoEventWireup="true" CodeFile="SuiviTickets.aspx.cs" Inherits="Incidents_SuiviTickets" %>
 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<%@ Register Src="Menu.ascx" TagName="Menu" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        .left
        {
            margin-left: 30px;
        }
        .label
        {
            width: 110px;
            text-align: right;
            display: inline-block;
            font-style: italic;
            font-weight: bold;
            font-size: 1.1em;
            margin-right: 10px;
        }
        .labelTexte
        {
            display: inline-block;
        }
        .top
        {
            vertical-align: top;
        }
        .labelGauche
        {
            width: 100px;
            text-align: right;
            display: inline-block;
            vertical-align: top;
        }
        .ligne
        {
            margin: 10px;
            display: block;
        }
        .droite
        {
            float: right;
            clear: both;
            margin: 10px;
        }
        .floatLeft
        {
            float: left;
        }
        #ticket
        {
            height: 400px;
        }
        .fieldset
        {
            margin: 10px auto 0 auto;
            width: 90%;
            clear: both;
        }
        .fieldsetRecherche
        {
            margin: 10px 0;
        }
        .rechercheGauche
        {
            width: 55%;
            float: left;
        }
        .rechercheDroite
        {
            width: 40%;
            float: right;
        }
        .labelRecherche
        {
            width: 55px;
            text-align: right;
            display: inline-block;
        }
        .divEtatGauche
        {
            float: left;
        }
        .btnRechercher
        {
            float: right;
            top: 90px;
            position: relative;
        }
    </style>
 
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <uc1:Menu ID="Menu1" runat="server" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="ralpIncident">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgTickets">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="phGrid" />
                    <telerik:AjaxUpdatedControl ControlID="rgTickets" />
                    <telerik:AjaxUpdatedControl ControlID="phRecherche" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnValider">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="phGrid" />
                    <telerik:AjaxUpdatedControl ControlID="rgTickets" />
                    <telerik:AjaxUpdatedControl ControlID="phRecherche" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnAnnuler">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="phGrid" />
                    <telerik:AjaxUpdatedControl ControlID="rgTickets" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnRechercher">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="phGrid" />
                    <telerik:AjaxUpdatedControl ControlID="rgTickets" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="ralpIncident" runat="server" />
    <telerik:RadAjaxPanel ID="radAjaxPanel1" runat="server" LoadingPanelID="ralpIncident">
        <asp:PlaceHolder ID="phRecherche" runat="server">
            <fieldset class="fieldsetRecherche">
                <legend> Recherche </legend>
                <div class="rechercheGauche">
                    <span class="ligne">
                        <asp:TextBox ID="tbRecherche" runat="server" Width="447px"></asp:TextBox>
                        <ajax:TextBoxWatermarkExtender ID="tweRecherche" TargetControlID="tbRecherche" runat="server"
                            WatermarkText="Titre, description, demandeur(uid), n° ticket, ...">
                        </ajax:TextBoxWatermarkExtender>
                    </span><span class="ligne">
                        <asp:Label ID="lbAffecteA" Text="Affecté à" runat="server" class="labelRecherche"></asp:Label>
                        <telerik:RadComboBox ID="rcbAffecte" runat="server" DataTextField="prenomNom" DataSourceID="odsDSI"
                            DataValueField="ID" Height="100%" AppendDataBoundItems="true" Width="180px" DropDownWidth="180px"
                            CssClass="left">
                            <Items>
                                <telerik:RadComboBoxItem Value="0" runat="server" />
                            </Items>
                        </telerik:RadComboBox>
                    </span><span class="ligne">
                        <asp:Label ID="lbDate" Text="Date" runat="server" class="labelRecherche"></asp:Label>
                        <telerik:RadComboBox ID="rcbTypeDate" runat="server" Height="100%" AppendDataBoundItems="true"
                            Width="85px" DropDownWidth="85px" CssClass="left">
                            <Items>
                                <telerik:RadComboBoxItem Value="0" runat="server" />
                                <telerik:RadComboBoxItem Text="Création" Value="1" runat="server" />
                                <telerik:RadComboBoxItem Text="Affectation" Value="2" runat="server" />
                                <telerik:RadComboBoxItem Text="Traitement" Value="3" runat="server" />
                            </Items>
                        </telerik:RadComboBox>
                          entre  
                        <telerik:RadDatePicker ID="rdpDebut" runat="server" Width="100px">
                        </telerik:RadDatePicker>
                         et 
                        <telerik:RadDatePicker ID="rdpFin" runat="server" Width="100px">
                        </telerik:RadDatePicker>
                    </span>
                </div>
                <div class="rechercheDroite">
                    <asp:Label ID="lbRechercheEtat" Text="Etat" runat="server" class="labelRecherche floatLeft"></asp:Label>
                    <asp:CheckBoxList ID="cblEtat" CssClass="left floatLeft" DataSourceID="sdsEtats"
                        runat="server" OnDataBound="cblEtat_DataBound" DataTextField="libelle" DataValueField="idEtat"
                        RepeatColumns="1" RepeatDirection="Vertical">
                    </asp:CheckBoxList>
                    <asp:Button ID="btnRechercher" runat="server" Text="Rechercher" class="btnRechercher"
                        OnClick="btnRechercher_Click" />
                </div>
            </fieldset>
        </asp:PlaceHolder>
        <asp:PlaceHolder ID="phGrid" runat="server" Visible="true">
        <telerik:RadScriptBlock ID="rsbScript" runat="server">
            <script type="text/javascript">
                function showToolTip(element, idTicket) {
                    var tooltipManager = $find("<%= rtmTicket.ClientID %>");
 
                    // Si l'utilisateur survole la celulle avant que la page est chargée, il n'ya pas de gestionnaire créé
                    if (!tooltipManager) return;
 
                    //  Trouver l'info-bulle pour cet élément si elle a été créée
                    var tooltip = tooltipManager.getToolTipByElement(element);
 
                    //Create a tooltip if no tooltip exists for such element
                    if (!tooltip) {
                     tooltip = tooltipManager.createToolTip(element);
 
                     tooltip.set_value(idTicket);
                    }
 
                    // Créer une info-bulle si aucune info-bulle existe pour cet élément
                    element.onmouseover = null;
 
                    // afficher l'info-bulle
                    setTimeout(function() {
                     tooltip.show();
                    }, 10);
                }
 
            </script>
        </telerik:RadScriptBlock>  
            <telerik:RadToolTipManager ID="rtmTicket" runat="server" Position="MiddleLeft"
                HideEvent="LeaveTargetAndToolTip" Animation="Fade" RelativeTo="Mouse" Width="500px" AutoCloseDelay="0"
                IgnoreAltAttribute="true" >
            <WebServiceSettings Path="../WebServices/TooltipTickets.asmx" Method="GetToolTipData" />
        </telerik:RadToolTipManager>
            <telerik:RadGrid ID="rgTickets" runat="server" AutoGenerateColumns="false" DataSourceID="sdsTickets"
                ShowGroupPanel="True" OnItemCommand="rgTickets_ItemCommand"
                AllowPaging="true"  PageSize="25"
                OnPageIndexChanged="rgTickets_PageIndexChanged" OnPageSizeChanged="rgTickets_PageSizeChanged"
                AllowAutomaticDeletes="true" 
                AllowSorting="true" OnSortCommand="rgTickets_SortCommand"
                OnGroupsChanging="RgTickets_GroupsChanging"
                AllowFilteringByColumn="True"
                OnDeleteCommand="rgTickets_DeleteCommand" OnItemDataBound="rgTickets_ItemDataBound">
                <MasterTableView DataSourceID="sdsTickets" DataKeyNames="idTicket" GroupLoadMode="Server"
                    AllowMultiColumnSorting="true" AllowCustomSorting="true" AllowFilteringByColumn="true" >
                    <GroupByExpressions>
                        <telerik:GridGroupByExpression >
                         
                            <SelectFields>
                                <telerik:GridGroupByField FieldName="Etat" />
                                <telerik:GridGroupByField FieldName="nbTickets" HeaderText="Nb tickets" Aggregate="Count" />
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="idEtat" FieldAlias="Etats" SortOrder="Ascending" />
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                    </GroupByExpressions>
                    <Columns>
                        <telerik:GridBoundColumn UniqueName="idTicket" DataField="idTicket" HeaderText="Num Ticket"
                            HeaderStyle-Width="20px" ItemStyle-Width="20px" FilterControlWidth="20px" AutoPostBackOnFilter="false"
                            CurrentFilterFunction="equalto" FilterDelay="1000" ShowFilterIcon="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="demandeur" DataField="demandeur" HeaderText="Demandeur"
                            ItemStyle-Wrap="true" AllowFiltering="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="dateDemande" DataField="dateDemandeFormate"
                            HeaderText="Date demande" HeaderStyle-Width="80px" ItemStyle-Width="80px" DataFormatString="{0:dd/MM/yyyy}"
                            DataType="System.DateTime" FilterControlWidth="80px" AutoPostBackOnFilter="false"
                            CurrentFilterFunction="StartsWith" FilterDelay="1000" ShowFilterIcon="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="titre" DataField="titre" HeaderText="Titre"
                            ItemStyle-Wrap="true " AllowFiltering="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn ShowFilterIcon="false" AllowFiltering="false" HeaderText="Description" UniqueName="description"
                            HeaderStyle-Width="120px">
                            <ItemTemplate>
                                <asp:Label ID="rgLbDescription" runat="server" Text='<%# Eval("descriptionCourte") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn UniqueName="IdAffecteA" DataField="IdAffecteA" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="affecteA" DataField="affecteA" HeaderText="Affecté à"
                            ItemStyle-Width="100px" ShowFilterIcon="false" AutoPostBackOnFilter="false">
                            <FilterTemplate>
                                <telerik:RadComboBox ID="rcbAffecteA" DataTextField="prenomNom" DataSourceID="odsDSI"
                                    DataValueField="ID" Height="100%" AppendDataBoundItems="true" Width="120px" DropDownWidth="200px"
                                    SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("IdAffecteA").CurrentFilterValue %>'
                                    runat="server" OnClientSelectedIndexChanged="rcbAffecteA_ClientSelectedIndexChanged">
                                    <Items>
                                        <telerik:RadComboBoxItem />
                                    </Items>
                                </telerik:RadComboBox>
                                <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
 
                                    <script type="text/javascript">
                                        function rcbAffecteA_ClientSelectedIndexChanged(sender, args) {
                                            var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                            tableView.filter("IdAffecteA", args.get_item().get_value(), "EqualTo");
                                        
                                    </script>
 
                                </telerik:RadScriptBlock>
                            </FilterTemplate>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="dateAffectation" DataField="dateAffectation"
                            HeaderText="Date affectation" DataFormatString="{0:dd/MM/yyyy}" HeaderStyle-Width="80px"
                            ItemStyle-Width="80px" AllowFiltering="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="dateTraitement" DataField="dateTraitement" HeaderText="Date traitement"
                            HeaderStyle-Width="80px" ItemStyle-Width="80px" DataFormatString="{0:dd/MM/yyyy}"
                            DataType="System.DateTime" FilterControlWidth="80px" AutoPostBackOnFilter="false"
                            CurrentFilterFunction="StartsWith" FilterDelay="1000" ShowFilterIcon="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="IdEtat" DataField="IdEtat" Display="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="etat" DataField="etat" HeaderText="Etat" ShowFilterIcon="false"
                            AutoPostBackOnFilter="false" Display="true">
                            <FilterTemplate>
                                <telerik:RadComboBox ID="rcbEtatTic" DataTextField="libelle" DataSourceID="sdsEtats"
                                    DataValueField="IdEtat" Height="100%" AppendDataBoundItems="true" Width="50px"
                                    DropDownWidth="80px" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("IdEtat").CurrentFilterValue %>'
                                    runat="server" OnClientSelectedIndexChanged="rcbEtatTic_ClientSelectedIndexChanged">
                                    <Items>
                                        <telerik:RadComboBoxItem />
                                    </Items>
                                </telerik:RadComboBox>
                                <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server">
 
                                    <script type="text/javascript">
                                        function rcbEtatTic_ClientSelectedIndexChanged(sender, args) {
                                            var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                            tableView.filter("IdEtat", args.get_item().get_value(), "EqualTo");
                                        
                                    </script>
 
                                </telerik:RadScriptBlock>
                            </FilterTemplate>
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn UniqueName="Editer" AllowFiltering="false" >
                            <ItemTemplate>
                                <a href="GestionTicket.aspx?ticket=<%# Eval("idTicket") %>" target="_blank">
                                    <img src="../Images/edit.gif" />
                                </a>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridButtonColumn ConfirmText="Annuler le ticket ?" ConfirmDialogType="Classic"
                            ConfirmTitle="Annuler" ButtonType="ImageButton" CommandName="Delete" Text="Annuler"
                            ImageUrl="../Images/cancel.gif" UniqueName="DeleteColumn" ItemStyle-Width="20px">
                            <ItemStyle HorizontalAlign="Center"></ItemStyle>
                        </telerik:GridButtonColumn>
                    </Columns>
                </MasterTableView>
                <ClientSettings AllowDragToGroup="true">
                </ClientSettings>
                <GroupingSettings ShowUnGroupButton="true"></GroupingSettings>
                <PagerStyle Mode="NextPrevAndNumeric" PageSizeLabelText="Par page :" PagerTextFormat="{5} ligne(s) dans {1}"
                    FirstPageToolTip="Première page" LastPageToolTip="Dernière page" NextPageToolTip="Page suivante"
                    PrevPageToolTip="Page précédente" PageButtonCount="15" AlwaysVisible="true" Position="TopAndBottom" />
            </telerik:RadGrid>
        </asp:PlaceHolder>
    </telerik:RadAjaxPanel>
    <asp:SqlDataSource ID="sdsTickets" runat="server" ConnectionString="<%$ ConnectionStrings:Intranet %>"
        ProviderName="<%$ ConnectionStrings:Intranet.ProviderName %>" DeleteCommand="UPDATE INT_Tickets SET idEtat=5 WHERE idTicket=?idTicket">
        <UpdateParameters>
            <asp:Parameter Name="idTicket" Type="Int32"></asp:Parameter>
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sdsEtats" runat="server" ConnectionString="<%$ ConnectionStrings:Intranet %>"
        ProviderName="<%$ ConnectionStrings:Intranet.ProviderName %>" SelectCommand="SELECT * FROM INT_TicketsEtats ">
    </asp:SqlDataSource>
    <asp:ObjectDataSource ID="odsDSI" runat="server" SelectMethod="DSI" TypeName="AnnuaireEmployes">
    </asp:ObjectDataSource>
</asp:Content>

CS:
using System;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
 
 
using Telerik.Web.UI;
 
public partial class Incidents_SuiviTickets : PageBase
{
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        Menu1.Demandeur(Contexte.Utilisateur.UID);
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
 
            if (Contexte.Droits.Contains("DSI"))
            {
                rcbAffecte.DataBind();
                rcbAffecte.SelectedValue = Contexte.Utilisateur.ID.ToString();
 
                cblEtat.DataBind();
                // on sélectionne la cb nouveau
                cblEtat.Items[0].Selected = true;
                // on sélectionne la cb pris en charge
                cblEtat.Items[1].Selected = true;
            }
            Bind();
        }
 
    }
 
    protected void cblEtat_DataBound(object sender, EventArgs e)
    {
        if (Contexte.Droits.Contains("DSI"))
        {
            //rcbAffecte.DataBind();
            // on sélectionne l'id de l'utilisatuer (DSI) connecté
            rcbAffecte.SelectedValue = Contexte.Utilisateur.ID.ToString();
            // on sélectionne la cb nouveau
            cblEtat.Items[0].Selected = true;
            // on sélectionne la cb pris en charge
            cblEtat.Items[1].Selected = true;
        }
    }
 
    protected void Bind()
    {
        // Supprimer les paramètres existants
        sdsTickets.SelectParameters.Clear();
 
        // Récupérer les infos des tickets avec libellé
        var requeteInfos = new StringBuilder();
        requeteInfos.Append("SELECT idTicket, uidDemandeur, demandeur, mailDemandeur, DATE_FORMAT(dateDemande, '%d/%m/%Y') as dateDemandeFormate, dateDemande, idAffecteA, affecteA, dateAffectation, DATE_FORMAT(dateTraitement, '%d/%m/%Y') as dateTraitement, titre, REPLACE(description, '\n', '<br/>') as description, if(LENGTH(description) > 15, CONCAT(SUBSTRING(description, 1, 15), '...'), SUBSTRING(description, 1, 15)) as descriptionCourte, e.idEtat, e.libelle as etat, (SELECT COUNT(*) FROM INT_Tickets) as nbTickets ");
        requeteInfos.AppendLine("FROM intranet.INT_Tickets t ");
        requeteInfos.AppendLine("LEFT JOIN INT_TicketsEtats e ON e.idEtat=t.idEtat ");
 
        // Afficher les tickets de l'utilisateur connecté sauf s'il fait pati de la DSI
        var where = new StringBuilder();
        if (!Contexte.Droits.Contains("DSI"))
        {
            phRecherche.Visible = false;
            where.AppendLine(string.Format(" WHERE uidDemandeur=?uidDemandeur ", Utilisateur.UID));
            sdsTickets.SelectParameters.Add("uidDemandeur", Utilisateur.UID);
            requeteInfos.AppendLine(where.ToString());
        }
        else
        {
            phRecherche.Visible = true;
 
            #region Recherche
            var filtre = new StringBuilder();
 
            // Filtre sur le n° ticket, titre, descriptino demandeur
            if (!string.IsNullOrEmpty(tbRecherche.Text))
            {
                filtre.Append(" ((idTicket=?idTicket ");
                filtre.Append(" OR titre LIKE ?text OR description LIKE ?text OR demandeur LIKE ?text) ");
                sdsTickets.SelectParameters.Add("idTicket", tbRecherche.Text);
                sdsTickets.SelectParameters.Add("text", string.Format("%{0}%", tbRecherche.Text));
            }
            // Filtre sur AffecteA
            if (Convert.ToInt32(rcbAffecte.SelectedValue) > 0)
            {
                if (!string.IsNullOrEmpty(filtre.ToString()))
                    filtre.Append(" AND idAffecteA=?idAffecteA ");
                else
                    filtre.Append(" (idAffecteA=?idAffecteA ");
 
                sdsTickets.SelectParameters.Add("idAffecteA", rcbAffecte.SelectedValue);
            }
            // Filtre par date
            if (Convert.ToInt32(rcbTypeDate.SelectedValue) > 0 && (rdpDebut.SelectedDate.HasValue || rdpFin.SelectedDate.HasValue))
            {
                switch (rcbTypeDate.SelectedItem.Text)
                {
                    case "Création":
                        if (!string.IsNullOrEmpty(filtre.ToString()))
                            filtre.Append(string.Format(" AND (DATE(dateDemande) BETWEEN ?debutDem AND ?finDem) "));
                        else
                            filtre.Append(string.Format(" ((DATE(dateDemande) BETWEEN ?debutDem AND ?finDem) "));
 
                        sdsTickets.SelectParameters.Add("debutDem", !rdpDebut.SelectedDate.HasValue ? rdpDebut.MinDate.ToString("yyyy-MM-dd") : !string.IsNullOrEmpty(rdpDebut.SelectedDate.Value.ToString("yyyy-MM-dd")) ? rdpDebut.SelectedDate.Value.ToString("yyyy-MM-dd") : rdpDebut.MinDate.ToString("yyyy-MM-dd"));
                        sdsTickets.SelectParameters.Add("finDem", !rdpFin.SelectedDate.HasValue ? rdpFin.MaxDate.ToString("yyyy-MM-dd") : !string.IsNullOrEmpty(rdpFin.SelectedDate.Value.ToString("yyyy-MM-dd")) ? rdpFin.SelectedDate.Value.ToString("yyyy-MM-dd") : rdpFin.MaxDate.ToString("yyyy-MM-dd"));
 
                        break;
                    case "Affectation":
                        if (!string.IsNullOrEmpty(filtre.ToString()))
                            filtre.Append(string.Format(" AND (DATE(dateAffectation) BETWEEN ?debutAff AND ?finAff) "));
                        else
                            filtre.Append(string.Format(" ((DATE(dateAffectation) BETWEEN ?debutAff AND ?finAff) "));
 
                        sdsTickets.SelectParameters.Add("debutDem", !rdpDebut.SelectedDate.HasValue ? rdpDebut.MinDate.ToString("yyyy-MM-dd") : !string.IsNullOrEmpty(rdpDebut.SelectedDate.Value.ToString("yyyy-MM-dd")) ? rdpDebut.SelectedDate.Value.ToString("yyyy-MM-dd") : rdpDebut.MinDate.ToString("yyyy-MM-dd"));
                        sdsTickets.SelectParameters.Add("finDem", !rdpFin.SelectedDate.HasValue ? rdpFin.MaxDate.ToString("yyyy-MM-dd") : !string.IsNullOrEmpty(rdpFin.SelectedDate.Value.ToString("yyyy-MM-dd")) ? rdpFin.SelectedDate.Value.ToString("yyyy-MM-dd") : rdpFin.MaxDate.ToString("yyyy-MM-dd"));
 
                        break;
                    case "Traitement":
                        if (!string.IsNullOrEmpty(filtre.ToString()))
                            filtre.Append(string.Format(" AND (DATE(dateTraitement) BETWEEN ?debutTra AND ?finTra) "));
                        else
                            filtre.Append(string.Format(" ((DATE(dateTraitement) BETWEEN ?debutTra AND ?finTra) "));
 
                        sdsTickets.SelectParameters.Add("debutDem", !rdpDebut.SelectedDate.HasValue ? rdpDebut.MinDate.ToString("yyyy-MM-dd") : !string.IsNullOrEmpty(rdpDebut.SelectedDate.Value.ToString("yyyy-MM-dd")) ? rdpDebut.SelectedDate.Value.ToString("yyyy-MM-dd") : rdpDebut.MinDate.ToString("yyyy-MM-dd"));
                        sdsTickets.SelectParameters.Add("finDem", !rdpFin.SelectedDate.HasValue ? rdpFin.MaxDate.ToString("yyyy-MM-dd") : !string.IsNullOrEmpty(rdpFin.SelectedDate.Value.ToString("yyyy-MM-dd")) ? rdpFin.SelectedDate.Value.ToString("yyyy-MM-dd") : rdpFin.MaxDate.ToString("yyyy-MM-dd"));
 
                        break;
                    default:
                        break;
                }
            }
 
            // Filtre sur les états
            var listeEtats = new StringBuilder();
            var filtreEtats = new StringBuilder();
            var nouveau = string.Empty;
            foreach (ListItem item in cblEtat.Items)
            {
                if (item.Selected && !item.Value.Equals("1"))
                {
                    listeEtats.Append(item.Value + ",");
                }
 
                if (item.Selected && item.Value.Equals("1"))
                {
                    nouveau = item.Value;
                }
            }
            if (listeEtats.ToString().EndsWith(","))
                listeEtats = listeEtats.Remove(listeEtats.Length - 1, 1);
 
            if (!string.IsNullOrEmpty(listeEtats.ToString()))
            {
                var etats = listeEtats.ToString().Split(',');
                if (!string.IsNullOrEmpty(filtre.ToString()))
                    filtreEtats.Append(" AND (");
                else
                    filtreEtats.Append(" (");
 
                foreach (var etat in etats)
                {
                    filtreEtats.Append(string.Format(" t.idEtat=?etat{0} OR ", etat));
                    sdsTickets.SelectParameters.Add(string.Format("etat{0}", etat), etat);
                }
                var fEtat = filtreEtats.ToString();
 
                if (fEtat.EndsWith(" OR "))
                {
                    fEtat = fEtat.Remove(fEtat.Length - (" OR ".Length), " OR ".Length);
                }
 
                if (!string.IsNullOrEmpty(filtre.ToString()))
                    filtre.Append(fEtat + ")");
                else
                    filtre.Append(fEtat);
            }
            #endregion
 
            if (string.IsNullOrEmpty(where.ToString()) && !string.IsNullOrEmpty(filtre.ToString()))
                where.Append(" WHERE ");
            if (!string.IsNullOrEmpty(filtre.ToString()))
            {
                requeteInfos.AppendLine(where.ToString());
                requeteInfos.Append(filtre.ToString());
                requeteInfos.Append(") ");
            }
            else
            {
                requeteInfos.AppendLine(where.ToString());
            }
            if (!string.IsNullOrEmpty(nouveau))
            {
                if (!string.IsNullOrEmpty(filtre.ToString()))
                {
                    requeteInfos.Append(" OR t.idEtat = ?idEtat ");
                }
                else
                {
                    if (string.IsNullOrEmpty(where.ToString()))
                    {
                        where.Append(" WHERE ");
                    }
                    else
                    {
                        where.Append(" AND ");
                    }
 
                    requeteInfos.Append(where + " t.idEtat = ?idEtat ");
                }
                sdsTickets.SelectParameters.Add("idEtat", nouveau);
            }
        }
 
        requeteInfos.Append(" ORDER BY t.idEtat asc, dateDemande desc");
 
        sdsTickets.SelectCommand = requeteInfos.ToString();
        sdsTickets.DataBind();
    }
 
    protected void rgTickets_PageIndexChanged(object sender, GridPageChangedEventArgs e)
    {
        Bind();
    }
 
    protected void rgTickets_PageSizeChanged(object sender, GridPageSizeChangedEventArgs e)
    {
        Bind();
    }
 
    protected void rgTickets_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.NextPageCommandArgument || e.CommandName == RadGrid.PrevPageCommandArgument ||
            e.CommandName == RadGrid.FirstPageCommandArgument || e.CommandName == RadGrid.LastPageCommandArgument ||
            e.CommandName == RadGrid.PageCommandName || e.CommandName == RadGrid.SortCommandName ||
            e.CommandName == RadGrid.FilterCommandName )
        {
            Bind();
        }
    }
 
    protected void RgTickets_GroupsChanging(object sender, GridGroupsChangingEventArgs e)
    {
        Bind();
    }
 
    protected void rgTickets_SortCommand(object sender, GridSortCommandEventArgs e)
    {
        Bind();
    }
 
    protected void btnRechercher_Click(object sender, EventArgs e)
    {
        Bind();
    }
 
    protected void rgTickets_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            var item = e.Item as GridDataItem;
            if (!Contexte.Droits.Contains("DSI") && (string.IsNullOrEmpty(item["AffecteA"].Text) || item["AffecteA"].Text.Equals(" ")) && item["etat"].Text.Equals("Nouveau"))
            {
                item["DeleteColumn"].Visible = true;
            }
            else
                item["DeleteColumn"].Visible = false;
 
 
            var idTicket = item["idTicket"].Text.ToString();
            item["description"].Attributes["onmouseover"] = string.Format("showToolTip(this,{0});", idTicket);
        }
    }
 
    protected void rgTickets_DeleteCommand(object sender, GridCommandEventArgs e)
    {
        Bind();
    }
 
    protected bool GetDeleteVisible(int idEtat)
    {
        if (!Contexte.Droits.Contains("DSI"))
            return true;
 
        return false;
    }
 
    protected bool GetVisible()
    {
        if (!Contexte.Droits.Contains("DSI"))
            return false;
 
        return true;
    }
 
    public bool GetSuppression(int idUtilisateur)
    {
        if (idUtilisateur == Utilisateur.ID)
            return true;
 
        return false;
    }
 
    private class Message
    {
        public int IdMessage { get; set; }
        public string Texte { get; set; }
        public DateTime DateMessage { get; set; }
        public string Utilisateur { get; set; }
        public int IdUtilisateur { get; set; }
    }
}

Thank you for your answer,

Cordially,

Simon
Simon
Top achievements
Rank 1
 answered on 07 Nov 2012
1 answer
61 views
Hi,

I have tried my utmost to get my radgrid to fill a 100% div area which is fitted to the page height with no luck at all.

Could someone please let me know how to get the grid to fit the page or parent div height and also adjust as the page is resized.

Much Thanks!
Pavlina
Telerik team
 answered on 07 Nov 2012
9 answers
274 views
Hi , Can any one help me, i'm using RadDatePicker in this , i blocking some special days. special days blocking are working fine if i change the month from july to august its working fine . if i again change to august to july code blocking is there but images for that special days are not working. I'm also using autopostback="true".  Here my code
    <telerik:RadCodeBlock ID="myCodeBlock" runat="server">
        <script type="text/javascript">
            //<![CDATA[
            function rdpDay_OnDateSelected(sender, e) {
                var myId = document.getElementById("<%= ddlTime.ClientID %>");
                if (myId != null) {
                    myId.style.display = "none";
                }
                document.getElementById("<%= hfHideValue.ClientID %>").value = "Hidden";
            }
 
            // necessary to disable the weekends on client-side navigation
            function OnDayRender(calendarInstance, args) {
                // convert the date-triplet to a javascript date
                // we need Date.getDay() method to determine
                // which days should be disabled (e.g. every Saturday (day = 6) and Sunday (day = 0))               
                //var jsDate = new Date(args.Date[0], args.Date[1] - 1, args.Date[2]);
                var jsDate = new Date(args._date[0], args._date[1] - 1, args._date[2]);
                var disabledDays = document.getElementById("ctl00_cphMaster_hdDisableWeek").value;
                var mySplitResult = disabledDays.split(",");
                for (i = 0; i < mySplitResult.length; i++) {
                    if (jsDate.getDay() == parseInt(mySplitResult[i])) {
                        var otherMonthCssClass = "ColorGray";
                        args._cell.className = otherMonthCssClass;
                        // replace the default cell content (anchor tag) with a span element
                        // that contains the processed calendar day number -- necessary for the calendar skinning mechanism
                        args._cell.innerHTML = "<span>" + args._date[2] + "</span>";
                        // disable selection and hover effect for the cell
                        args._cell.DayId = "";
                        break;
                    }
                }
 
                var blockedDays = document.getElementById("ctl00_cphMaster_hdBlockDays").value;
                var mySplitBlockDaysResult = blockedDays.split(",");
                for (i = 0; i < mySplitBlockDaysResult.length; i++) {
                    var d = new Date(mySplitBlockDaysResult[i]);
                    if (jsDate.toString() == d.toString()) {
                        var otherMonthCssClass = "ColorRed";
                        args._cell.className = otherMonthCssClass;
                        // replace the default cell content (anchor tag) with a span element
                        // that contains the processed calendar day number -- necessary for the calendar skinning mechanism
                        args._cell.innerHTML = "<span>" + args.Date[2] + "</span>";
                        // disable selection and hover effect for the cell
                        args._cell.DayId = "";
                        break;
                    }
                }
            }
            //]]>
        </script>
    </telerik:RadCodeBlock>
 
<telerik:RadDatePicker ID="rdpDay" AutoPostBack="true" runat="server" CssClass="txtStyl" Width="120px"
                                                            Skin="Office2007">
                                                            <DateInput ID="DateInput1" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"
                                                                FocusedStyle-CssClass="txtStyl" EnabledStyle-CssClass="txtStyl" HoveredStyle-CssClass="txtStyl"
                                                                EmptyMessage="dd/mm/yyyy" ForeColor="#666666" Font-Names="Arial,Helvetica,sans-serif"
                                                                HideOnBlur="True" runat="server" ReadOnly="true" Style="font-size: 11pt; width: 75px;">
                                                            </DateInput>
                                                            <Calendar OnDayRender="Calendar_OnDayRender" AutoPostBack="true" runat="server" Skin="Office2007">
                                                                <ClientEvents OnDayRender="OnDayRender" />
                                                            </Calendar>
                                                            <ClientEvents OnDateSelected="rdpDay_OnDateSelected" />
                                                        </telerik:RadDatePicker>
protected void Calendar_OnDayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
    {
        if (enableWeek == null)
        {
            if (ViewState["enableWeek"] != null)
                enableWeek = (StringBuilder)ViewState["enableWeek"];
        }
 
        if (myBlockDays == string.Empty)
        {
            if (ViewState["myBlockDays"] != null)
                myBlockDays = ViewState["myBlockDays"].ToString();
        }
 
        if (enableWeek != null)
        {
            string[] iEnableWeek = enableWeek.ToString().Split(',');
 
            string[] iDisableWeek = new string[7] { "0", "1", "2", "3", "4", "5", "6" };
 
            for (int i = 0; i < iDisableWeek.Length; i++)
            {
                for (int j = 0; j < iEnableWeek.Length; j++)
                {
                    if (iEnableWeek[j].Trim() == iDisableWeek[i])
                    {
                        iDisableWeek[i] = "";
                        break;
                    }
                }
            }
 
            for (int i = 0; i < iDisableWeek.Length; i++)
            {
                if (iDisableWeek[i] != "")
                {
                    // modify the cell rendered content for the days we want to be disabled (e.g. every Saturday and Sunday)
                    if (e.Day.Date.DayOfWeek == (DayOfWeek)Convert.ToInt32(iDisableWeek[i]))
                    {
                        // if you are using the skin bundled as a webresource("Default"), the Skin property returns empty string
                        string otherMonthCssClass = "ColorGray";
 
                        // clear the default cell content (anchor tag) as we need to disable the hover effect for this cell
                        e.Cell.Controls.Clear();
                        e.Cell.Text = "";
                        e.Cell.Enabled = false;
                        e.Cell.CssClass = otherMonthCssClass; //set new CssClass for the disabled calendar day cells (e.g. look like other month days here)
 
                        // render a span element with the processed calendar day number instead of the removed anchor -- necessary for the calendar skinning mechanism
                        Label label = new Label();
                        label.Text = e.Day.Date.Day.ToString();
                        e.Cell.Controls.Add(label);
 
                        // disable the selection for the specific day
                        RadCalendarDay calendarDay = new RadCalendarDay();
                        calendarDay.Date = e.Day.Date;
                        calendarDay.IsSelectable = false;
                        calendarDay.ItemStyle.CssClass = otherMonthCssClass;
                        rdpDay.Calendar.SpecialDays.Add(calendarDay);
                        break;
                    }
                }
            }
 
            string[] iBlockDays = myBlockDays.ToString().Split(',');
            for (int i = 0; i < iBlockDays.Length; i++)
            {
                if (iBlockDays[i].Trim() != "")
                {
                    if (e.Day.Date == Convert.ToDateTime(iBlockDays[i].Trim()))
                    {
                        // if you are using the skin bundled as a webresource("Default"), the Skin property returns empty string
                        string otherMonthCssClass = "ColorRed";
 
                        // clear the default cell content (anchor tag) as we need to disable the hover effect for this cell
                        e.Cell.Text = "";
                        e.Cell.CssClass = otherMonthCssClass; //set new CssClass for the disabled calendar day cells (e.g. look like other month days here)
 
                        // render a span element with the processed calendar day number instead of the removed anchor -- necessary for the calendar skinning mechanism
                        Label label = new Label();
                        label.Text = e.Day.Date.Day.ToString();
                        e.Cell.Controls.Add(label);
 
                        // disable the selection for the specific day
                        RadCalendarDay calendarDay = new RadCalendarDay();
                        calendarDay.Date = e.Day.Date;
                        calendarDay.IsSelectable = false;
                        calendarDay.ItemStyle.CssClass = otherMonthCssClass;
                        rdpDay.Calendar.SpecialDays.Add(calendarDay);
                        break;
                    }
                }
            }
        }
    }
Vasil
Telerik team
 answered on 07 Nov 2012
1 answer
88 views
Hi
I want to change the header color. I have used headerstyle backcolor. However it is not working for me. Can anybody tell me where I might have gone wrong. Or is there any other method by which i can change the header color
thanks
Princy
Top achievements
Rank 2
 answered on 07 Nov 2012
3 answers
93 views
Hi

I am using RadAsyncUpload control, with postbacktriggers to persist the uploaded file data temporarily. I would like to modify the filename of the uploaded file that is displayed to the User. So currently, I did the modification using "OnClientFileuploaded " event, and I am changing the Text in the html through javascript. 

But, the problem comes when some postback happens, my changes to the file name that are made through the "OnClientFileUploaded" event are reverted, and now user is shown with actual filename of the uploaded file.

How do I resolve this issue? I would like to have some event, when the RadAsyncontrol is trying to repopulate the persisted data after some postback. Is there any such event or some place where I can handle the display of filename.

Thanks
Sumanth
Peter Filipov
Telerik team
 answered on 07 Nov 2012
4 answers
149 views
Hi all,
I've found several threads regarding the usage of semi-colon ; within RadGrid Filter because normally it throws an "Index out of bounds" exception, see e.g.  http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-filter-showing-script-error-when-enter-semicolon-in-search.aspx , http://www.telerik.com/community/forums/aspnet-ajax/grid/filtering-grid-on-character-causes-error.aspx , http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-filter-expression-with-quot-quot-i-e-with-semicolon-is-throwing-index-was-outside-the-bounds-of-the-array.aspx .

The proposed solution is some JavaScript code preventing the input of semi-colon. But of course this does not help if a user (/ hacker?) turned off JavaScript. I'd like to avoid this exception regardless of JavaScript. I also wonder why this problem does not seem to appear on http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/filtering/defaultcs.aspx ....?

Is there any other solution?
Many thanks!
Kai
Top achievements
Rank 2
 answered on 07 Nov 2012
1 answer
138 views
In IE9 radeditor removes newline character(I would like to know the char value for VB.NET codebehind)
in content even contentfilter is set to 'none'.

When I save content from Firefox/Chrome it get saved with newline character but from IE9 it removes newlines and merges all content in single block.

I would like to know the newline character for replacement with Environment.Newline in content at content consuming end.
Any help would be highly appreciated!



Stanimir
Telerik team
 answered on 07 Nov 2012
1 answer
107 views
I need to hide the Subject textbox and label and make that field not required when using the Custom AdvancedForm User Control.
I have found examples of how to hide Subject Textbox when not using the AdvancedForm User Control by using OnFormCreated, which works well.  However, I cannot get OnFormCreated to work with the AdvancedForm User Control.  

Any Examples of how to do this?
Thanks
Plamen
Telerik team
 answered on 07 Nov 2012
2 answers
148 views
hi,
is there any way we can customize RadEditor to show more bullet styles like small alpha, roman, alpha with parenthesis e.t.c [which are available in Microsoft Word].

Please let me know ASAP. We would like to have something like below which end user should be able to do it. So is there anyway we get dropdown with list of all available OL or UL styles when we click on Numbered or circle bullet list in Radieditor menu [same as Microsoft Word 2010 bullet style?]

1. XXXXXXXXXXXXx
2. XXXXXXXXXXXXEEE
    a. RRRRRRRRRRRRR
    b. SSSSSSSSSSSSS
        i)  ccccccccccccc
        ii) dddddddddddd
            A)  12222222222222
            B)  12222222222222
                   

Thanks,
Aravind
Stanimir
Telerik team
 answered on 07 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?