Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
104 views
I have added a very basic combobox to a simple page. When it renders, it has an extra item on the right as if it is trying to render twice side-by-side. When I hover over the dropdown arrow, the arrow disappears. I have used several skins, but the behavior is the same. The functionality is correct, but it is unpleasant for the users.

Magdalena
Telerik team
 answered on 24 Oct 2014
1 answer
216 views
Hi,

I have a very specific scenario when AutoCompleteBox does not work properly.

<telerik:RadAutoCompleteBox ID="TextBoxAutoCompleteEmployerName" runat="server"  
    MaxResultCount="10" MinFilterLength="3" InputType="Text" AllowCustomEntry="True" >
   <TextSettings SelectionMode="Single" />
   <WebServiceSettings Method="GetEmployerByName" Path="Employer.ascx" />
</telerik:RadAutoCompleteBox>

Steps to reproduce:

1. Open a page with an AutoCompleteBox
2. Input a filter until this filter matches an item on your list (case sensitive here)
3. Click on this item
4. Perform any postback operation
5. Note both AutoCompleteBox Text and Entries are empty in the code behind (although AutoCompleteBox was filled on the page itself)

On step 3, if instead of clicking the list item, I press tab or enter key, then I have no problem.

This is a really big problem! 

Has anyone experienced this before?
What did you do?
Boyan Dimitrov
Telerik team
 answered on 24 Oct 2014
1 answer
88 views
Is there a method to determine the number of masked characters in a RadMaskedTextBox.Mask?  For example, if the mask is defined as "###-###-#### (US)" the number of masks is 10 (whereas the length of the mask would be 17).

I've looked at the MaskParts collection, but don't see a simple way of determining the number of masks (vs. literals).

Any help would be appreciated so I don't recreate the wheel!
Konstantin Dikov
Telerik team
 answered on 24 Oct 2014
6 answers
192 views
Hi,
I have a RadGrid that's bound to EntityDataSource. A few of the columns are bound to navigation properties of the bound entity. When I try to delete a record, it gives the following error:

Error: Sys.WebForms.PageRequestManagerServerErrorException: A property named 'Vehicle.VehicleNo' was not found on the entity during an insert, update, or delete operation. Check to ensure that properties specified as binding expressions are available to the data source.

I know if I choose to use the plain foreign key IDs, instead of the navigation properties, everything works. I can easily get the delete to work if I handle it manually. But I"m just thinking there's got to be a way for the automatic delete to work too. Please advise.

<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True"
                        AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
                        DataSourceID="EntityDataSource1" GridLines="None" ShowGroupPanel="True" Skin="Hay"
                        OnItemUpdated="RadGrid1_ItemUpdated"
                        OnItemInserted="RadGrid1_ItemInserted" OnItemCommand="RadGrid1_ItemCommand"
                        Height="400px" Width="700px" CellSpacing="0">
                        <MasterTableView DataKeyNames="ADChecklistId" DataSourceID="EntityDataSource1" CommandItemDisplay="Top">
                            <CommandItemSettings AddNewRecordText="Add New Aerial Device Checklist" ShowRefreshButton="false"
                                ShowAddNewRecordButton="true"></CommandItemSettings>
                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                <HeaderStyle Width="20px" />
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                <HeaderStyle Width="20px" />
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"
                                    HeaderText="Edit">
                                </telerik:GridEditCommandColumn>
                                <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" UniqueName="DeleteCommandColumn" HeaderText="Delete" ConfirmDialogType="RadWindow" ConfirmText="Are you sure you want to delete this record?">
                                </telerik:GridButtonColumn>
                                <telerik:GridBoundColumn DataField="Vehicle.VehicleNo" FilterControlAltText="Filter VehicleNo column"
                                    HeaderText="VehicleNo" SortExpression="Vehicle.VehicleNo" UniqueName="Vehicle.VehicleNo">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Employee.FirstName" FilterControlAltText="Filter FirstName column"
                                    HeaderText="FirstName" SortExpression="Employee.FirstName" UniqueName="Employee.FirstName">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Employee.LastName" FilterControlAltText="Filter LastName column"
                                    HeaderText="LastName" SortExpression="Employee.LastName" UniqueName="Employee.LastName">
                                </telerik:GridBoundColumn
                                <telerik:GridBoundColumn DataField="Utility.UtilityName" HeaderText="Utility" SortExpression="Utility.UtilityName" UniqueName="Utility.UtilityName" >
                                </telerik:GridBoundColumn>                               
                                <telerik:GridDateTimeColumn DataField="CreatedOn" DataType="System.DateTime" FilterControlAltText="Filter CreatedOn column"
                                    HeaderText="CreatedOn" SortExpression="CreatedOn" UniqueName="CreatedOn" DataFormatString="{0:MM/dd/yy}">
                                </telerik:GridDateTimeColumn>
                                <telerik:GridBoundColumn DataField="CreatedBy" FilterControlAltText="Filter CreatedBy column"
                                    HeaderText="CreatedBy" SortExpression="CreatedBy" UniqueName="CreatedBy">
                                </telerik:GridBoundColumn>
                                <telerik:GridDateTimeColumn DataField="ModifiedOn" DataType="System.DateTime" FilterControlAltText="Filter ModifiedOn column"
                                    HeaderText="ModifiedOn" SortExpression="ModifiedOn" UniqueName="ModifiedOn" DataFormatString="{0:MM/dd/yy}">
                                </telerik:GridDateTimeColumn>
                                <telerik:GridBoundColumn DataField="ModifiedBy" FilterControlAltText="Filter ModifiedBy column"
                                    HeaderText="ModifiedBy" SortExpression="ModifiedBy" UniqueName="ModifiedBy">
                                </telerik:GridBoundColumn>
                            </Columns>
                            <EditFormSettings>
                                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                </EditColumn>
                            </EditFormSettings>
                        </MasterTableView>
                        <ClientSettings AllowDragToGroup="True" EnablePostBackOnRowClick="true">
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                            <Resizing AllowColumnResize="true" ClipCellContentOnResize="false" />
                        </ClientSettings>
                        <FilterMenu EnableImageSprites="False">
                        </FilterMenu>
                        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                        </HeaderContextMenu>
                    </telerik:RadGrid>
<asp:EntityDataSource ID="EntityDataSource1" runat="server" AutoGenerateWhereClause="True"
       ConnectionString="name=MSOpsEntities" DefaultContainerName="MSOpsEntities"
       EnableFlattening="False" EnableDelete="True" EntitySetName="ADChecklists"
       Include="Vehicle, Employee, Utility" OrderBy="it.CreatedOn DESC"
       OnSelecting="EntityDataSource1_Selecting"
       ondeleting="EntityDataSource1_Deleting">
       <WhereParameters>
           <asp:SessionParameter Name="UtilityId" SessionField="utilityId" Type="Int32" />
       </WhereParameters>
   </asp:EntityDataSource>

Kostadin
Telerik team
 answered on 24 Oct 2014
3 answers
90 views
I've started using more of the ASP.Net's built-in Profiles to store presistent user information and as a way to reduce the number of SQL calls needed to retrieve various peices of user information.

When I had the information stored in a SQL table, it was easy to load this into a grid.

How can I retrieve the profile information and populate a grid?

Thanks,
Joe
Kostadin
Telerik team
 answered on 24 Oct 2014
1 answer
80 views
Hi all,
I've this situation:

    <telerik:RadTextBox ID="txtTest" runat="server" Enabled="false" />
    <telerik:RadTextBox ID="RadTextBox1" runat="server" Enabled="true" />

    <telerik:RadContextMenu ID="cmTest" runat="server">
        <Targets>
            <telerik:ContextMenuControlTarget ControlID="txtTest" />
            <telerik:ContextMenuControlTarget ControlID="RadTextBox1" />
        </Targets>
        <Items>
            <telerik:RadMenuItem AccessKey="1" Text="Delete" />
            <telerik:RadMenuItem AccessKey="2" Text="Change Background Color" />
            <telerik:RadMenuItem AccessKey="2" Text="Change ForeColor" />
        </Items>
    </telerik:RadContextMenu>

how can I force to show contextmenu on the disabled radTextBox txtTest??
Thanks in advance
Peter Filipov
Telerik team
 answered on 24 Oct 2014
4 answers
719 views
Hello,

I'm looking for help on exporting data from a RadGrid to a PDF file, via the ExportToPDF control button.  I've read a handful of threads on this, but none are working.  I'm trying to get the cell alignment to be correct for text (left-aligned) and numeric values (right-aligned).  Part of my difficulty is the fact the visible columns is dynamic, so I don't have a unique name to look for.  This also causes a possible issue with too many columns to fit onto the page without manually formatting the output.

Because I cannot effect the client's experience (the UI layout), I've moved my code from the 'ItemCommand' event to the 'ItemCreated' event.  This allows me to get all the column to fit on the page, but I'm still having issues with setting the text cell alignment left and the numeric alignment right.  I'm able to set them all to either: left, right, center, none.  Another issue I have, is that by doing this in the ItemCreated event, there's no data to determine what type of text is going to be in the cell.
protected void RadGrid_AssetList_ItemCreated( object sender, GridItemEventArgs e )
{
 if(IsExportButtonClicked){
  FormatPdfOutput(RadGrid_AssetList);
 
  var item = e.Item as GridDataItem;
 
  if(item != null){
   var dataItem = item;
 
   foreach(TableCell cell in dataItem.Cells){
    cell.Style["text-align"] = "center";
   }
  }
  else{
   var gridHeaderItem = e.Item as GridHeaderItem;
 
   if(gridHeaderItem != null){
    var headerItem = gridHeaderItem;
 
    foreach(TableCell cell in headerItem.Cells){
     cell.Style["text-align"] = "center";
    }
   }
   else{
    var gridFooterItem = e.Item as GridFooterItem;
 
    if(gridFooterItem != null){
     var footerItem = gridFooterItem;
 
     foreach(TableCell cell in footerItem.Cells){
      cell.Style["text-align"] = "center";
     }
    }
   }
  }
 }
}


private void FormatPdfOutput(RadGrid radGrid){
 radGrid.ExportSettings.IgnorePaging = true;
 radGrid.ExportSettings.ExportOnlyData = true;
 radGrid.ExportSettings.HideStructureColumns = true;
 
 double marginWidth = radGrid.ExportSettings.Pdf.PageLeftMargin.Value
               + radGrid.ExportSettings.Pdf.PageRightMargin.Value;
 
 double printArea = radGrid.ExportSettings.Pdf.PageWidth.Value - marginWidth;
 
 //if the print area of the page is smaller than the RadGrid width (total column width), change to
 //percent based widths and evenly break up the columns.
 if(printArea < radGrid.Width.Value){
  //count the number of columns that are both visible and have header text.
  var visibleColumnCount = radGrid.Columns.Cast<GridColumn>().Count(column => column.Visible);
 
  //calculate the percentage to evenly display all the columns
  var tempWidth = 1.0 / (double)visibleColumnCount;
 
  foreach(GridColumn column in radGrid.Columns){
   if(column.Visible){
    column.Visible = column.HeaderText.Length > 0;
   }
 
   column.HeaderStyle.Width = column.Visible
                      ? Unit.Percentage(tempWidth)
                      : Unit.Percentage(0);
 
   column.HeaderStyle.Wrap = true;
 
  if(column.Visible){
   column.HeaderStyle.HorizontalAlign = column as GridNumericColumn == null
                              ? HorizontalAlign.Left
                              : HorizontalAlign.Right;           
   }
  }
 }
}
Randel
Top achievements
Rank 1
 answered on 24 Oct 2014
3 answers
140 views
Hello,

I've noticed that some of your controls (like Scheduler) has gotten client side binding options via WebApi.

Does the Gantt controller also have this?
Will it get it in the near future?

Best regards
Aleksander Spro
Xledger - Senior Developer 
Bozhidar
Telerik team
 answered on 24 Oct 2014
4 answers
339 views
Hello all. I'm attempting to call focus for a radeditor control during the that's contained within a radwindow popup during the page load event. The focus() call works correctly for IE & Firefox, but in Safari & Chrome, it doesn't, requiring our users to click within the content area before they can start typing. Is there a way to correct this?
Ianko
Telerik team
 answered on 24 Oct 2014
4 answers
157 views
Hi,

I have a RadGrid that contains info about our system profiles, below, a panel with some textboxs and dropdownlists, and another panel with a RadtreeView  with the menu pages available in our system. At the begin, this controls are empty and the TreeView contains all the menu pages available (from the database, with a WebMethod), no one checked. When I select one row in the RadGrid, it update the radcontrols (textboxs and dropdownlists) with the same info and the RadTreeView on the left, with the same menu but checked the nodes marking the pages that the profile can access (another WebMethod, from another table from database, related to the main Menu Table with Profiles).
I was able to update controls and check only the nodes which correspond to profile while the others are unchecked, but the problem is that the Treeview don't work anymore, not expand, not collapse, not check or uncheck, sometimes work once and then freezes again. Similarly happens when I change the page of the RadGrid without selecting any row, the original Treeview with the complete menu don't work, I can't do any action.
Is only part of the functionality I'm looking for, specifically to update the info of the profile from the controls and the Treeview, but for that, I need that the Treview must be enabled to check other nodes or uncheck the already checked, or expand to see the childnodes (the Treeview is in TriStateCheckBoxes = true).
Can be this a problem with the update panel? please, I need to solve this problem or another method to do this

this is my code:
ASPX:
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">   
    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="fieldset">
    </telerik:RadFormDecorator>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rtvPagsPerfil">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rtvPagsPerfil" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <table style="width: 100%">
        <tr>
            <td align="left" class="Subtitulo">
                <asp:Label ID="lblAdmPerfiles" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <telerik:RadAjaxPanel ID="pnlRadGridPerfil" runat="server" BorderColor="#CCCCFF" BorderStyle="Groove"
                    BorderWidth="2px" Width="100%">
                    <telerik:RadGrid ID="RadGridPerfiles" runat="server" AllowPaging="true" AllowSorting="false"
                        OnNeedDataSource="RadGridPerfiles_NeedDataSource" OnItemDataBound="RadGridPerfiles_ItemDataBound"
                        OnItemCommand="RadGridPerfiles_ItemCommand" OnPageIndexChanged="RadGridPerfiles_PageIndexChanged"
                        ShowStatusBar="true" CssClass="SubtituloSinFondo" SortingSettings-SortedAscToolTip="Ordenado Ascendente"
                        SortingSettings-SortedDescToolTip="Ordenado Descendente" SortingSettings-SortToolTip="Clic para ordenar"
                        StatusBarSettings-LoadingText="Cargando..." StatusBarSettings-ReadyText="Listo"
                        PageSize="5">
                        <HeaderStyle HorizontalAlign="Center" Font-Size="11px" ForeColor="#5D7B9D" Font-Bold="true" />
                        <ItemStyle HorizontalAlign="Center" Font-Names="Arial" Font-Size="10px" />
                        <AlternatingItemStyle HorizontalAlign="Center" Font-Names="Arial" Font-Size="10px" />
                        <PagerStyle PageSizeLabelText="Registros" ChangePageSizeButtonToolTip="Cambiar Número de Registros"
                            GoToPageButtonToolTip="Ir A" Mode="NextPrev" FirstPageToolTip="Primera Página"
                            LastPageToolTip="Última Página" NextPagesToolTip="Páginas Siguientes" NextPageToolTip="Página Siguiente"
                            PrevPagesToolTip="Páginas Anteriores" PrevPageToolTip="Página Anterior" PagerTextFormat="Cambiar Página: {4} &nbsp;Pág. <strong>{0}</strong> de <strong>{1}</strong>, items <strong>{2}</strong> a <strong>{3}</strong> de <strong>{5}</strong>."
                            PageButtonCount="5" />
                        <MasterTableView NoMasterRecordsText="No existen registros para mostrar" DataKeyNames="ID Perfil">
                        </MasterTableView>
                        <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
                            <Selecting AllowRowSelect="true" />
                        </ClientSettings>
                        <StatusBarSettings LoadingText="Cargando..." ReadyText="Listo" />
                    </telerik:RadGrid>
                </telerik:RadAjaxPanel>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%">
                    <tr>
                        <td align="left" style="width: 50%">
                            <div style="float: left; width: 100%" id="DivDescPerfil" runat="server">
                                <fieldset id="FieldSetDescPerfil" style="width: 100%; height: 400px">
                                    <legend class="TituloPanelAgrupacion">Descripción Perfil</legend>
                                    <asp:UpdatePanel ID="upDescripcionPerfil" runat="server">
                                        <ContentTemplate>
                                            <table width="100%">
                                                <tr>
                                                    <td>
                                                        <telerik:RadAjaxPanel ID="pnlDescripcionPerfil" runat="server" Width="100%">
                                                            <table class="SubtituloSinFondo4">
                                                                <tr>
                                                                    <td>
                                                                        &nbsp;
                                                                    </td>
                                                                    <td>
                                                                        &nbsp;
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <label for="lblIdPerfil">
                                                                            ID:
                                                                        </label>
                                                                    </td>
                                                                    <td height="30">
                                                                        <asp:Label ID="lblIdPerfil" Style="float: left; font-weight: bold; color: Black;"
                                                                            runat="server"></asp:Label>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <label for="tbNombrePerfil">
                                                                            Nombre:
                                                                        </label>
                                                                    </td>
                                                                    <td>
                                                                        <telerik:RadTextBox ID="tbNombrePerfil" runat="server" Width="400px" MaxLength="50">
                                                                        </telerik:RadTextBox>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <label for="tbDescripcionPerfil">
                                                                            Descripción:
                                                                        </label>
                                                                    </td>
                                                                    <td>
                                                                        <telerik:RadTextBox ID="tbDescripcionPerfil" runat="server" Width="400px" Height="40px"
                                                                            TextMode="MultiLine" MaxLength="100">
                                                                        </telerik:RadTextBox>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <label for="ddlEmpresaPerfil">
                                                                            Empresa:
                                                                        </label>
                                                                    </td>
                                                                    <td>
                                                                        <telerik:RadDropDownList ID="ddlEmpresaPerfil" runat="server">
                                                                            <Items>
                                                                                <telerik:DropDownListItem Text="BW" Value="BW" />
                                                                                <telerik:DropDownListItem Text="Otro" Value="Otro" />
                                                                            </Items>
                                                                        </telerik:RadDropDownList>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <label for="ddlEstadoPerfil">
                                                                            Estado:
                                                                        </label>
                                                                    </td>
                                                                    <td>
                                                                        <telerik:RadDropDownList ID="ddlEstadoPerfil" runat="server">
                                                                        </telerik:RadDropDownList>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td>
                                                                        <label for="ddlVerificacionPerfil">
                                                                            Tipo Verificación:</label>
                                                                    </td>
                                                                    <td>
                                                                        <telerik:RadDropDownList ID="ddlVerificacionPerfil" runat="server">
                                                                        </telerik:RadDropDownList>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </telerik:RadAjaxPanel>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                </fieldset>
                            </div>
                        </td>
                        <td align="left" style="width: 50%">
                            <div style="float: left; width: 100%" id="DivPagsPerfil" runat="server">
                                <fieldset id="FieldSetPagsPefil" style="width: 100%; height: 400px">
                                    <legend class="TituloPanelAgrupacion">Asignación de Pantallas</legend>
                                    <asp:UpdatePanel ID="upMenuPerfil" runat="server">
                                        <ContentTemplate>
                                            <telerik:RadAjaxPanel ID="pnlPagsPerfil" runat="server" Width="100%">
                                                <telerik:RadTreeView ID="rtvPagsPerfil" runat="server" CheckBoxes="true" TriStateCheckBoxes="true"
                                                    CheckChildNodes="true" Height="375px" BorderColor="#CCCCFF" BorderStyle="Groove"
                                                    BorderWidth="2px" Font-Size="X-Small" Font-Names="Verdana, Arial, Helvetica, sans-serif"
                                                    OnNodeExpand="rtvPagsPerfil_NodeExpand">
                                                    <DataBindings>
                                                        <telerik:RadTreeNodeBinding Expanded="false" />
                                                    </DataBindings>
                                                </telerik:RadTreeView>
                                            </telerik:RadAjaxPanel>
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                </fieldset>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <telerik:RadButton ID="btnAceptar" runat="server" Text="Aceptar">
                </telerik:RadButton>
                <telerik:RadButton ID="btnModificar" runat="server" Text="Modificar">
                </telerik:RadButton>
                <telerik:RadButton ID="btnEliminar" runat="server" Text="Eliminar">
                </telerik:RadButton>
            </td>
        </tr>
        <tr>
            <td>
                <telerik:RadInputManager ID="RadInputManager1" runat="server">
                    <telerik:TextBoxSetting BehaviorID="tbBehavior1" EmptyMessage="Ingrese aquí" Validation-IsRequired="true">
                        <TargetControls>
                            <telerik:TargetInput ControlID="DivDescPerfil" />
                        </TargetControls>
                    </telerik:TextBoxSetting>
                </telerik:RadInputManager>
            </td>
        </tr>
    </table>
</asp:Content>

CS:
    public void RadGridPerfiles_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        Label masterError = (Label)Master.FindControl("lblError");
        Label masterExito = (Label)Master.FindControl("lblExito");
        int codError = 0;
        string descError = string.Empty;
        DataTable dtPerfiles = new DataTable("Perfiles");
        dtPerfiles = wsBDD.ObtenerPerfil(ref codError, ref descError);

        if (codError != 0 && descError != string.Empty)
        {
            Session[ValoresDefinidosSYS.VarSession.mensajeError] = ManejoErrores.mensajesErrorPerfiles.mensajeErrorObtencionPerfiles
                + codError + ManejoErrores.separadorError + descError;
            Response.Redirect(ValoresDefinidosSYS.Pantallas.ERROR, false);
        }
        else
            if (dtPerfiles.Rows.Count > 0)
                RadGridPerfiles.DataSource = dtPerfiles;
            else
            {
                masterExito.Text = string.Empty;
                masterError.Text = ManejoErrores.mensajesErrorReportesOrganismos.sinCoincidencia;
            }
    }

    public void RadGridPerfiles_ItemDataBound(object sender, GridItemEventArgs e)
    {
        int codError = 0;
        string descError = string.Empty;
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            //NOMBRE DE LA EMPRESA EN VEZ DEL ID
            if (item["Empresa"].Text != string.Empty)
            {
                try
                {
                    string strIdEmpresa = item["Empresa"].Text;
                    string strNombre = wsBDD.ObtenerNombreEmpresa(strIdEmpresa, ref codError, ref descError);
                    item["Empresa"].Text = strNombre;
                }
                catch
                {
                    item["Empresa"].ForeColor = System.Drawing.Color.Red;
                    item["Empresa"].Text = ValoresDefinidosSYS.Items.NoParametrizado;
                }
            }
            else
                item["Empresa"].Text = ValoresDefinidosSYS.Items.NoParametrizado;

            //TIPO DE VERIFICACION
            if (item["Perfil Verificación"].Text == ValoresDefinidosSYS.Items.NonBreakingSpace)
                item["Perfil Verificación"].Text = ValoresDefinidosSYS.Items.NoAplica;
        }
    }

    public void RadGridPerfiles_ItemCommand(object sender, GridCommandEventArgs e)
    {
        string descError = string.Empty;
        int codError = 0;
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)RadGridPerfiles.SelectedItems[0];

            //ID de perfil seleccionado. Proviene de DataKeyNames de grid de presentacion
            string idPerfil = RadGridPerfiles.SelectedValue.ToString();
            lblIdPerfil.Text = idPerfil;

            tbNombrePerfil.Text = item["Nombre Perfil"].Text;
            tbDescripcionPerfil.Text = item["Descripción"].Text;

            ddlEmpresaPerfil.ClearSelection();
            ddlEmpresaPerfil.FindItemByText(item["Empresa"].Text).Selected = true;

            ddlEstadoPerfil.ClearSelection();
            ddlEstadoPerfil.FindItemByText(item["Estado"].Text).Selected = true;

            ddlVerificacionPerfil.ClearSelection();
            ddlVerificacionPerfil.FindItemByText(item["Perfil Verificación"].Text).Selected = true;

            rtvPagsPerfil.Nodes.Clear();
            DataTable dtMenuPorPerfil = wsBDD.MenuPorPerfil(idPerfil, ref codError, ref descError);
            CargarMenuPreSeleccion(dtMenuPorPerfil);
        }
    }

    public void RadGridPerfiles_PageIndexChanged(object sender, GridPageChangedEventArgs e)
    {
        lblIdPerfil.Text = string.Empty;
        lblIdPerfil.Dispose();
        tbNombrePerfil.Text = string.Empty;
        tbNombrePerfil.Dispose();
        tbDescripcionPerfil.Text = string.Empty;
        tbDescripcionPerfil.Dispose();
        ddlEmpresaPerfil.ClearSelection();
        ddlEstadoPerfil.ClearSelection();
        ddlVerificacionPerfil.ClearSelection();
        CargarControles();

        //rtvPagsPerfil.Nodes.Clear();
        //CargarMenu();
    }

    public void CargarMenu()
    {
        string descErrorMenu = string.Empty;
        int codErrorMenu = 0;
        //llenar TreeView con las paginas disponibles del menú
        DataSet dsMenu = wsBDD.ObtenerMenu(ref codErrorMenu, ref descErrorMenu);
        DataTable dtMenu = new DataTable();
        dtMenu = dsMenu.Tables[0];
        rtvPagsPerfil.DataSource = dtMenu;
        rtvPagsPerfil.DataFieldID = dtMenu.Columns[0].Caption; //"Id_Menu";
        rtvPagsPerfil.DataFieldParentID = dtMenu.Columns[2].Caption; //"Id_Menu_Padre";
        rtvPagsPerfil.DataTextField = dtMenu.Columns[1].Caption; //"Nombre_Menu";
        rtvPagsPerfil.DataValueField = dtMenu.Columns[0].Caption; //"Id_Menu"; //"URL_Menu";
        rtvPagsPerfil.DataBind();
    }

    public void CargarMenuPreSeleccion(DataTable dtMenuPorPerfil)
    {
        string descErrorMenu = string.Empty;
        int codErrorMenu = 0;
        //llenar TreeView con las paginas disponibles del menú
        DataSet dsMenu = wsBDD.ObtenerMenu(ref codErrorMenu, ref descErrorMenu);
        DataTable dtMenu = new DataTable();
        dtMenu = dsMenu.Tables[0];

        //borro todos los nodos del RadTreeView
        //rtvPagsPerfil.Nodes.Clear();

        rtvPagsPerfil.Visible = true;
        rtvPagsPerfil.DataSource = dtMenu;
        rtvPagsPerfil.DataFieldID = dtMenu.Columns[0].Caption; //"Id_Menu";
        rtvPagsPerfil.DataFieldParentID = dtMenu.Columns[2].Caption; //"Id_Menu_Padre";
        rtvPagsPerfil.DataTextField = dtMenu.Columns[1].Caption; //"Nombre_Menu";
        rtvPagsPerfil.DataValueField = dtMenu.Columns[0].Caption; //"Id_Menu"; //"URL_Menu";
        rtvPagsPerfil.DataBind();

        ///////----works too
        ////foreach (DataRow dr in dtMenuPorPerfil.AsEnumerable())
        ////{
        ////    string rtvValue = dr[1].ToString();
        ////    RadTreeNode rtnSeleccionado = rtvPagsPerfil.FindNodeByValue(rtvValue);
        ////    if (rtnSeleccionado != null)
        ////    {
        ////        rtnSeleccionado.Checked = true;
        ////    }
        ////}
        
        IList<RadTreeNode> nodeCollection = rtvPagsPerfil.GetAllNodes();//.CheckedNodes;
        foreach (RadTreeNode node in nodeCollection)
        {
            foreach (DataRow dr in dtMenuPorPerfil.AsEnumerable())
            {
                string rtvValue = dr[1].ToString();
                if (node.Value.ToString() == rtvValue)
                {
                    node.Checked = true;
                }
            }
        }
    }

    public void CargarControles()
    {
        string descError = string.Empty;
        int codError = 0;

        //////dropdownlist con empresas
        ////if (Session["licenciaEncriptada"] != null)
        ////{
        ////    string licenciaEncriptada = Session["licenciaEncriptada"].ToString();
        ////    string licenciaAdministrador = wsBDD.ObtenerLicenciaAdministrador(licenciaEncriptada, ref codError, ref descError);
        ////    DataSet dsEmpresas = wsBDD.ObtenerEmpresas((bool)Session["banderaSuperAdmin"], licenciaAdministrador, ref codError, ref descError);
        ////    //foreach (var item in dsEmpresas.Tables[0].AsEnumerable())
        ////    //{
        ////    //    ListItem itemList = new ListItem(item.Field<string>("Nombre_Empresa"), item.Field<string>("Lic_Empresa"));
        ////    //    ddlEmpresaPerfil.DataSource = itemList;
        ////    //    ddlEmpresaPerfil.DataBind();
        ////    //}

        ////    ddlEmpresaPerfil.DataSource = dsEmpresas.Tables[0];
        ////    ddlEmpresaPerfil.DataBind();
        ////}

        //dropdownlist con tipos de Estado
        string[] estado = wsBDD.ObtenerTipoEstado(ref codError, ref descError);
        ddlEstadoPerfil.DataSource = estado;
        ddlEstadoPerfil.DataBind();

        //dropdownlist con tipo de verificación
        string[] tipoVerif = wsBDD.ObtenerTipoVerificacion(ref codError, ref descError);
        ddlVerificacionPerfil.DataSource = tipoVerif;
        ddlVerificacionPerfil.DataBind();
    }

Thanks in advance
Jorge Gómez
Jorge
Top achievements
Rank 1
 answered on 23 Oct 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?