Hello! I'm starting to use this component and I have some doubts. I have on my page the following controls:
RadScriptManager1
RadAjaxManager1
RadAjaxLoadingPanel1
RadTabStrip1 // Filters for the query
RadMultiPage11
- RadComboBox111, RadComboBox112 and RadComboBox113.
RadMultiPage12
- RadTextBox121, RadDatePicker122 and RadButton.
RadTabStrip2 // Query values from dataTable
RadMultiPage21
- RadHtmlChart211
RadMultiPage22
- RadGrid221
------------------------------------------------------
Events:
1. Select filters;
2. I press the radButton;
3. Make the query;
4. I carry the dataTable;
5. Link the dataTable to the radGrid and radHtmlChart.
Problem:
The radGrid not showing values. Only when I group a column or orderer a column alphabetically, the values appear. Are missing some event handler? This is the right way?
Thanks!
RadScriptManager1
RadAjaxManager1
RadAjaxLoadingPanel1
RadTabStrip1 // Filters for the query
RadMultiPage11
- RadComboBox111, RadComboBox112 and RadComboBox113.
RadMultiPage12
- RadTextBox121, RadDatePicker122 and RadButton.
RadTabStrip2 // Query values from dataTable
RadMultiPage21
- RadHtmlChart211
RadMultiPage22
- RadGrid221
------------------------------------------------------
Events:
1. Select filters;
2. I press the radButton;
3. Make the query;
4. I carry the dataTable;
5. Link the dataTable to the radGrid and radHtmlChart.
Problem:
The radGrid not showing values. Only when I group a column or orderer a column alphabetically, the values appear. Are missing some event handler? This is the right way?
Thanks!
3 Answers, 1 is accepted
0
Hi Luis,
As the provided information is not enough to isolate the root cause of the issue could you please share your page markup as well as the related code behind. thus we will be able to revise your code and do our best to provide a proper solution.
Greetings,
Maria Ilieva
the Telerik team
As the provided information is not enough to isolate the root cause of the issue could you please share your page markup as well as the related code behind. thus we will be able to revise your code and do our best to provide a proper solution.
Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Luis
Top achievements
Rank 1
answered on 13 Aug 2012, 04:42 PM
ok, the code follows:
aspx
cs
Thanks.
aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TesteComponente.aspx.cs" Inherits="TesteComponente" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><!DOCTYPE html><html lang="pt-BR"><head id="HeadDefaul" runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta name="description" content="Portal Único" /> <meta name="keywords" content="Portal Único" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title>Portal Único</title> <link href="css/formularios.css" rel="stylesheet" type="text/css" /> <link href="css/tipografia.css" rel="stylesheet" type="text/css" /> <link href="css/tela.css" rel="stylesheet" type="text/css" /> <style type="text/css"> span.text { float: left; font: 13px 'Segoe UI' , Arial, sans-serif; color: #4888a2; display: block; width: 150px; padding: 2px 20px 0 0; } .module1 { border: 1px solid #666; } .perfil { float: left; display: block; padding: 0; margin: 0; width: 300px; height: 30px; color: #333; } .radTabPvBorderTable { border-left: solid 1px #c5c5c5; border-bottom: solid 1px #c5c5c5; border-right: solid 1px #c5c5c5; } .multiPage { float: left; border: 1px solid #94A7B5; background-color: #F0F1EB; padding: 4px; padding-left: 0; min-width: 500px; margin-left: -1px; } .multiPage div { border: 1px solid #94A7B5; border-left: 0; } </style></head><body> <form id="Form1" runat="server" class="totalHeight"> <telerik:RadScriptManager ID="ScriptManager1" runat="server" /> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="Panel1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" /> <telerik:AjaxUpdatedControl ControlID="radGrid" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /> <div id="all"> <div id="content"> <div id="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="width: 99%;"> <div class="infoLeft"> </div> </td> <td style="width: 1%;" nowrap="nowrap"> <div class="infoRight"> <asp:Label ID="lblUsuario" runat="server" /></div> </td> </tr> </table> </div> <div id="main"> <div class="content"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="top" style="width: 222px;"> <div id="left"> <div class="logo"> <img src="images/logo.jpg" alt="" /></div> <div class="spaceLeft"> </div> <div class="menuV"> <telerik:RadMenu ID="RadMenu1" runat="server" Flow="Vertical" Style="z-index: 1000" EnableRoundedCorners="true" EnableShadows="true"> </telerik:RadMenu> </div> </div> </td> <td> <div id="right"> <div> <div class="mainText"> <fieldset class="module1"> <asp:Panel ID="Panel1" runat="server"> <div> <h5> <strong>::Relatório Operacional</strong></h5> </div> <div id="divMsgErro" runat="server"> <div class="messageError"> <asp:Label ID="lblMsgErro" runat="server" /> </div> </div> <div id="divMsgOk" runat="server"> <div class="messageOk"> <asp:Label ID="lblMsgOk" runat="server" /> </div> </div> <div id="divInfo" runat="server"> <div class="messageInfo"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="5"> <h5> Instruções: </h5> </td> <td rowspan="2" align="right" valign="top"> <img src="images/alert.gif"> </td> </tr> <tr> <td colspan="5"> Para gerar os dados, informe corretamente os campos existentes nas abas: <ul> <li>Tipo de Relatório</li> <li>Lotes</li> <li>Filtros</li> </ul> </td> </tr> </table> </div> </div> <div> </div> <div> <telerik:RadTabStrip ID="radTabParametros" runat="server" MultiPageID="radMultiPageParametros" SelectedIndex="0"> <Tabs> <telerik:RadTab runat="server" Text=":: Tipo de Relatório" PageViewID="radPvTpRelatorio" Selected="True"> </telerik:RadTab> <telerik:RadTab runat="server" Text=":: Lotes" PageViewID="radPvLotes"> </telerik:RadTab> <telerik:RadTab runat="server" Text=":: Filtros" PageViewID="radPvFiltros"> </telerik:RadTab> </Tabs> </telerik:RadTabStrip> <telerik:RadMultiPage ID="radMultiPageParametros" runat="server" SelectedIndex="0"> <telerik:RadPageView ID="radPvTpRelatorio" runat="server" Width="100%"> <table width="100%" border="0" cellspacing="0" cellpadding="10" class="radTabPvBorderTable"> <tr> <td style="width: 1%;"> Tipo: </td> <td> <telerik:RadComboBox ID="ddlTipoRel" TabIndex="4" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlTipoRel_SelectedIndexChanged"> </telerik:RadComboBox> <asp:CustomValidator ID="cvlDdlTipoRel" runat="server" ErrorMessage="" ControlToValidate="ddlTipoRel" Display="None" ValidateEmptyText="true" OnServerValidate="Page_ServerValidate" /> </td> </tr> </table> </telerik:RadPageView> <telerik:RadPageView ID="radPvLotes" runat="server" Width="100%"> <table width="100%" border="0" cellspacing="0" cellpadding="10" class="radTabPvBorderTable"> <tr> <td> <table width="100%" border="0" cellspacing="10" cellpadding="0"> <tr> <td> Selecione o(s) lote(s) ativos: </td> <td align="right"> Listar todos? <asp:CheckBox ID="chkTodosLotes" runat="server" Text="Sim" OnCheckedChanged="chkTodosLotes_CheckedChanged" AutoPostBack="true" /> </td> </tr> </table> </td> </tr> <tr> <td align="center"> <table width="10%" border="0" cellspacing="3" cellpadding="0"> <tr> <td align="center"> Disponíveis: </td> <td> </td> <td align="center"> Selecionados: </td> </tr> <tr> <td> <asp:ListBox CssClass="listbox" ID="lstLotes" runat="server" SelectionMode="Multiple"> </asp:ListBox> </td> <td align="center"> <asp:ImageButton ID="btnAdd" runat="server" ImageUrl="images/btn_list_add.png" Width="22" OnClick="btnAdd_Click" /> <asp:ImageButton ID="btnRemove" runat="server" ImageUrl="images/btn_list_remove.png" Width="22" OnClick="btnRemove_Click" /> </td> <td> <asp:ListBox CssClass="listbox" ID="lstLotesSelecionados" runat="server" SelectionMode="Multiple"> </asp:ListBox> <asp:CustomValidator ID="cvlLstLotesSelecionados" runat="server" ErrorMessage="" ControlToValidate="lstLotesSelecionados" Display="None" ValidateEmptyText="true" OnServerValidate="Page_ServerValidate" /> </td> </tr> <tr> <td align="center"> <telerik:RadButton ID="btnAddAll" runat="server" Text="Adicionar todos" OnClick="btnAddAll_Click" /> </td> <td> </td> <td align="center"> <telerik:RadButton ID="btnRemoveAll" runat="server" Text="Remover todos" OnClick="btnRemoveAll_Click" /> </td> </tr> </table> </td> </tr> </table> </telerik:RadPageView> <telerik:RadPageView ID="radPvFiltros" runat="server" Width="100%"> <table width="100%" border="0" cellspacing="0" cellpadding="10" class="radTabPvBorderTable"> <tr> <td> <div id="divUcDe" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> De:</p> </td> <td> <telerik:RadDatePicker ID="txtDatDe" runat="server" TabIndex="5" ShowPopupOnFocus="true"> </telerik:RadDatePicker> </td> </tr> </table> </div> <div id="divUcAte" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Até:</p> </td> <td> <telerik:RadDatePicker ID="txtDatAte" runat="server" TabIndex="6" ShowPopupOnFocus="true"> </telerik:RadDatePicker> </td> </tr> </table> </div> <div id="divUcCategoria" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Categoria:</p> </td> <td> <telerik:RadComboBox ID="ddlCategoria" runat="server" TabIndex="7"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcEstado" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Estado:</p> </td> <td> <telerik:RadComboBox ID="ddlEstado" runat="server" TabIndex="10" OnSelectedIndexChanged="ddlEstado_SelectedIndexChanged" AutoPostBack="true"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcCidade" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Cidade:</p> </td> <td> <telerik:RadComboBox ID="ddlCidade" runat="server" TabIndex="14"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcRegiao" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Região:</p> </td> <td> <telerik:RadComboBox ID="ddlRegiao" runat="server" TabIndex="13"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcOperador" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Operador:</p> </td> <td> <telerik:RadComboBox ID="ddlOperador" runat="server" TabIndex="8"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcPeriodo" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Período:</p> </td> <td> <telerik:RadComboBox ID="ddlPeriodo" runat="server" TabIndex="8"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcFaixaEtaria" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" nowrap="nowrap" width="110"> <p> Faixa Etária:</p> </td> <td> <telerik:RadComboBox ID="ddlFaixaEtaria" runat="server" TabIndex="9"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcEstadoCivil" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" nowrap="nowrap" width="110"> <p> Estado Civil:</p> </td> <td> <telerik:RadComboBox ID="ddlEstadoCivil" runat="server" TabIndex="11"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcSexo" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Sexo:</p> </td> <td> <telerik:RadComboBox ID="ddlSexo" runat="server" TabIndex="12"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcFaixaCartao" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" nowrap="nowrap" width="110"> <p> Faixa Cartão:</p> </td> <td> <telerik:RadComboBox ID="ddlFaixaCartao" runat="server" TabIndex="15"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcGrupoCliente" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" nowrap="nowrap" width="110"> <p> Grupo Cliente:</p> </td> <td> <telerik:RadComboBox ID="ddlGrupoCliente" runat="server" TabIndex="16"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcInstrucao" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Instrução:</p> </td> <td> <telerik:RadComboBox ID="ddlInstrucao" runat="server" TabIndex="17"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcProfissao" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Profissão:</p> </td> <td> <telerik:RadComboBox ID="ddlProfissao" runat="server" TabIndex="18"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcRamo" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Ramo:</p> </td> <td> <telerik:RadComboBox ID="ddlRamo" runat="server" TabIndex="19"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcCartao" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Cartão:</p> </td> <td> <telerik:RadComboBox ID="ddlCartao" runat="server" TabIndex="20"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcBandeira" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Bandeira:</p> </td> <td> <telerik:RadComboBox ID="ddlBandeira" runat="server" TabIndex="21"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcValor" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Valor:</p> </td> <td> <telerik:RadComboBox ID="ddlValor" runat="server" TabIndex="22"> </telerik:RadComboBox> </td> </tr> </table> </div> <div id="divUcTempo" runat="server" class="perfil"> <table cellspacing="0" cellpadding="2"> <tr> <td align="right" width="110"> <p> Tempo:</p> </td> <td> <telerik:RadComboBox ID="ddlTempo" runat="server" TabIndex="23"> </telerik:RadComboBox> </td> </tr> </table> </div> </td> </tr> <tr> <td style="padding: 10px 10px 10px 0;" align="right"> <telerik:RadButton ID="btnGerar" runat="server" Text="Gerar Relatório" OnClick="btnGerar_Click" CausesValidation="true" Enabled="false" /> </td> </tr> </table> </telerik:RadPageView> </telerik:RadMultiPage> </div> <div> </div> <div> <telerik:RadTabStrip ID="radTabResultados" runat="server" MultiPageID="radMultiPageResultados" SelectedIndex="0"> <Tabs> <telerik:RadTab runat="server" Text=":: Gráficos" PageViewID="radPvGraficos" Selected="True"> </telerik:RadTab> <telerik:RadTab runat="server" Text=":: Dados" PageViewID="radPvDados"> </telerik:RadTab> </Tabs> </telerik:RadTabStrip> <telerik:RadMultiPage ID="radMultiPageResultados" runat="server" SelectedIndex="0"> <telerik:RadPageView ID="radPvGraficos" runat="server" Width="100%"> <table width="100%" border="0" cellspacing="0" cellpadding="10" class="radTabPvBorderTable"> <tr> <td> <telerik:RadTabStrip ID="radTabGraficos" runat="server" MultiPageID="radMultiPageGraficos" SelectedIndex="0" Orientation="VerticalLeft" Style="float: left"> <Tabs> <telerik:RadTab runat="server" Text="Categorias:" PageViewID="radPvCategorias" Selected="True"> </telerik:RadTab> <telerik:RadTab runat="server" Text="Venda:" PageViewID="radPvVenda"> </telerik:RadTab> <telerik:RadTab runat="server" Text="Não Venda:" PageViewID="radPvNaoVenda"> </telerik:RadTab> </Tabs> </telerik:RadTabStrip> <telerik:RadMultiPage ID="radMultiPageGraficos" runat="server" SelectedIndex="0" CssClass="multiPage"> <telerik:RadPageView ID="radPvCategorias" runat="server" Width="100%"> <table width="100%" border="0" cellspacing="10" cellpadding="0"> <tr> <td> <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="800px" Height="500px"> <PlotArea> <Series> <telerik:BarSeries Name="Dia" DataField="DIA"> <TooltipsAppearance DataFormatString="{0}" /> <LabelsAppearance Visible="false" /> </telerik:BarSeries> <telerik:BarSeries Name="Acumulado" DataField="ACUM"> <TooltipsAppearance DataFormatString="{0}" /> <LabelsAppearance Visible="false" /> </telerik:BarSeries> </Series> <XAxis DataLabelsField="Title"> </XAxis> <YAxis> <LabelsAppearance DataFormatString="{0}" /> </YAxis> </PlotArea> <Legend> <Appearance Position="Bottom" /> </Legend> <ChartTitle Text="Categorias"> </ChartTitle> </telerik:RadHtmlChart> </td> </tr> <tr> <td> </td> </tr> </table> </telerik:RadPageView> <telerik:RadPageView ID="radPvVenda" runat="server" Width="100%"> <table width="100%" border="0" cellspacing="10" cellpadding="0"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </table> </telerik:RadPageView> <telerik:RadPageView ID="radPvNaoVenda" runat="server" Width="100%"> <table width="100%" border="0" cellspacing="10" cellpadding="0"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </table> </telerik:RadPageView> </telerik:RadMultiPage> </td> </tr> </table> </telerik:RadPageView> <telerik:RadPageView ID="radPvDados" runat="server" Width="100%"> <table width="100%" border="0" cellspacing="0" cellpadding="10" class="radTabPvBorderTable"> <tr> <td> <telerik:RadGrid runat="server" ID="radGrid" GridLines="Vertical" ShowFooter="True" AllowSorting="True" ShowGroupPanel="True" AutoGenerateColumns="False" AllowPaging="False" OnGroupsChanging="radGrid_GroupsChanging" GroupingSettings-RetainGroupFootersVisibility="True" OnPreRender="radGrid_PreRender" OnNeedDataSource="radGrid_NeedDataSource"> <MasterTableView DataKeyNames="CAT_DESC" EnableHeaderContextMenu="True" ShowGroupFooter="True" AllowMultiColumnSorting="True" GroupsDefaultExpanded="False"> <GroupFooterTemplate> <asp:Label ID="Label6" runat="server" Text='<%# "Itens do grupo: "+ Eval("LOTE_DESC") %>' /> </GroupFooterTemplate> <%--<GroupByExpressions> <telerik:GridGroupByExpression> <SelectFields> <telerik:GridGroupByField FieldName="CAT_DESC" FieldAlias="Categoria" /> </SelectFields> <GroupByFields> <telerik:GridGroupByField FieldName="CAT_DESC" FieldAlias="CAT_DESC" /> </GroupByFields> </telerik:GridGroupByExpression> </GroupByExpressions>--%> <Columns> <telerik:GridBoundColumn DataField="ID_CATEGORIA" Visible="false" /> <telerik:GridBoundColumn DataField="PARAM" Visible="false" /> <telerik:GridBoundColumn DataField="CAT_DESC" HeaderText="Categoria" SortExpression="CAT_DESC" /> <telerik:GridBoundColumn DataField="DESCRICAO" HeaderText="Descrição" SortExpression="DESCRICAO" /> <telerik:GridBoundColumn DataField="DIA" HeaderText="Dia" SortExpression="DIA" /> <telerik:GridBoundColumn DataField="ACUM" HeaderText="Acumulado" SortExpression="ACUM" /> <telerik:GridTemplateColumn> <ItemTemplate> <a href="OperacionalDetalhe.aspx?id=<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"ID_CATEGORIA"))%>&des=<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"DESCRICAO"))%>¶m=<%# Convert.ToString(DataBinder.Eval(Container.DataItem,"PARAM"))%>" target="_blank"> <asp:Image ID="ico" runat="server" ImageUrl='images/zoom.png' /> </a> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True"> <Resizing AllowColumnResize="True" /> </ClientSettings> <GroupingSettings ShowUnGroupButton="True" /> </telerik:RadGrid> </td> </tr> </table> </telerik:RadPageView> </telerik:RadMultiPage> </div> </asp:Panel> </fieldset> </div> <div class="logoMono"> <img src="images/logo2_mono.png" height="47" alt="" /></div> </div> </div> </td> </tr> </table> </div> </div> </div> <div id="footer"> <div class="info"> sac@portalunico.com.br | 0800 11552200 | © 2012 - PORTAL ÚNICO</div> </div> </div> </form> <script src="<%= Page.ResolveUrl("~/js/cssInputs.js") %>" type="text/javascript"></script></body></html>cs
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using System.Globalization;using System.Web.UI.WebControls.WebParts;using System.Data;using System.Xml;using Telerik.Web.UI;using PortalWK.Entities;using PortalWK.Business;using Util;public partial class TesteComponente : BasePage{ #region Eventos... protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ExibirMensagem(string.Empty); AutenticarUsuario(); PreencherMenu(); PreencherComboRelatorio(); PreencherListMailing(false); OcultaTodosFiltros(); } } protected void ddlTipoRel_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { if ((ddlTipoRel.SelectedIndex > 0) && (ddlTipoRel.SelectedItem.Text != string.Empty)) { try { CarregarFiltros(Util.Util.ParseInt32(ddlTipoRel.SelectedItem.Value), CampanhaSelecionada.IntIdCampanha); ExibirMensagem(string.Empty); } catch (Exception ex) { RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } } protected void chkTodosLotes_CheckedChanged(object sender, EventArgs e) { lstLotes.Items.Clear(); lstLotesSelecionados.Items.Clear(); PreencherListMailing(chkTodosLotes.Checked); } protected void btnAdd_Click(object sender, ImageClickEventArgs e) { if (lstLotes.SelectedIndex > -1) { for (int i = lstLotes.Items.Count - 1; i >= 0; i--) { if (lstLotes.Items[i].Selected == true) { lstLotesSelecionados.Items.Add(lstLotes.Items[i]); ListItem li = lstLotes.Items[i]; lstLotes.Items.Remove(li); } } ExibirMensagem(string.Empty); btnGerar.Enabled = true; } } protected void btnRemove_Click(object sender, ImageClickEventArgs e) { if (lstLotesSelecionados.SelectedIndex > -1) { for (int i = lstLotesSelecionados.Items.Count - 1; i >= 0; i--) { if (lstLotesSelecionados.Items[i].Selected == true) { lstLotes.Items.Add(lstLotesSelecionados.Items[i]); ListItem li = lstLotesSelecionados.Items[i]; lstLotesSelecionados.Items.Remove(li); } } } else { btnGerar.Enabled = false; } } protected void btnAddAll_Click(object sender, EventArgs e) { int _count = lstLotes.Items.Count; if (_count != 0) { for (int i = 0; i < _count; i++) { ListItem item = new ListItem(); item.Text = lstLotes.Items[i].Text; item.Value = lstLotes.Items[i].Value; lstLotesSelecionados.Items.Add(item); } ExibirMensagem(string.Empty); btnGerar.Enabled = true; } lstLotes.Items.Clear(); } protected void btnRemoveAll_Click(object sender, EventArgs e) { int _count = lstLotesSelecionados.Items.Count; if (_count != 0) { for (int i = 0; i < _count; i++) { ListItem item = new ListItem(); item.Text = lstLotesSelecionados.Items[i].Text; item.Value = lstLotesSelecionados.Items[i].Value; lstLotes.Items.Add(item); } } lstLotesSelecionados.Items.Clear(); btnGerar.Enabled = false; } protected void ddlEstado_SelectedIndexChanged(object sender, EventArgs e) { if ((ddlEstado.SelectedIndex > 0) && (ddlEstado.SelectedItem.Text != string.Empty)) { try { PreencherComboCidade(Util.Util.ParseInt32(ddlEstado.SelectedItem.Value)); HabilitaDesabilitaCombos(ref ddlCidade, true); } catch (Exception ex) { ExibirMensagem("Atenção! Por favor tente mais tarde."); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } } protected void btnGerar_Click(object sender, EventArgs e) { if (Page.IsValid == true) { try { BindGrid(); divInfo.Visible = false; } catch (Exception ex) { StrMensagem = "Atenção! Não foi possível realizar a consulta, por favor confira os filtros ou tente mais tarde."; RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); ExibirMensagem(StrMensagem); } } } protected void Page_ServerValidate(object source, ServerValidateEventArgs args) { switch (((CustomValidator)source).ID) { case "cvlDdlTipoRel": if (ddlTipoRel.SelectedIndex == 0) { args.IsValid = false; radTabParametros.SelectedIndex = 0; radMultiPageParametros.SelectedIndex = 0; ExibirMensagem("Atenção! Informe o campo: RELATÓRIO"); } break; case "cvlLstLotesSelecionados": if (lstLotesSelecionados.Items.Count == 0) { args.IsValid = false; radTabParametros.SelectedIndex = 1; radMultiPageParametros.SelectedIndex = 1; ExibirMensagem("Atenção! Informe o campo: LOTE"); } break; case "cvlTxtDe": if (txtDatDe.SelectedDate == DateTime.MinValue) { args.IsValid = false; radTabParametros.SelectedIndex = 2; radMultiPageParametros.SelectedIndex = 2; ExibirMensagem("Atenção! Informe o campo: Date de início"); } break; case "cvlTxtAte": if (txtDatAte.SelectedDate != DateTime.MinValue) { DateTime inicio = Convert.ToDateTime(txtDatDe.SelectedDate); DateTime fim = Convert.ToDateTime(txtDatAte.SelectedDate); TimeSpan diferenca = fim.Subtract(inicio); if (diferenca.Days > 30) { ExibirMensagem("Atenção! A diferença deve ser no máximo 31 dias"); txtDatAte.SelectedDate = inicio.AddDays(31); args.IsValid = false; } } break; default: break; } } protected void radGrid_GroupsChanging(object sender, GridGroupsChangingEventArgs e) { if (e.Action == GridGroupsChangingAction.Group) { radGrid.MasterTableView.GetColumnSafe(e.Expression.GroupByFields[0].FieldName).Visible = false; } else if (e.Action == GridGroupsChangingAction.Ungroup) { radGrid.MasterTableView.GetColumnSafe(e.Expression.GroupByFields[0].FieldName).Visible = true; } } protected void radGrid_PreRender(object sender, EventArgs e) { } protected void radGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { radGrid.DataSource = ConsultarGrid(); } #endregion #region Métodos... public void PreencherMenu() { try { RadMenu1.DataSource = new PortalMenuBUS().Listar(1); RadMenu1.DataTextField = "strPmDesc"; RadMenu1.DataNavigateUrlField = "strPmUrl"; RadMenu1.DataFieldID = "intIdPortalMenu"; RadMenu1.DataFieldParentID = "intPmPai"; RadMenu1.DataBind(); } catch { } } public void PreencherComboRelatorio() { try { ddlTipoRel.DataSource = new PortalRelatorioBUS().ListarRelatorio(UsuarioLogado.IntIdPortalGrupo); ddlTipoRel.DataValueField = "intIdPortalRelatorio"; ddlTipoRel.DataTextField = "strRelDesc"; ddlTipoRel.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlTipoRel.Items.Insert(0, espaco); ddlTipoRel.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: RELATÓRIO"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } public void PreencherListMailing(bool todos) { try { lstLotes.DataSource = new LoteBUS().Listar(CampanhaSelecionada.StrConexao, todos); lstLotes.DataValueField = "intIdLote"; lstLotes.DataTextField = "LstLoteDesc"; lstLotes.DataBind(); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar a lista de: LOTES."); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } private void CarregarFiltros(int idRelatorio, int idCampanha) { PreencherPeriodo(0); // Número de dias. Ex (-30, 0, 30) PreencherComboCategoria(); PreencherComboOperador(); PreencherComboPeriodo(); PreencherComboFaixaEtaria(); PreencherComboEstado(); PreencherComboEstadoCivil(); PreencherComboSexo(); PreencherComboRegiao(); PreencherComboCidade(0); PreencherComboFaixaCartao(); PreencherComboGrupoCliente(); PreencherComboInstrucao(); PreencherComboProfissao(); PreencherComboRamo(); PreencherComboCartao(); PreencherComboBandeira(); PreencherComboValor(); PreencherComboTempo(); VerificaFiltro(idRelatorio); } public void PreencherPeriodo(int minRange) { DateTime dataAtual = DateTime.Now; DateTime dataMin = DateTime.Now; DateTime dataMax = DateTime.Now; dataMax = dataAtual; dataMin = dataAtual.AddDays(minRange); txtDatDe.SelectedDate = dataMin; txtDatAte.SelectedDate = dataMax; } public void PreencherComboCategoria() { try { ddlCategoria.DataSource = new CategoriaBUS().ListarTodos(CampanhaSelecionada.StrConexao, CampanhaSelecionada.IntIdCampanha); ddlCategoria.DataValueField = "intIdCategoria"; ddlCategoria.DataTextField = "strCatDesc"; ddlCategoria.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlCategoria.Items.Insert(0, espaco); ddlCategoria.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: CATEGORIA"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // LOCAL public void PreencherComboOperador() { try { ddlOperador.DataSource = new OperadorBUS().ListarTodos(CampanhaSelecionada.StrConexao, CampanhaSelecionada.IntIdCampanha); ddlOperador.DataValueField = "intIdUsuario"; ddlOperador.DataTextField = "strUsuNome"; ddlOperador.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlOperador.Items.Insert(0, espaco); ddlOperador.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: OPERADOR"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // LOCAL public void PreencherComboPeriodo() { try { ddlPeriodo.DataSource = new PeriodoBUS().ListarTodos(); ddlPeriodo.DataValueField = "intIdPeriodo"; ddlPeriodo.DataTextField = "strPerDesc"; ddlPeriodo.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlPeriodo.Items.Insert(0, espaco); ddlPeriodo.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: PERIODO"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // LOCAL public void PreencherComboFaixaEtaria() { try { ddlFaixaEtaria.DataSource = new FaixaEtariaBUS().ListarTodos(CampanhaSelecionada.StrConexao); ddlFaixaEtaria.DataValueField = "intIdFaixaEtaria"; ddlFaixaEtaria.DataTextField = "strFeDesc"; ddlFaixaEtaria.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlFaixaEtaria.Items.Insert(0, espaco); ddlFaixaEtaria.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: FAIXA ETÁRIA"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // LOCAL public void PreencherComboEstado() { try { ddlEstado.DataSource = new EstadoBUS().ListarTodos(); ddlEstado.DataValueField = "intIdUf"; ddlEstado.DataTextField = "strEstNome"; ddlEstado.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlEstado.Items.Insert(0, espaco); ddlEstado.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: ESTADO"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void PreencherComboEstadoCivil() { try { ddlEstadoCivil.DataSource = new EstadoCivilBUS().ListarTodos(); ddlEstadoCivil.DataValueField = "intIdEstadoCivil"; ddlEstadoCivil.DataTextField = "strEcDesc"; ddlEstadoCivil.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlEstadoCivil.Items.Insert(0, espaco); ddlEstadoCivil.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: ESTADO CIVIL"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void PreencherComboSexo() { try { ddlSexo.DataSource = new SexoBUS().ListarTodos(); ddlSexo.DataValueField = "intIdSexo"; ddlSexo.DataTextField = "strSxDesc"; ddlSexo.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlSexo.Items.Insert(0, espaco); ddlSexo.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: SEXO"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void PreencherComboRegiao() { try { ddlRegiao.DataSource = new RegiaoBUS().ListarTodos(); ddlRegiao.DataValueField = "intIdRegiao"; ddlRegiao.DataTextField = "strRegDesc"; ddlRegiao.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlRegiao.Items.Insert(0, espaco); ddlRegiao.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: REGIÃO"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void PreencherComboCidade(int idEstado) { try { if (idEstado == 0) { RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "INFORME O ESTADO"; ddlCidade.Items.Insert(0, espaco); ddlCidade.Items.Insert(0, selecionado); } else { ddlCidade.DataSource = new CidadeBUS().ListarTodos(idEstado); ddlCidade.DataValueField = "intIdCidade"; ddlCidade.DataTextField = "strCidNome"; ddlCidade.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlCidade.Items.Insert(0, espaco); ddlCidade.Items.Insert(0, selecionado); } } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: CIDADE"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void PreencherComboFaixaCartao() { try { ddlFaixaCartao.DataSource = new FaixaCartaoBUS().ListarTodos(CampanhaSelecionada.StrConexao); ddlFaixaCartao.DataValueField = "intIdFaixaCartao"; ddlFaixaCartao.DataTextField = "strCfDesc"; ddlFaixaCartao.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlFaixaCartao.Items.Insert(0, espaco); ddlFaixaCartao.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: FAIXA DO CARTÃO"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // LOCAL public void PreencherComboGrupoCliente() { try { ddlGrupoCliente.DataSource = new GrupoClienteBUS().ListarTodos(CampanhaSelecionada.StrConexao); ddlGrupoCliente.DataValueField = "intIdGrupoCliente"; ddlGrupoCliente.DataTextField = "strGcDesc"; ddlGrupoCliente.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlGrupoCliente.Items.Insert(0, espaco); ddlGrupoCliente.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: GRUPO DO CLIENTE"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // LOCAL public void PreencherComboInstrucao() { try { ddlInstrucao.DataSource = new InstrucaoBUS().ListarTodos(); ddlInstrucao.DataValueField = "intIdInstrucao"; ddlInstrucao.DataTextField = "strInstDesc"; ddlInstrucao.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlInstrucao.Items.Insert(0, espaco); ddlInstrucao.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: NÍVEL DE INSTRUÇÃO"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void PreencherComboProfissao() { try { ddlProfissao.DataSource = new ProfissaoBUS().ListarTodos(); ddlProfissao.DataValueField = "intIdProfissao"; ddlProfissao.DataTextField = "strProfDesc"; ddlProfissao.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlProfissao.Items.Insert(0, espaco); ddlProfissao.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: PROFISSÃO"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void PreencherComboRamo() { try { ddlRamo.DataSource = new RamoBUS().ListarTodos(); ddlRamo.DataValueField = "intIdRamo"; ddlRamo.DataTextField = "strRamoDesc"; ddlRamo.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlRamo.Items.Insert(0, espaco); ddlRamo.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: RAMO DE ATIVIDADE"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void PreencherComboCartao() { try { ddlCartao.DataSource = new ClasseCartaoBUS().ListarTodos(); ddlCartao.DataValueField = "intIdClasseCartao"; ddlCartao.DataTextField = "strCCDesc"; ddlCartao.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlCartao.Items.Insert(0, espaco); ddlCartao.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: CARTÃO"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void PreencherComboBandeira() { try { ddlBandeira.DataSource = new BandCartaoBUS().ListarTodos(); ddlBandeira.DataValueField = "intIdBandCartao"; ddlBandeira.DataTextField = "strBandDesc"; ddlBandeira.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlBandeira.Items.Insert(0, espaco); ddlBandeira.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: BANDEIRA"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void PreencherComboValor() { try { ddlValor.DataSource = new PerfilCartaoBUS().ListarTodos(); ddlValor.DataValueField = "intIdPerfilCartao"; ddlValor.DataTextField = "strPcDesc"; ddlValor.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlValor.Items.Insert(0, espaco); ddlValor.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: VALOR"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void PreencherComboTempo() { try { ddlTempo.DataSource = new TempoCartaoBUS().ListarTodos(); ddlTempo.DataValueField = "intIdTempoCartao"; ddlTempo.DataTextField = "strTcDesc"; ddlTempo.DataBind(); RadComboBoxItem selecionado = new RadComboBoxItem(); RadComboBoxItem espaco = new RadComboBoxItem(); espaco.Text = ""; selecionado.Text = "SELECIONE"; ddlTempo.Items.Insert(0, espaco); ddlTempo.Items.Insert(0, selecionado); } catch (Exception ex) { ExibirMensagem("Atenção! Não foi possível carregar o combo: TEMPO"); RegistrarLogErro(Request.CurrentExecutionFilePath.ToString(), ex.Message); } } // GLOBAL public void VerificaFiltro(int idPortalRelatorio) { ExibeFiltro(divUcDe, true); ExibeFiltro(divUcAte, true); LinkedList<PortalFiltro> lstFiltros = new LinkedList<PortalFiltro>(); try { lstFiltros = new PortalFiltroBUS().ListarCadastro(idPortalRelatorio); if (lstFiltros.Count > 0) { foreach (var item in lstFiltros) { if (item.IntAcesso == 1) { SelecionaFiltro(item.IntIdPortalFiltro); } } } } catch { } } private void SelecionaFiltro(int intIdPortalFiltro) { switch (intIdPortalFiltro) { case 1: //Bandeira ExibeFiltro(divUcBandeira, true); break; case 2: //Cartão ExibeFiltro(divUcCartao, true); break; case 3: //Categoria ExibeFiltro(divUcCategoria, true); break; case 4: //Cidade ExibeFiltro(divUcCidade, true); break; case 5: //Estado ExibeFiltro(divUcEstado, true); break; case 6: //Estado Civil ExibeFiltro(divUcEstadoCivil, true); break; case 7: //Faixa Cartão ExibeFiltro(divUcFaixaCartao, true); break; case 8: //Faixa Etária ExibeFiltro(divUcFaixaEtaria, true); break; case 9: //Grupo Cliente ExibeFiltro(divUcGrupoCliente, true); break; case 10: //Instrução ExibeFiltro(divUcInstrucao, true); break; case 11: //Operador ExibeFiltro(divUcOperador, true); break; case 12: //Período ExibeFiltro(divUcPeriodo, true); break; case 13: //Profissão ExibeFiltro(divUcProfissao, true); break; case 14: //Ramo ExibeFiltro(divUcRamo, true); break; case 15: //Região ExibeFiltro(divUcRegiao, true); break; case 16: //Sexo ExibeFiltro(divUcSexo, true); break; case 17: //Tempo ExibeFiltro(divUcTempo, true); break; case 18: //Valor ExibeFiltro(divUcValor, true); break; } } private void ExibeFiltro(HtmlControl div, bool exibir) { div.Visible = exibir; } private void OcultaTodosFiltros() { ExibeFiltro(divUcDe, false); ExibeFiltro(divUcAte, false); ExibeFiltro(divUcCategoria, false); ExibeFiltro(divUcOperador, false); ExibeFiltro(divUcPeriodo, false); ExibeFiltro(divUcFaixaEtaria, false); ExibeFiltro(divUcEstado, false); ExibeFiltro(divUcEstadoCivil, false); ExibeFiltro(divUcSexo, false); ExibeFiltro(divUcRegiao, false); ExibeFiltro(divUcCidade, false); ExibeFiltro(divUcFaixaCartao, false); ExibeFiltro(divUcGrupoCliente, false); ExibeFiltro(divUcInstrucao, false); ExibeFiltro(divUcProfissao, false); ExibeFiltro(divUcRamo, false); ExibeFiltro(divUcCartao, false); ExibeFiltro(divUcBandeira, false); ExibeFiltro(divUcValor, false); ExibeFiltro(divUcTempo, false); } public QryRelProducao CapturarFiltros() { QryRelProducao objFiltros = new QryRelProducao(); objFiltros.DatDataMin = Util.Util.ParseDateTime(txtDatDe.SelectedDate); objFiltros.DatDataMax = Util.Util.ParseDateTime(txtDatAte.SelectedDate); objFiltros.IntIdCategoria = Util.Util.ParseInt32(ddlCategoria.SelectedItem.Value); objFiltros.IntIdUsuario = Util.Util.ParseInt32(ddlOperador.SelectedItem.Value); objFiltros.IntIdFaixaEtaria = Util.Util.ParseInt32(ddlFaixaEtaria.SelectedItem.Value); objFiltros.IntIdUf = Util.Util.ParseInt32(ddlEstado.SelectedItem.Value); objFiltros.IntIdEstadoCivil = Util.Util.ParseInt32(ddlEstadoCivil.SelectedItem.Value); objFiltros.IntIdSexo = Util.Util.ParseInt32(ddlSexo.SelectedItem.Value); objFiltros.IntIdRegiao = Util.Util.ParseInt32(ddlRegiao.SelectedItem.Value); objFiltros.IntIdCidade = Util.Util.ParseInt32(ddlCidade.SelectedItem.Value); objFiltros.IntIdFaixaCartao = Util.Util.ParseInt32(ddlFaixaCartao.SelectedItem.Value); objFiltros.IntIdGrupoCliente = Util.Util.ParseInt32(ddlGrupoCliente.SelectedItem.Value); objFiltros.IntIdInstrucao = Util.Util.ParseInt32(ddlInstrucao.SelectedItem.Value); objFiltros.IntIdProfissao = Util.Util.ParseInt32(ddlProfissao.SelectedItem.Value); objFiltros.IntIdRamo = Util.Util.ParseInt32(ddlRamo.SelectedItem.Value); objFiltros.IntIdClasseCartao = Util.Util.ParseInt32(ddlCartao.SelectedItem.Value); objFiltros.IntIdBandCartao = Util.Util.ParseInt32(ddlBandeira.SelectedItem.Value); objFiltros.IntIdPerfilCartao = Util.Util.ParseInt32(ddlValor.SelectedItem.Value); objFiltros.IntIdTempoCartao = Util.Util.ParseInt32(ddlTempo.SelectedItem.Value); string listaLotes = "0"; for (int i = 0; i < lstLotesSelecionados.Items.Count; i++) { listaLotes = listaLotes + "," + lstLotesSelecionados.Items[i].Value; } objFiltros.StrIdLotes = listaLotes; return objFiltros; } private void BindGrid() { DataTable source = ConsultarGrid(); DataTable totais = GetRowsByFilter(source, "ID_CATEGORIA IN (3,5)"); radGrid.DataSource = source; RadHtmlChart1.DataSource = source; } public DataTable GetRowsByFilter(DataTable source, string expression) { DataTable dt = new DataTable("RESUMO_GERAL"); DataColumn pk = dt.Columns.Add("ID_RESUMOGERAL", typeof(int)); dt.Columns["ID_RESUMOGERAL"].Unique = true; dt.PrimaryKey = new DataColumn[] { dt.Columns["ID_RESUMOGERAL"] }; pk.AutoIncrement = true; pk.AutoIncrementSeed = 100; pk.AutoIncrementStep = 1; dt.Columns.Add("RG_DESC", typeof(string)); dt.Columns.Add("DIA", typeof(int)); dt.Columns.Add("ACUM", typeof(int)); DataRow row = dt.NewRow(); row["ID_RESUMOGERAL"] = 1; row["RG_DESC"] = "TOTAL TRABALHADOS (FINALIZADOS)"; row["DIA"] = source.Compute("Sum(DIA)", expression); row["ACUM"] = source.Compute("Sum(ACUM)", expression); dt.Rows.Add(row); return dt; } public DataTable ConsultarGrid() { DataTable dtTableGrid = new DataTable(); try { #region Parâmentros... QryRelProducao objFiltros = CapturarFiltros(); //objFiltros.DatDataMin = Convert.ToDateTime("01/03/2012"); //objFiltros.DatDataMax = Convert.ToDateTime("31/03/2012"); //objFiltros.StrIdLotes = "0,133,113,93,73,72"; //objFiltros.StrIdLotes = "72"; string parametros = ""; if (objFiltros.IntIdCategoria != int.MinValue) parametros += objFiltros.IntIdCategoria + ";"; else parametros += 0 + ";"; if (objFiltros.DatDataMin != DateTime.MinValue) parametros += objFiltros.DatDataMin + ";"; else parametros += 0 + ";"; if (objFiltros.DatDataMax != DateTime.MinValue) parametros += objFiltros.DatDataMax + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdUsuario != int.MinValue) parametros += objFiltros.IntIdUsuario + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdFaixaEtaria != int.MinValue) parametros += objFiltros.IntIdFaixaEtaria + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdUf != int.MinValue) parametros += objFiltros.IntIdUf + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdEstadoCivil != int.MinValue) parametros += objFiltros.IntIdEstadoCivil + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdSexo != int.MinValue) parametros += objFiltros.IntIdSexo + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdRegiao != int.MinValue) parametros += objFiltros.IntIdRegiao + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdCidade != int.MinValue) parametros += objFiltros.IntIdCidade + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdFaixaCartao != int.MinValue) parametros += objFiltros.IntIdFaixaCartao + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdGrupoCliente != int.MinValue) parametros += objFiltros.IntIdGrupoCliente + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdInstrucao != int.MinValue) parametros += objFiltros.IntIdInstrucao + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdProfissao != int.MinValue) parametros += objFiltros.IntIdProfissao + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdRamo != int.MinValue) parametros += objFiltros.IntIdRamo + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdClasseCartao != int.MinValue) parametros += objFiltros.IntIdClasseCartao + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdBandCartao != int.MinValue) parametros += objFiltros.IntIdBandCartao + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdPerfilCartao != int.MinValue) parametros += objFiltros.IntIdPerfilCartao + ";"; else parametros += 0 + ";"; if (objFiltros.IntIdTempoCartao != int.MinValue) parametros += objFiltros.IntIdTempoCartao + ";"; else parametros += 0 + ";"; if (objFiltros.StrIdLotes != string.Empty) parametros += objFiltros.StrIdLotes; else parametros += ""; #endregion dtTableGrid = new QryRelProducaoBUS().Listar(objFiltros); dtTableGrid.Columns.Add("PARAM", typeof(String)); foreach (DataRow dr in dtTableGrid.Rows) { dr["PARAM"] = parametros; } } catch (Exception) { } return dtTableGrid; } public static String ConvertDataTableToXML(DataTable tableToExport, DataTable tableGraficos) { XmlDocument doc = new XmlDocument(); XmlNode node = doc.CreateNode(XmlNodeType.Element, string.Empty, "root", null); // Tabela de gráficos para o tipo de relatório selecionado DataColumnCollection dtColumns = tableGraficos.Columns; foreach (DataRow dataItem in tableGraficos.Rows) { XmlElement element = doc.CreateElement("graficos"); foreach (DataColumn thisColumn in dtColumns) { object value = dataItem[thisColumn]; XmlElement tmp = doc.CreateElement(thisColumn.ColumnName); if (value != null) { tmp.InnerXml = (Util.Util.ExisteCaracteresEspeciais(value.ToString()) ? @"<![CDATA[" + value.ToString() + "]]>" : value.ToString()); } else { tmp.InnerXml = string.Empty; } element.AppendChild(tmp); } node.AppendChild(element); } // Relátório dtColumns = tableToExport.Columns; foreach (DataRow dataItem in tableToExport.Rows) { XmlElement element = doc.CreateElement("data"); foreach (DataColumn thisColumn in dtColumns) { object value = dataItem[thisColumn]; XmlElement tmp = doc.CreateElement(thisColumn.ColumnName); if (value != null) { tmp.InnerXml = (Util.Util.ExisteCaracteresEspeciais(value.ToString()) ? @"<![CDATA[" + value.ToString() + "]]>" : value.ToString()); } else { tmp.InnerXml = string.Empty; } element.AppendChild(tmp); } node.AppendChild(element); } doc.AppendChild(node); return doc.InnerXml; } private void HabilitaDesabilitaCampos(ref RadDatePicker campo, bool abilitar) { campo.Enabled = abilitar; //campo.Text = string.Empty; } private void HabilitaDesabilitaCombos(ref RadComboBox combo, bool abilitar) { combo.Enabled = abilitar; combo.SelectedIndex = 0; } public void ExibirMensagem(string StrMensagem) { divMsgErro.Visible = false; divMsgOk.Visible = false; if (StrMensagem.Length > 0) { if (StrMensagem.Substring(0, 8) == "Atenção!") { lblMsgErro.Text = StrMensagem; divMsgErro.Visible = true; } else { lblMsgOk.Text = StrMensagem; divMsgOk.Visible = true; } } StrMensagem = ""; } #endregion}Thanks.
0
Hi Luis,
The provided information till now is not enough to isolate the root cause of the error you are facing. Therefore could I kindly ask you to send us runnable version of the project which demonstrates the described problem. Thus we will be able to test it locally and provide a proper solution for your case.
Greetings,
Pavlina
the Telerik team
The provided information till now is not enough to isolate the root cause of the error you are facing. Therefore could I kindly ask you to send us runnable version of the project which demonstrates the described problem. Thus we will be able to test it locally and provide a proper solution for your case.
Greetings,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.