Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
179 views
Hello,

       I am running into a problem with a RadTabStrip inside a user control. Here is the problem :

       I have a RadTabStrip inside a user control which has a RadMultiPage associated with it.The RadTabStrip has multiple tabs. There is a RadMultiPage associated with the RadTabStrip.

      The user control is called in an aspx page. The aspx page has RadAjaxManager.   

       There is a RadGrid in the aspx page. When row selected event of the RadGrid is fired then the user control is loaded dynamically in a Panel.

       The user control loads fine in the rowselected event of the RadGrid. But when the Tabs of the RadTabStrip is changed it does not load the correcponding PageView of the Radmultipage does not load.

      Can anyone help me on this here is the code :

    Code for Aspx Page :

     
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                    <script type="text/javascript">
                        function onRequestStart(sender, args) {
                            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToPdfButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
                                args.set_enableAjax(false);
                            }
                        }
                    </script>

                    <style>
                    .rtbInner{text-align:center;}
                    </style>
</telerik:RadCodeBlock>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="main" runat="Server">
<telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
<script src="../../js/scroll-startstop.events.jquery.js" type="text/javascript"></script>
</telerik:RadCodeBlock>
<style>
.loadingpanel{background: no-repeat center;}
</style>
<telerik:RadCodeBlock ID="RadCodeBlock3" runat="server">
<script type="text/javascript">
    var startDate = '';
    var endDate = '';

    function OnStartDateSelected(sender, e) {
        if (e.get_newDate() != null) {
            startDate = e.get_newDate().toDateString();
            //startDate = e.get_dateFormatInfo().FormatDate(e.get_selectedDate, e.get_displayDateFormat());
            //alert(startDate);
        }
        else {
            startDate = '';
        }
    }

    function OnEndDateSelected(sender, e) {
        if (e.get_newDate() != null) {
            endDate = e.get_newDate().toDateString();
        }
        else {
            endDate = '';
        }
    }


var onlyNew = '';


$(function() {

    var printUrl = 'Print.aspx?aid=<%= _useAgentId %>&cmp=<asp:literal runat="server" id="_campaignId" />';

    $("#dialog-form").dialog({
        autoOpen: false,
        height: 250,
        width: 750,
        modal: true,
        buttons: {
            "Print": function() {

                var perpageValue = '1';
                var markreadValue = 'no';
                if ($('#perpage').is(":checked")) { perpageValue = '3'; }
                if ($('#markread').is(":checked")) { markreadValue = 'yes'; }
     
                var windowPath = printUrl + onlyNew + '&pp=' + perpageValue + '&mr=' + markreadValue + '&sd=' + startDate + '&ed=' + endDate;
                window.open(windowPath, 'null', 'height=700,width=900,status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes');
                //window.open();
                $(this).dialog("close");
            },
            Cancel: function() {
                $(this).dialog("close");
            }
        },
        close: function() {
        }
    });
});


            function clientButtonClicked(sender, args)
            {
                if (args.get_item().get_text() == 'Print Unread') { onlyNew = '&new=true' } else { onlyNew = '&new=false' };
                if (args.get_item().get_text() == 'Print Date Range') { $("#printRange").css("display", "inline") } else {$("#printRange").css("display", "none") } ;
                $("#dialog-form").dialog("open");
            }

</script>
</telerik:RadCodeBlock>

<a name="card"></a>

<div id="dialog-form" title="Print" style="display:none;" >
    
    <p><b>Mark leads as Read?</b>
                    <input type="checkbox" id="markread" />Yes! Mark these leads as read when I click "Print".
                    <div style="margin-left:200px;font-size:9px;">
                    Checking 'Yes' will mark all printed leads as 'Read' <br>so they will not show up as 'New' in LeadTracker.
                    </div>
    </p>
    <div id="printRange" style="display:none;">
        <b>Start Date:</b>
        
        <telerik:RadDatePicker runat="server" ID="_printStart" >
            <ClientEvents OnDateSelected="OnStartDateSelected" />
        </telerik:RadDatePicker><br />
        <b>End Date:</b>
        <telerik:RadDatePicker runat="server" ID="_printEnd" >
                <ClientEvents OnDateSelected="OnEndDateSelected" />
        </telerik:RadDatePicker>

    </div>
</div>

<div id="print-help-form" title="Print Help" style="display:none;" >
    <p>This is the help text.</p>
</div>

    <div class="pageheading"><asp:Literal runat=server ID="_pageheading">New Leads</asp:Literal></div>
    <div class="pagesubheading"><asp:Literal runat=server ID="_pagesubheading">List of all new leads you have received. <br /><b>To find your Viewed Leads, please <a href="Campaigns.aspx" style="text-decoration:underline;">Select a Campaign</a>.</b></asp:Literal></div>

 
    <asp:Panel runat="server" ID="_titlePanel" CssClass="titlePanel"></asp:Panel>

                           
    <telerik:RadSplitter runat="Server" ID="RadSplitter1" Width="100%" BorderSize="0"
        BorderStyle="None" PanesBorderSize="0"  Orientation="Horizontal"
        VisibleDuringInit="false">
        <telerik:RadPane runat="server" ID="contentPane" Scrolling="none" height="300px">
            <telerik:RadSplitter runat="server" ID="RadSplitter2" BorderStyle="None" PanesBorderSize="0">

                <telerik:RadPane runat="Server" ID="rightPane" CssClass="right-pane" Scrolling="None">
                    <telerik:RadSplitter runat="server" ID="RadSplitter4" Width="100%" BorderSize="0"
                        BorderStyle="None" PanesBorderSize="0" Height="100%" Orientation="Horizontal">
                        <telerik:RadPane runat="server" ID="RadPane2" >
                        
                                    <telerik:RadToolBar runat="server" ID="RadToolBar1" CssClass="inbox-search-toolbar"
                                     Width="100%" OnClientButtonClicked="clientButtonClicked"
                                        EnableViewState="false">
<%--                                        <Items>
                                                <telerik:RadToolBarDropDown ImageUrl="~/Images/print.gif">
                                                    <Buttons>
                                                        <telerik:RadToolBarButton Text="Print New" />
                                                        <telerik:RadToolBarButton Text="Print All" />
                                                    </Buttons>
                                                </telerik:RadToolBarDropDown>
                                            </Items>
--%>                                    </telerik:RadToolBar>
                            
                            
                            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                                <AjaxSettings>
                                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                                        <UpdatedControls>
                                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                                        </UpdatedControls>
                                    </telerik:AjaxSetting>
                                    <telerik:AjaxSetting AjaxControlID="leadPanel">
                                        <UpdatedControls>
                                            <telerik:AjaxUpdatedControl ControlID="leadPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
                                        </UpdatedControls>
                                    </telerik:AjaxSetting>
                                </AjaxSettings>
                            </telerik:RadAjaxManager>
                            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Skin="Default" InitialDelayTime="0"
        MinDisplayTime="1000" EnableSkinTransparency="true" runat="server"/>
                            

                            <telerik:RadGrid height="267px" runat="server" ID="RadGrid1" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"
                            
                            AllowSorting="True"
                                OnExcelMLExportStylesCreated="RadGrid1_ExcelMLExportStylesCreated"
                                OnExcelMLExportRowCreated="RadGrid1_ExcelMLExportRowCreated"
                                OnItemCommand="RadGrid1_ItemCommand"  
                                GridLines="None"  BorderWidth="0" Style="outline: none" HeaderStyle-Font-Underline="true" GroupingEnabled="false"
                                ShowGroupPanel="false" OnSelectedIndexChanged="GridRowSelected">
                                <ClientSettings Scrolling-AllowScroll="True" Scrolling-UseStaticHeaders="true" Selecting-AllowRowSelect="true"
                                     AllowDragToGroup="true" EnablePostBackOnRowClick="true" EnableRowHoverStyle="true">
                                </ClientSettings>
                                <MasterTableView TableLayout="Fixed" DataKeyNames="CampaignResponseId" CommandItemDisplay="Top"
                                    AdditionalDataFieldNames="Date">
                                    <%--<NoRecordsTemplate >     
                                     <asp:Label ID="Label2" runat="server" Text="Write your message here"></asp:Label>       
                                    </NoRecordsTemplate>--%>    

                                    <CommandItemSettings ShowExportToPdfButton="true" ShowExportToExcelButton="true" ShowExportToCsvButton="true" ShowAddNewRecordButton="false" />
                                    <Columns>
                                        <telerik:GridTemplateColumn UniqueName="ReadIcon" HeaderText="" >
                                            <HeaderStyle Width="10px" />
                                            <ItemTemplate>
                                                <asp:Image ID="Image1" ImageUrl='<%# Eval("WasRead", "~/images/{0}.png") %>' runat="server" />
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>                        
                                       <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderStyle-Width="15px">
                                            <HeaderTemplate>
                                                  <asp:Panel ID="PanelHeader" runat="server">
                                                    <asp:CheckBox ID="CheckBoxHeader"  OnCheckedChanged="HeaderCheckedChanged" runat="server" AutoPostBack="true"  />
                                                </asp:Panel>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Panel ID="Panel1" runat="server">
                                                    <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true"  />
                                                </asp:Panel>
                                            </ItemTemplate>
                                       </telerik:GridTemplateColumn>
                                        
                                        <telerik:GridBoundColumn SortExpression="FirstName"  AllowFiltering="true" DataField="FirstName" HeaderText="First Name" HeaderStyle-Width="40px" />
                                        <telerik:GridBoundColumn SortExpression="LastName"  AllowFiltering="true" DataField="LastName" HeaderText="Last Name" HeaderStyle-Width="40px" />
                                        
                                        <telerik:GridBoundColumn AllowFiltering="true" DataField="Address1" HeaderText="Address" HeaderStyle-Width="80px"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn AllowFiltering="true" DataField="City" HeaderText="City" HeaderStyle-Width="60px"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn AllowFiltering="true" DataField="State" HeaderText="State" HeaderStyle-Width="20px"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn AllowFiltering="true" DataField="Zip" HeaderText="Zip" HeaderStyle-Width="40px"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn AllowFiltering="true" DataField="DateAdded" HeaderText="Received" HeaderStyle-Width="40px" DataFormatString="{0:MM/dd/yyyy}">                                                     
                                        </telerik:GridBoundColumn>
                                        
                                        <telerik:GridTemplateColumn  DataField="MailDate" UniqueName="MailDate" HeaderText="Mailed Date & Name"
                                            HeaderStyle-Width="80px">
                                                <ItemTemplate>
                                                    <b><%# DateTime.Parse(DataBinder.Eval(Container.DataItem, "MailDate").ToString()).ToShortDateString() %></b>
                                                    <%# DataBinder.Eval(Container.DataItem, "CampaignName")%>
                                                </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        
                                        <telerik:GridTemplateColumn DataField="CampaignNumber" UniqueName="ClientNumber"  HeaderText="Client#" HeaderStyle-Width="30px">
                                                <ItemTemplate>
                                                    <%# KramerUtils.GetClientNumberFromCampaignNumber(DataBinder.Eval(Container.DataItem, "CampaignNumber").ToString()).PadLeft(4, '0').Substring(0, 4)%>
                                                </ItemTemplate>
                                        </telerik:GridTemplateColumn>  

                                        <telerik:GridBoundColumn AllowFiltering="true" DataField="MailingNumber" HeaderText="Mail#"
                                            HeaderStyle-Width="20px">
                                        </telerik:GridBoundColumn>

                                        <telerik:GridBoundColumn DataField="LastName" Visible="false" HeaderText="Agent" HeaderStyle-Width="40px" >
                                        </telerik:GridBoundColumn>
                     
                                        <telerik:GridBoundColumn DataField="CampaignResponseId" Visible="false" >
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="ListDataId" Visible="false" >
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CompanyId" Visible="false" >
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CampaignId" Visible="false" >
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CampaignNumber" Visible="false" >
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CRMTemplateId" Visible="false" >
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="AllowMapping" Visible="false" >
                                        </telerik:GridBoundColumn>                                        
                                        <telerik:GridBoundColumn DataField="PhoneNumber" Visible="false" HeaderText="Home Phone" />
                                        <telerik:GridBoundColumn DataField="WorkPhone" Visible="false" HeaderText="Work Phone" />
                                        <telerik:GridBoundColumn DataField="MobilePhone" Visible="false" HeaderText="Mobile Phone" />
                                        <telerik:GridBoundColumn DataField="Email" Visible="false" HeaderText="Email" />                                 
                                    </Columns>
                                   
                                </MasterTableView>
                            </telerik:RadGrid>
                            <asp:SqlDataSource runat="server" ID="LeadsObjectDataSource" DataSourceMode="DataReader"
                                ConnectionString="<%$ ConnectionStrings:KramerConnectionString%>" />
                        </telerik:RadPane>
                    </telerik:RadSplitter>
                </telerik:RadPane>
            </telerik:RadSplitter>
        </telerik:RadPane>
    </telerik:RadSplitter>
    
 
            <asp:Panel ID="leadPanel" runat="server">
            </asp:Panel>
                
            
     
            <script type="text/javascript">
                //var $elem = $('#shablam');
                //$('html, body').animate({ scrollTop: 530 }, 0);
            
            </script>
</asp:Content>

aspx.cs

public partial class secure_client_Home : PageBaseClient
{
    private KramerEntities KE = new KramerEntities();
    protected int _useAgentId;

    protected void Page_PreRender(object sender, EventArgs e)
    {
        //if we selected a single lead, select it so it will show the details
        if (Request.QueryString["lid"] != null)
        {
            SelectFirstGridRow();
            GridDataItem dataItem = RadGrid1.SelectedItems[0] as GridDataItem;
           // DisplayLead(dataItem);
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["CurrentAgentId"] == null) Response.Redirect("~/");
        //if this is a Manager, use the passed AgentId
        if (Request.QueryString["aid"] != null)
        {
            _useAgentId = int.Parse(Request.QueryString["aid"].ToString());
        }
        else
        {
            _useAgentId = CurrentAgentId;
        }

        if (IsPostBack)
        {

            //leadviewcontrol.Visible = true;  //Kaushik Commented
            //leadPanel.Controls.Clear();
            
        }
        else
        {
           // LoadUserControl("~/secure/controls/messages/LeadView.ascx",null); //KAushik Added
        }
        if (Request.QueryString["cid"] != null)
        {
            int _passedIncampaignId = 0;
            if (int.TryParse(Request.QueryString["cid"], out _passedIncampaignId))
            {
                GetCampaignInfo(_passedIncampaignId);
                //add agents name if it isn't me
                int campaignAgentId = Manager.GetCampaignAgent(_passedIncampaignId);
                if (CurrentAgentId != campaignAgentId)
                {
                    Agents theAgent = Manager.GetAgent(campaignAgentId);
                    string AgentName = theAgent.FirstName + " " + theAgent.LastName;
                    _pageheading.Text = "Campaign Leads for " + AgentName;
                    _pagesubheading.Text = "List of all leads recieved for this campaign.";
                }
                else
                {
                    //add headings
                    _pageheading.Text = "Campaign Leads";
                    _pagesubheading.Text = "List of all leads recieved for this campaign.";
                }
            }
        }
    }

    protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        throw new NotImplementedException();
    }

    private void SelectFirstGridRow()
    {
        GridDataItem firstDataItem = RadGrid1.Items.OfType<GridDataItem>().FirstOrDefault();
        if (firstDataItem != null)
        {
            firstDataItem.Selected = true;
        }
    }

    public SqlDataSource NewLeads(string agentId)
    {
        //load the campaign leads in grid
        LeadsObjectDataSource.SelectCommand =
            "SELECT TOP 500 CampaignResponseId, ld.FirstName, ld.LastName, CompanyId, ResponseName, cr.Address1, cr.Address2, cr.City, Cr.[State], cr.ListDataId, " +
            " cr.Zip, Cr.DateAdded, WasRead, Cr.CampaignId, CRMTemplateId, c.MailDate, c.CampaignName, right(c.CampaignNumber,2) as MailingNumber, c.CampaignNumber, AllowMapping, AllowFullExport, AllowCRM " +
            " FROM CampaignResponses cr " +
            " JOIN Campaigns c ON c.CampaignId = cr.CampaignId " +
            " JOIN ListData ld ON ld.ListDataId = cr.ListDataId " +
            "  WHERE c.AgentId = " + agentId + " and cr.WasRead = 0 ORDER BY CampaignResponseId DESC";
        RadGrid1.MasterTableView.NoMasterRecordsText = "<b>There are currently no New Leads</b>";
        return LeadsObjectDataSource;
    }

   

   

   
    protected void GridRowSelected(object sender, EventArgs e)
    {
        var dataItem = RadGrid1.SelectedItems[0] as GridDataItem;
        if (dataItem != null)
        {
           // DisplayLead(dataItem);
            LoadUserControl("~/secure/controls/messages/LeadView.ascx",dataItem);
        }
    }

  
    protected void DisplayLeadNew(secure_controls_messages_LeadView abc,GridDataItem dataItem)
    {
        if (dataItem != null)
        {
            var listId = dataItem["ListDataId"].Text;
            var responseId = dataItem["CampaignResponseId"].Text;
            var companyId = dataItem["CompanyId"].Text;
            var campaignId = dataItem["CampaignId"].Text;
            var campaignNumber = dataItem["CampaignNumber"].Text;
            var crmTemplateId = dataItem["CRMTemplateId"].Text;
            abc.ListId = int.Parse(listId);
            abc.CompanyId = int.Parse(companyId);
            abc.CampaignId = int.Parse(campaignId);
            abc.ResponseId = int.Parse(responseId);
            abc.ClientNumber = KramerUtils.GetClientNumberFromCampaignNumber(campaignNumber);
            abc.EnableNeighborhoodProgram = bool.Parse(dataItem["AllowMapping"].Text); //Kaushik Commented
            int templateId = 0;
            int.TryParse(crmTemplateId, out templateId);
            abc.CRMTemplateId = templateId;
        }

    }

    protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToExcelCommandName ||
            e.CommandName == Telerik.Web.UI.RadGrid.ExportToWordCommandName ||
            e.CommandName == Telerik.Web.UI.RadGrid.ExportToCsvCommandName ||
            e.CommandName == Telerik.Web.UI.RadGrid.ExportToPdfCommandName)
        {
            ConfigureExport();
            if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToPdfCommandName)
            {
                RadGrid1.MasterTableView.GetColumn("FirstName").HeaderStyle.Width = Unit.Pixel(50);
                RadGrid1.MasterTableView.GetColumn("LastName").HeaderStyle.Width = Unit.Pixel(50);
                RadGrid1.MasterTableView.GetColumn("Address1").HeaderStyle.Width = Unit.Pixel(150);
                RadGrid1.MasterTableView.GetColumn("City").HeaderStyle.Width = Unit.Pixel(90);
                RadGrid1.MasterTableView.GetColumn("State").HeaderStyle.Width = Unit.Pixel(30);
                RadGrid1.MasterTableView.GetColumn("Zip").HeaderStyle.Width = Unit.Pixel(65);
                RadGrid1.MasterTableView.GetColumn("DateAdded").HeaderStyle.Width = Unit.Pixel(60);
                RadGrid1.MasterTableView.GetColumn("MailDate").HeaderStyle.Width = Unit.Pixel(150);
                RadGrid1.MasterTableView.GetColumn("CompanyId").HeaderStyle.Width = Unit.Pixel(35);
                RadGrid1.MasterTableView.GetColumn("MailingNumber").HeaderStyle.Width = Unit.Pixel(35);
                RadGrid1.ExportSettings.ExportOnlyData = false;

                //re-hide the extra fields
                RadGrid1.MasterTableView.Columns.FindByDataField("PhoneNumber").Visible = false;
                RadGrid1.MasterTableView.Columns.FindByDataField("WorkPhone").Visible = false;
                RadGrid1.MasterTableView.Columns.FindByDataField("MobilePhone").Visible = false;
                RadGrid1.MasterTableView.Columns.FindByDataField("Email").Visible = false;
            }
        }

        
    }

    protected void RadGrid1_ExcelMLExportRowCreated(object source, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs e)
    {
        if (e.RowType == Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowType.DataRow)
        {
            if (e.Row.Cells[0] != null && ((string)e.Row.Cells[0].Data.DataItem).Contains("U"))
            {
                e.Row.Cells[0].StyleValue = "MyCustomStyle";
            }
        }
    }


    protected void RadGrid1_ExcelMLExportStylesCreated(object source, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLStyleCreatedArgs e)
    {
        foreach (Telerik.Web.UI.GridExcelBuilder.StyleElement style in e.Styles)
        {
            if (style.Id == "headerStyle")
            {
                style.FontStyle.Bold = true;
                style.FontStyle.Color = System.Drawing.Color.Gainsboro;
                style.InteriorStyle.Color = System.Drawing.Color.Wheat;
                style.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.InteriorPatternType.Solid;
            }
            else if (style.Id == "itemStyle")
            {
                style.InteriorStyle.Color = System.Drawing.Color.WhiteSmoke;
                style.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.InteriorPatternType.Solid;
            }
            else if (style.Id == "alternatingItemStyle")
            {
                style.InteriorStyle.Color = System.Drawing.Color.LightGray;
                style.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.InteriorPatternType.Solid;
            }
        }

        Telerik.Web.UI.GridExcelBuilder.StyleElement myStyle = new Telerik.Web.UI.GridExcelBuilder.StyleElement("MyCustomStyle");
        myStyle.FontStyle.Bold = true;
        myStyle.FontStyle.Italic = true;
        myStyle.InteriorStyle.Color = System.Drawing.Color.Gray;
        myStyle.InteriorStyle.Pattern = Telerik.Web.UI.GridExcelBuilder.InteriorPatternType.Solid;
        e.Styles.Add(myStyle);
    }

    public void ConfigureExport()
    {
        RadGrid1.Width = Unit.Pixel(3000);
        RadGrid1.ExportSettings.ExportOnlyData = true;
        RadGrid1.ExportSettings.IgnorePaging = true;
        RadGrid1.ExportSettings.OpenInNewWindow = true;
        RadGrid1.ExportSettings.FileName = "LeadTracker Leads";
        RadGrid1.ExportSettings.Pdf.PageHeight = Unit.Parse("210mm");
        RadGrid1.ExportSettings.Pdf.PageWidth = Unit.Parse("297mm");
        RadGrid1.GridLines = GridLines.Both;

        RadGrid1.MasterTableView.Columns.FindByUniqueName("ReadIcon").Visible = false;

        if (Request.QueryString["cid"] != null)
        {
            RadGrid1.MasterTableView.Columns.FindByDataField("PhoneNumber").Visible = true;
            RadGrid1.MasterTableView.Columns.FindByDataField("WorkPhone").Visible = true;
            RadGrid1.MasterTableView.Columns.FindByDataField("MobilePhone").Visible = true;
            RadGrid1.MasterTableView.Columns.FindByDataField("Email").Visible = true;
        }
    }

   
   
The User Control

<style>
    .savenow{
        background-color:Red;color:White;width:100px;
            margin-top:10px;margin-left:10px;
    }
    .leftcollabel
    {
        width: 100px;
        text-align: right;
        vertical-align: top;
    }
    .leftcoldata
    {
        width: 250px;
    }
    .rightcollabel
    {
        width: 100px;
        vertical-align: top;
    }
    .rightcoldata
    {
        width: 250px;
        text-align: left;
    }
    .colspacer
    {
        width: 30px;
        margin-left: 100px;
    }
    #shablam
    {
        border:solid 1px #dfe9f5;
    }
</style>

        <telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">

            <script type="text/javascript">
                function InfoChanged(sender, eventArgs) {
                    //alert('hi');
                    $('.saveLeadInfoButton').removeClass('saveLeadInfoButton')
                        .addClass('savenow');
                }

                function onButtonClicked(sender, args) {
                    var button = args.get_item();
                    if (button.get_text() == 'Print Card Only') {
                        window.open('/secure/client/scan/<%=ClientNumber %>/<%=CampaignId %>/<%=ResponseId %>.jpg', 'mywindow');                    
                    }
                    else {
                        window.open('PrintLead.aspx?clid=<%=ClientNumber %>&caid=<%=CampaignId %>&rid=<%=ResponseId %>', 'mywindow');
                    }
                }

                function OnClientClicked(sender, eventArgs) {
                    sender.set_text("Please wait...");
                }


//                function FieldChanged(sender) {
//                    //toolbar = $find('<%=saveButton.ClientID %>');
//                    //toolbar.parent().css('background-color', 'red');
//                    
//                    $("#<%=saveButton.ClientID %>").Parent().css("border","3px solid red");
//                    //sender.className = "modifiedfield";
//                }
            </script>
        </telerik:RadScriptBlock>

<div id="shablam" style="min-height:300px;">
<asp:Panel ID="wholePage" runat="server">

<telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1" Style="padding-top:4px;padding-left:10px;" SelectedIndex="0" BorderColor="Black"  BackColor="#D8EEF3">
    <Tabs>
        <telerik:RadTab runat="server" Text="Lead Info" />
        <telerik:RadTab runat="server" Text="Details" />
        <telerik:RadTab runat="server" Text="Follow Up" />
        <telerik:RadTab runat="server" Text="Sale Details" />
    </Tabs>
</telerik:RadTabStrip>
<telerik:RadButton OnClick="SaveLeadInfo" ID="saveButton" Text="Save Changes" runat="server" CssClass="saveLeadInfoButton"  />
<div style="float:right;">
    <telerik:RadButton OnClick="MarkAsNew" ID="markAsNew" Text="Mark As New" runat="server" OnClientClicked="OnClientClicked"  />
</div>
<asp:HyperLink runat="server" ID="_reassignLeadLink" CssClass="reassignLink" Text="Reassign This Lead" Visible="false" />

<div class="multiPage_wrapper">
    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">
        <telerik:RadPageView ID="RadPageView1" runat="server" CssClass="tabpage">

            <table border="0" width="900px">
                <tr>
                    <td class="leftcollabel" align="right">
                        <a style="border:solid 1px red;background-color:Yellow;padding:3px;cursor:pointer;" class="nav_down" id="nav_down" >View Card</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  Name:
                    </td>
                    <td class="leftcoldata">
                        <telerik:RadTextBox runat="server" ID="_txtName" Width="200" />
                        <asp:HiddenField ID="_ResponseId" runat="server" />
                    </td>
                    <td class="colspacer">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td class="rightcollabel" align="right">
                        Status:
                    </td>
                    <td class="rightcoldata">
                        <asp:DropDownList runat="server" ID="_statusListbox">
                            <asp:ListItem Value="1" Text="New Lead" />
                            <asp:ListItem Value="2" Text="Good Prospect" />
                            <asp:ListItem Value="3" Text="Appointment Made" />
                            <asp:ListItem Value="4" Text="Application Submitted" />
                            <asp:ListItem Value="10" Text="Working" />
                            <asp:ListItem Value="5" Text="Closed/Sold" />
                            <asp:ListItem Value="6" Text="Not Interested" />
                            <asp:ListItem Value="7" Text="Not Qualified (Financial)" />
                            <asp:ListItem Value="8" Text="Not Qualified (Health)" />
                            <asp:ListItem Value="9" Text="Existing Client" />
                        </asp:DropDownList>
                        <asp:CheckBox runat="server" ID="_existingClient" /> Existing Client
                    </td>
                </tr>
                <tr>
                    <td class="leftcollabel" align="right">
                        Address1:
                    </td>
                    <td class="leftcoldata">
                        <telerik:RadTextBox runat="server" ID="_txtAddress1" Width="200" ClientEvents-OnValueChanged="InfoChanged" />
                    </td>
                    <td class="colspacer">
                    </td>
                    <td class="rightcollabel" align="right">
                        Email:
                    </td>
                    <td class="rightcoldata">
                        <telerik:RadTextBox runat="server" ID="_email" Width="200" />
                    </td>
                </tr>
                <tr>
                    <td class="leftcollabel" align="right">
                        Address2:
                    </td>
                    <td class="leftcoldata">
                        <telerik:RadTextBox runat="server" ID="_txtAddress2" Width="200" />
                    </td>
                    <td class="colspacer">
                    </td>
                    <td class="rightcollabel" align="right">
                        Home Phone:
                    </td>
                    <td class="rightcoldata">
                        <telerik:RadTextBox runat="server" ID="_homePhone" Width="200" />
                    </td>
                </tr>
                <tr>
                    <td class="leftcollabel" valign="top" align="right">
                        City/ST/Zip:
                    </td>
                    <td class="leftcoldata" valign="top">
                        <telerik:RadTextBox runat="server" ID="_City" Width="130" />
                        <telerik:RadTextBox Width="20" runat="server" ID="_State" />
                        <telerik:RadTextBox runat="server" ID="_Zip" Width="50" />
                    </td>
                    <td class="colspacer">
                    </td>
                    <td class="rightcollabel" valign="top" align="right">
                        Work Phone:
                    </td>
                    <td class="rightcoldata">
                         <telerik:RadTextBox runat="server" ID="_workPhone" Width="200" />
                    </td>
                </tr>
                <tr>
                    <td class="leftcollabel" valign="top" align="right">
                        Maps:
                    </td>
                    <td class="leftcoldata" valign="top">
                        <a runat="server" id="_googleMapLink" target="_blank"><img alt="Google Map" id="Img1" runat="server" src="~/images/googleMapsIcon.jpg" border="0" /></a>&nbsp;&nbsp;
                        <telerik:RadToolTip ID="RadToolTip1" Position="TopCenter" Skin="Windows7" runat="server" Text="Google Maps" TargetControlID="_googleMapLink" />
                        <a runat="server" id="_yahooMapLink" target="_blank"><img alt="Yahoo Map" id="Img2" runat="server" src="~/images/YahooMapsIcon.gif" border="0" /></a>&nbsp;
                        <telerik:RadToolTip ID="RadToolTip2" Position="TopCenter" Skin="Windows7" runat="server" Text="Yahoo Maps" TargetControlID="_yahooMapLink" />
                        <a runat="server" id="_mapquestLink" target="_blank"><img alt="Mapquest Map" id="Img3" runat="server" src="~/images/MapquestIcon.gif" border="0" /></a>
                        <telerik:RadToolTip ID="RadToolTip3" Position="TopCenter" Skin="Windows7" runat="server" Text="Mapquest Map" TargetControlID="_mapquestLink" />
                        

                    </td>
                    <td class="colspacer">
                    </td>
                    <td class="rightcollabel" valign="top" align="right">
                        Mobile Phone:
                    </td>
                    <td class="rightcoldata">
                        <telerik:RadTextBox runat="server" ID="_mobilePhone" Width="200" />
                    </td>
                </tr>              
                                <tr>
                    <td class="leftcollabel" valign="top" align="right">
                        Neighborhood&nbsp;Leads:
                    </td>
                    <td class="leftcoldata" valign="top">
                        <a runat="server" id="_neighborhoodLink"><img alt="Neighborhood Program" id="Img4" runat="server" src="~/images/icon_people.png" border="0" /></a>
                        <telerik:RadToolTip ID="RadToolTip4" Position="TopCenter" Skin="Windows7" runat="server" Text="Neighborhood Program" TargetControlID="_neighborhoodLink" />
                        <asp:Literal runat=server ID="NPNotAvailable" />
                    </td>
                    <td class="colspacer">
                    </td>
                    <td class="rightcollabel" valign="top" align="right">

                    </td>
                    <td class="rightcoldata">

                    </td>
                </tr>

            </table>
                      <asp:Panel runat="server" ID="Panel2" GroupingText="Notes" CssClass="noteslist" ScrollBars="Vertical" Height="160px">
                            <asp:Repeater runat="server" ID="_notesRepeater" OnItemCommand="DeleteNote" >
                                <ItemTemplate>
                                    <div class="note">
                                        <div class="notepad-01"></div>
                                        <div class="notepad-02">
                                            <div class="notetext">
                                                <b><%# ((DateTime)DataBinder.Eval(Container.DataItem, "StartDate")).ToString("MMMM d, yyyy, h:mm tt")%></b>
                                                <div style="float:right;padding-right:14px;">
                         <asp:LinkButton ID="_deleteNote" runat="server" Text="" CommandName="ID"
            ToolTip="Delete item" OnClientClick="if (!confirm('Are you sure you want to delete this note?')) { return false; };">
            
            <asp:Image ID="imgDelete" runat="server" ImageUrl="~/images/deleteIcon.gif" AlternateText="Delete Item" />
                         </asp:LinkButton>
                          </div>
                                                <br />
                                                <%# ((string)DataBinder.Eval(Container.DataItem, "EventNotes")).Replace("\n", "<br />") %>
                                                <asp:HiddenField ID="_noteId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "EventId") %>' />
                                            </div>
                                        </div>
                                        <div class="notepad-03"></div>
                                    </div>
                                </ItemTemplate>
                            </asp:Repeater>
                            <asp:Label runat="server" ID="_noNotesLabel" Visible="false" Text="No notes yet"></asp:Label>
                        </asp:Panel>
                        <asp:Panel runat="server" ID="Panel1" GroupingText="Add a note" Width="270px" Height="160px">
                            Note:
                            <telerik:RadTextBox TextMode="MultiLine" runat="server" Rows="6" Width="240px" MaxLength="1000" ID="_NoteText">
                            </telerik:RadTextBox><br />
                            <div style="text-align:right;">
                            <input type="button" id="btnAddNote" runat="server" value=" Add Note " onserverclick="AddNote" onclick="this.disabled=true;this.value='Adding Note';">
                        </asp:Panel>
                        <br />
            <telerik:RadToolBar runat="server" ID="RadToolBar1" CssClass="inbox-search-toolbar"
                OnClientButtonClicked="onButtonClicked" EnableViewState="false">
                <Items>
                    <telerik:RadToolBarDropDown ImageUrl="~/Images/print.gif" Text="Print">
                        <Buttons>
                            <telerik:RadToolBarButton Text="Print Card Only" id="shizz" CommandArgument="cardonly" Enabled="true" />
                            <telerik:RadToolBarButton Text="Print Card and Notes" id="zam" CommandArgument="cardandnotes" Enabled="true" />
                        </Buttons>
                    </telerik:RadToolBarDropDown>
                </Items>
            </telerik:RadToolBar>
            
            <telerik:RadSplitter runat="server" ID="RadSplitter1" Width="100%" BorderSize="0"
                BorderStyle="None" PanesBorderSize="0" Height="100%" Orientation="Horizontal">
            </telerik:RadSplitter>
            <img src="" runat="server" id="leadImage" /><br />
            <br />
            <div style="padding-left:300px;">
                        <a style="border:solid 1px red;background-color:Yellow;padding:3px;cursor:pointer;" class="nav_up" id="nav_up">Back to Top</a>
            </div><br />
        </telerik:RadPageView>
        <telerik:RadPageView runat="server" id="RadPageViewCRMTemplate" CssClass="tabpage">
            <div style="float:left;padding-right:80px">
                    <table>
                        <tr>
                            <td class="leftcollabel" valign="top" align="right">
                                Birthday:
                            </td>
                            <td class="leftcoldata" valign="top">
                                Month:<telerik:RadTextBox runat="server" ID="_birthdayMonth" Width="20" />
                                Day:<telerik:RadTextBox runat="server" ID="_birthdayDay" Width="20" />
                                Year:<telerik:RadTextBox Width="40" runat="server" ID="_birthdayYear" />
                            </td>
                        </tr><tr>
                        </td>
                        <td class="rightcollabel" valign="top" align="right">
                            Height:
                        </td>
                        <td class="rightcoldata">
                             <telerik:RadTextBox runat="server" ID="_height" Width="30" />
                             Weight:<telerik:RadTextBox runat="server" ID="_weight" Width="30" />
                        </td>
                    </tr>
                    <tr>
                        <td class="leftcollabel" valign="top" align="right">
                            Spouse:
                        </td>
                        <td class="leftcoldata" valign="top">
                            <telerik:RadTextBox runat="server" ID="_spouse" Width="200" />
                        </td>
                    </tr>
                    <tr>
                        <td class="rightcollabel" valign="top" align="right">
                            Children:
                        </td>
                        <td class="rightcoldata">
                             <telerik:RadTextBox runat="server" ID="_children" Width="200" />
                        </td>
                    </tr>                
                    <tr>
                        <td class="rightcollabel" valign="top" align="right">
                            Employer:
                        </td>
                        <td class="rightcoldata">
                             <telerik:RadTextBox runat="server" ID="_employer" Width="200" />
                        </td>
                    </tr>       
                </table>
            </div>
            
            <div style="">     
                <asp:Panel runat="server" ID="CRMTemplatePanel">
                </asp:Panel>
              </div>
      </telerik:RadPageView>
        <telerik:RadPageView ID="RadPageView2" runat="server" CssClass="tabpage">
            <table width="900px">
                <tr>
                    <td width="500px;" valign="top">
                        Called Back: <telerik:RadDatePicker runat="server" ID="_calledBackDate" /> <a href"#">today</a>
                        <br />
                        Appointment Made: <telerik:RadDatePicker runat="server" ID="_appointmentMadeDate" /> <a href"#">today</a>
                        <br />
                        App Submitted:<telerik:RadDatePicker runat="server" ID="_applicationSubmittedDate" /> <a href"#">today</a>
                        <br />
                        Policy Info Entered: <telerik:RadDatePicker runat="server" ID="_policyInfoEnteredDate" /> <a href"#">today</a>
                        <br />
                        App Rejected: <telerik:RadDatePicker runat="server" ID="_appRejectedDate" /> <a href"#">today</a>
                        <br />
                    </td>
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td valign="top">
                        <asp:Panel runat="server" ID="AppointmentAddPanel" GroupingText="Add an appointment">
                            Appointment Title: <telerik:RadTextBox Width="400px" runat="server" ID="_AppointmentTitle" /><br />
                            Contact On: <telerik:RadDateTimePicker ID="_appointmentDateTime" runat="server">
                            </telerik:RadDateTimePicker>
                            <br />
                            <telerik:RadTextBox TextMode="MultiLine" runat="server" Rows="5" Width="400px" ID="_AppointmentNotes" >
                            </telerik:RadTextBox><br />
                            <input type="button" id="Button2" runat="server" value=" Add Appointment " onserverclick="AddAppointment" onclick="this.disabled=true;this.value='Adding Appointment';">
                        </asp:Panel>
                            <br />
                        <asp:Panel runat="server" ID="AppointmentsListPanel" GroupingText="Upcoming Appointments">
                            <asp:Repeater runat="server" ID="_eventsRepeater" OnItemCommand="DeleteAppointment"  >
                                <ItemTemplate>
                                    <%# ((DateTime)DataBinder.Eval(Container.DataItem, "StartDate")).ToString("dddd, dd MMMM yyyy hh:mm tt") %> - <%# DataBinder.Eval(Container.DataItem, "EventTitle") %>
                                    
                                    
                                <asp:LinkButton ID="_deleteAppt" runat="server" Text="" CommandName="ID"
            ToolTip="Delete item" OnClientClick="if (!confirm('Are you sure you want to delete this appointment?')) { return false; };">
            
                                    <asp:Image ID="_imgDeleteAppt" runat="server" ImageUrl="~/images/deleteIcon.gif" AlternateText="Delete Appointment" />
                                </asp:LinkButton>                                    
                                    <asp:HiddenField ID="_eventId" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "EventId") %>' />
                                    <br />
                                </ItemTemplate>
                            </asp:Repeater>
                        </asp:Panel>
                    </td>
                </tr>
            </table>
        </telerik:RadPageView>
        <telerik:RadPageView ID="RadPageView3" runat="server" CssClass="tabpage">
            <table width="600px" padding="10px;">
                <tr>
                    <td align="right">
                        Sold Date:
                    </td>
                    <td>
                        <telerik:RadDatePicker ID="_soldDate" runat="server">
                        </telerik:RadDatePicker>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        X-Date:
                    </td>
                    <td>
                        <telerik:RadDatePicker ID="_xDate" runat="server">
                        </telerik:RadDatePicker>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Commission:
                    </td>
                    <td>
                        $<telerik:RadTextBox ID="_commission" runat="server">
                        </telerik:RadTextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Sold/Placed:
                    </td>
                    <td>
                        <telerik:RadTextBox runat="server" ID="_soldPlaced" EmptyMessage="Carrier Name/Policy Specifics" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <telerik:RadTextBox ID="_saleNotes" TextMode="MultiLine" runat="server" Rows="5"
                            Width="400px" EmptyMessage="Enter notes about the sale">
                        </telerik:RadTextBox><br />
                    </td>
                </tr>
            </table>
        </telerik:RadPageView>
    </telerik:RadMultiPage>
</div>
</asp:Panel>

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
        <Windows>
            <telerik:RadWindow ID="RadWindow1" runat="server" ShowContentDuringLoad="false" Width="400px"
                Height="300px" Title="Select an agent" Behaviors="Close,Reload" Modal="true">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
            
    <script type="text/javascript">
        //<![CDATA[
        function openRadWin(agentid) {
            radopen("SelectAgent.aspx?id=" + agentid, "RadWindow1");
        }
        //]]>                                                                        
    </script>

    <asp:Panel runat="server" ID="_agentSelectPanel" Visible="false">
        <button style="width: 150px; margin-bottom: 3px;" onclick="openRadWin('<asp:Literal runat='server' id='theAgentId' />'); return false;">
            Select Agents</button>
    </asp:Panel>
    
    
</div>

        <script>
            $(function() {
                var $elem = $('#wrapper');

                $(window).bind('scrollstart', function() {
                    $('#nav_up,#nav_down').stop().animate({ 'opacity': '0.2' });
                });
                $(window).bind('scrollstop', function() {
                    $('#nav_up,#nav_down').stop().animate({ 'opacity': '1' });
                });

                $('#nav_down').click(
                    function(e) {
                        $('html, body').animate({ scrollTop: $elem.height() }, 2000);
                    }
                );
                $('#nav_up').click(
                    function(e) {
                        $('html, body').animate({ scrollTop: '0px' }, 800);
                    }
                );
            });
        </script>



public partial class secure_controls_messages_LeadView : System.Web.UI.UserControl
{
   
    public int ResponseId
    {
        get
        {
            if (ViewState["ResponseId"] != null) return (int)ViewState["ResponseId"];
            else return 0;
        }
        set { ViewState["ResponseId"] = value; }
    }

    public int ListId
    {
        get
        {
            if (ViewState["ListId"] != null) return (int)ViewState["ListId"];
            else return 0;
        }
        set { ViewState["ListId"] = value; }
    }

    public int CampaignId
    {
        get
        {
            if (ViewState["CampaignId"] != null) return (int)ViewState["CampaignId"];
            else return 0;
        }
        set { ViewState["CampaignId"] = value; }
    }

    public int CompanyId
    {
        get
        {
            if (ViewState["CompanyId"] != null) return (int)ViewState["CompanyId"];
            else return 0;
        }
        set { ViewState["CompanyId"] = value; }
    }

    public string ClientNumber
    {
        get
        {
            if (ViewState["ClientNumber"] != null) return (string)ViewState["ClientNumber"];
            else return "";
        }
        set { ViewState["ClientNumber"] = value; }
    }

    public int CRMTemplateId
    {
        get
        {
            if (ViewState["CRMTemplateId"] != null) return (int)ViewState["CRMTemplateId"];
            else return 0;
        }
        set { ViewState["CRMTemplateId"] = value; }
    }

    public bool EnableCRM
    {
        get
        {
            if (ViewState["EnableCRM"] != null) return (bool)ViewState["EnableCRM"];
            else return true;
        }
        set { ViewState["EnableCRM"] = value; }
    }

    public bool EnableNeighborhoodProgram
    {
        get
        {
            if (ViewState["EnableNeighborhoodProgram"] != null) return (bool)ViewState["EnableNeighborhoodProgram"];
            else return false;
        }
        set { ViewState["EnableNeighborhoodProgram"] = value; }
    }

    protected int _responseId;
    protected int _listId;
    protected int _useAgentId;

    private KramerEntities KE = new KramerEntities();
    private CRMLead lead;

    protected void Page_PreRender(object sender, EventArgs e)
    {
        //check security
        if (ListId != 0)
        {
            setAgentId();

            //record history
            if (Session["CurrentAgentId"] == null) Response.Redirect("~/");
            int agentId = (int) Session["CurrentAgentId"];
            string historySQL =
                string.Format(
                    "INSERT INTO [ViewHistory] ([AgentId],[CampaignResponseId]) VALUES ({0},{1})",
                    agentId, ResponseId);
            int rowsAffected;
            KE.ExecuteNonQuery(historySQL, out rowsAffected);

            wholePage.Visible = true;
            lead = new CRMLead().GetLead(ListId, _markAsRead);

            _ResponseId.Value = ResponseId.ToString();
            PopulateLeadInfo();

            string GoogleMaplink = string.Format("http://maps.google.com/maps?q={0},+{1},+{2}&z=16", lead.LeadListData.Address1,
                                           lead.LeadListData.City, lead.LeadListData.St);
            string MapquestMaplink =
                string.Format("http://www.mapquest.com/maps?city={1}&state={2}&address={0}&zipcode={3}&country=US",
                              lead.LeadListData.Address1,
                              lead.LeadListData.City, lead.LeadListData.St, lead.LeadListData.ZIP);
            string YahooMaplink = string.Format("http://maps.yahoo.com/#mvt=m&zoom=17&q1={0}%2C%20{1}%2C%20{2}%2C {3}",
                              lead.LeadListData.Address1,
                              lead.LeadListData.City, lead.LeadListData.St, lead.LeadListData.ZIP);

            bool showNeighborhoodLink = EnableNeighborhoodProgram;
            //check to see if this is a PO Box
            if (lead.LeadResponse.Address1.ToLower().Contains("po box") || lead.LeadListData.Long == null) showNeighborhoodLink = false;
            string NeighborhoodLink = "";
            if (showNeighborhoodLink)
            {
                NeighborhoodLink = string.Format("~/secure/client/Map.aspx?id={0}", lead.LeadListData.ListDataId);
                _neighborhoodLink.HRef = NeighborhoodLink;
                NPNotAvailable.Visible = false;
                _neighborhoodLink.Visible = true;
            }
            else if (lead.LeadResponse.Address1.ToLower().Contains("po box"))
            {
                _neighborhoodLink.Visible = false;
                NPNotAvailable.Text = "<span style='color:#555555;'>Not available for PO Boxes.</span>";
            }
            else if (lead.LeadListData.Long == null)
            {
                _neighborhoodLink.Visible = false;
                NPNotAvailable.Text = "<span style='color:#555555;'>Geocode data not available for this lead.</span>";
            }
            else
            {
                _neighborhoodLink.Visible = false;
                NPNotAvailable.Text = "<span style='color:#555555;'>Please contact your Marketing Director at <br>888-572-6373 to enable the Neighborhood Program.</span>";
            }

            _googleMapLink.HRef = GoogleMaplink;
            _mapquestLink.HRef = MapquestMaplink;
            _yahooMapLink.HRef = YahooMaplink;

            //companyId/campaignId/responseId
            leadImage.Src = string.Format("http://leadtracker.kramerdirect.com/secure/client/scan/{0}/{1}/{2}.jpg", ClientNumber, CampaignId, ResponseId);

            //enable CRM if needed
            _txtName.Enabled = EnableCRM;

            showAppointments();
            ShowNotes();
        }
        else
        {
           // wholePage.Visible = false; KAushik Commented
            wholePage.Visible = true; //KAushik Added
        }
    }

    private void setAgentId()
    {
        if (Session["CurrentAgentId"] == null) Response.Redirect("~/");
        int agentId = (int)Session["CurrentAgentId"];

        if (Request.Cookies["KramerRole"].Value == "manager")
        {
            //TODO: finish this
            //_reassignLeadLink.Visible = true;
            //_reassignLeadLink.NavigateUrl = "javascript:openRadWin(" + Session["CurrentAgentId"] + ");";

            //get the campaigns agent
            if (_useAgentId == 0)
                _useAgentId = Manager.GetCampaignAgent(CampaignId);
        }
        else
        {
            _useAgentId = agentId;
        }

    }

    protected  void Page_Load(object sender, EventArgs e)
    {
        
    }

  
   

    //protected void Page_Load(object sender, EventArgs e)
    //{
    //    Button MyButton = (Button)Page.FindControl("AddAppointmentButton");
    //    Panel MyPanel = (Panel)Page.FindControl("AppointmentsListPanel");
    //    RadAjaxManager myAjax = (RadAjaxManager) Page.Master.FindControl("RadAjaxManager1");
    //    myAjax.AjaxSettings.AddAjaxSetting(MyButton, MyPanel);

    //}


    protected void AddAppointment(object sender, EventArgs e)
    {
        setAgentId();
        int agentId = _useAgentId;
        DateTime appointmentTime = (DateTime)_appointmentDateTime.DbSelectedDate;
        EventManager.AddNewEvent(agentId, agentId, _AppointmentTitle.Text.Trim(), _AppointmentNotes.Text.Trim(), appointmentTime, appointmentTime.AddHours(1), int.Parse(_ResponseId.Value), (int)EventManager.EventTypes.ResponseFollowUp);
        showAppointments();
    }

    protected void showAppointments()
    {
        setAgentId();
        int agentId = _useAgentId;
        var theEvents = EventManager.GetEvents(agentId, int.Parse(_ResponseId.Value), DateTime.Now);
        _eventsRepeater.DataSource = theEvents;
        _AppointmentTitle.Text = "";
        _AppointmentNotes.Text = "";
        _appointmentDateTime.Clear();
        _eventsRepeater.DataBind();
    }

    protected void DeleteAppointment(object source, RepeaterCommandEventArgs e)
    {
               if (e.CommandName == "ID")
               {
                   string eventId = ((HiddenField) e.Item.FindControl("_eventId")).Value;
                   EventManager.DeleteEvent(int.Parse(eventId));
                   showAppointments();
               }
    }

    /*******
     *Notes*
     *******/

    protected void AddNote(object sender, EventArgs e)
    {
        setAgentId();
        int agentId = _useAgentId;
        DateTime noteTime = DateTime.Now;
        Log.Debug(string.Format("Note text is: '{0}'", _NoteText.Text));
        Log.Debug(string.Format("Adding new Note via EventManager.AddNewEvent: AgentId = '{0}', Title = 'Note', Notes = '{1}'", agentId, _NoteText.Text.Trim()));
        EventManager.AddNewEvent(agentId, agentId, "Note", _NoteText.Text.Trim(), noteTime, noteTime, int.Parse(_ResponseId.Value), (int)EventManager.EventTypes.ResponseNote);
        _NoteText.Text = "";
        ShowNotes();
    }

    protected void ShowNotes()
    {
        setAgentId();
        int agentId = _useAgentId;
        var theNotes = EventManager.GetNotes(agentId, int.Parse(_ResponseId.Value));
        if (theNotes.Count == 0) _noNotesLabel.Visible = true; else _noNotesLabel.Visible = false;
        _notesRepeater.DataSource = theNotes;
        _NoteText.Text = "";
        _notesRepeater.DataBind();
    }

    protected void DeleteNote(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "ID")
        {
            string noteId = ((HiddenField)e.Item.FindControl("_noteId")).Value;
            EventManager.DeleteEvent(int.Parse(noteId));
            ShowNotes();
        }
    }

    protected void SaveLeadInfo(object sender, EventArgs e)
    {
        LeadEntities LE = new LeadEntities();
        bool isNew = false;

        Leads leaddata = (from x in LE.Leads
                       where x.ListDataId == ListId
                       select x).FirstOrDefault();

        if (leaddata == null)
        {
            leaddata = new Leads();
            leaddata.ListDataId = ListId;
            leaddata.DateAdded = DateTime.Now;
            isNew = true;
            
        }

        //get lead info
        leaddata.FirstName = _txtName.Text.Trim();
        leaddata.LastModifiedDate = DateTime.Now;
        leaddata.Address1 = _txtAddress1.Text.Trim();
        leaddata.Address2 = _txtAddress2.Text.Trim();
        leaddata.City = _City.Text.Trim();
        leaddata.State = _State.Text.Trim();
        leaddata.Zip = _Zip.Text.Trim();
        leaddata.Status = int.Parse(_statusListbox.SelectedValue);
        leaddata.Sold = _existingClient.Checked;
        leaddata.Email = _email.Text.Trim();
        leaddata.HomePhone = _homePhone.Text.Trim();
        leaddata.WorkPhone = _workPhone.Text.Trim();
        leaddata.MobilePhone = _mobilePhone.Text.Trim();

        int testInt;
        DateTime testDate;
        if (DateTime.TryParse(_birthdayMonth.Text.Trim() + "-" + _birthdayDay.Text.Trim() + "-" + _birthdayYear.Text.Trim(),out testDate))
            leaddata.Birthday = testDate;
        leaddata.Height = _height.Text.Trim();
        if (int.TryParse(_weight.Text.Trim(),out testInt)) leaddata.Weight = int.Parse(_weight.Text.Trim());
        leaddata.Spouse = _spouse.Text.Trim();
        leaddata.Children = _children.Text.Trim();
        leaddata.Employer = _employer.Text.Trim();

        //****Follow Up tab****
        leaddata.CalledBackDate = _calledBackDate.IsEmpty
                                      ? (DateTime?) null
                                      : DateTime.Parse(_calledBackDate.DbSelectedDate.ToString());

        leaddata.AppointmentMadeDate = _appointmentMadeDate.IsEmpty
                                           ? (DateTime?) null
                                           : DateTime.Parse(_appointmentMadeDate.DbSelectedDate.ToString());

        leaddata.ApplicationSubmittedDate = _applicationSubmittedDate.IsEmpty
                                                ? (DateTime?) null
                                                : DateTime.Parse(_applicationSubmittedDate.DbSelectedDate.ToString());

        leaddata.PolicyEnteredDate = _policyInfoEnteredDate.IsEmpty
                                         ? (DateTime?) null
                                         : DateTime.Parse(_policyInfoEnteredDate.DbSelectedDate.ToString());

        leaddata.AppRejectedDate = _appRejectedDate.IsEmpty
                                       ? (DateTime?) null
                                       : DateTime.Parse(_appRejectedDate.DbSelectedDate.ToString());

        //****Sale Details tab****
        leaddata.SoldDate = _soldDate.IsEmpty
                                ? (DateTime?)null
                                : DateTime.Parse(_soldDate.DbSelectedDate.ToString());

        leaddata.XDate = _xDate.IsEmpty
                                ? (DateTime?)null
                                : DateTime.Parse(_xDate.DbSelectedDate.ToString());

        decimal testDec;
        if (decimal.TryParse(_commission.Text.Trim(),out testDec)) leaddata.Commission = testDec;

        leaddata.VendorName = _soldPlaced.Text.Trim();
        leaddata.SaleNotes = _saleNotes.Text.Trim();
         
        if (isNew)
        {
            LE.AddToLeads(leaddata);
            LE.SaveChanges();
        }
        else
        {
            LE.SaveChanges();
        }
    }

    protected void MarkAsNew(object sender, EventArgs e)
    {
        CampaignResponses campaignResponse = KE.CampaignResponses.FirstOrDefault(x => x.CampaignResponseId == ResponseId);
        if (null != campaignResponse)
        {
           
        }
    }
}   


Kaushik Saha
Top achievements
Rank 1
 asked on 24 Apr 2012
2 answers
89 views
hi ;
this sample
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx
RadComboBox2 CheckBoxes="True" no problem but
button_click RadComboBox2 checkeditemcount =0 why help me
salih
Top achievements
Rank 1
 answered on 24 Apr 2012
0 answers
145 views
Hi All,

I have a pecular problem. I have a RadGrid which has one detail table for each row. I am binding data for detail table in DetailTableDataBind event. In my local system expand and collapse is working fine.

But, when this code deployed to server, its showing + symbol but its not expanding. (Just saying "Loading..." in status bar but no effect).

Please help me out...what could be the issue...

Thanks & Regards,
Ramesh Sambari
Ramesh
Top achievements
Rank 1
 asked on 24 Apr 2012
1 answer
103 views

Let me start explaining the enverirement, I have a contantpage that holds a grid with columns (template that holds a hyperlink) that opens up a radWindow.
(content page relevent code)

    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow ID="winArticle" runat="server">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
 
<script type="text/javascript">
    function openRadWin(art) {
        window.radopen('articleDetails.aspx?art=' + art, 'winArticle');
    }
</script>
 
<telerik:RadGrid ID="grArticles" runat="server" CellSpacing="0" GridLines="None"
        EnableEmbeddedSkins="False" Skin="Levweb"
        onneeddatasource="grArticles_NeedDataSource" AutoGenerateColumns="False"
        ondetailtabledatabind="grArticles_DetailTableDataBind"
        onprerender="grArticles_PreRender"
        onitemdatabound="grArticles_ItemDataBound">
 
<MasterTableView DataKeyNames="as_artnr_6">
 
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn1 column" UniqueName="ExpandColumn1">
    <HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
 
<DetailTables>
    <telerik:GridTableView DataKeyNames="art_artnr" Name="ArtDetails" Width="100%" ShowHeader="False">
        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn SortExpression="art_artnr" HeaderText="art_artnr" HeaderButtonType="TextButton" DataField="art_artnr" Visible="false">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn SortExpression="text" HeaderText="text" HeaderButtonType="TextButton" DataField="text" UniqueName="text">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn SortExpression="art_ritning" HeaderText="art_ritning" HeaderButtonType="TextButton" DataField="art_ritning" UniqueName="art_ritning">
            </telerik:GridBoundColumn>
        </Columns>
    </telerik:GridTableView>
</DetailTables>
 
<Columns>
    <telerik:GridTemplateColumn SortExpression="as_artnr_6">
    <ItemTemplate>
        <asp:HyperLink ID="hlArtNr" Runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.as_artnr_6") %>'></asp:HyperLink>
    </ItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn SortExpression="ben_7">
    <ItemTemplate>
        <asp:HyperLink ID="hlArtBen" Runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.ben_7") %>'></asp:HyperLink>
    </ItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridDateTimeColumn DataField="levdat_3" DataFormatString="{0:yyyy-MM-dd}" FilterControlAltText="Filter column2 column" UniqueName="column2">
    </telerik:GridDateTimeColumn>
    <telerik:GridNumericColumn DataField="rest_antal_4" DecimalDigits="2" DataFormatString="{0:0.#}" FilterControlAltText="Filter column3 column" UniqueName="column3">
    </telerik:GridNumericColumn>
    <telerik:GridBoundColumn DataField="enhet_13" FilterControlAltText="Filter column4 column" UniqueName="column4">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="lev_artnr_10" FilterControlAltText="Filter column5 column" UniqueName="column5">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="ordernr_5" FilterControlAltText="Filter column6 column" UniqueName="column6">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="rad_status_20" FilterControlAltText="Filter column7 column" UniqueName="column7">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="hasChild" FilterControlAltText="Filter column7 column" UniqueName="hasChild" Visible="false">
    </telerik:GridBoundColumn>
</Columns>
 
</MasterTableView>
<ClientSettings>
    <Selecting AllowRowSelect="true" />
</ClientSettings>
</telerik:RadGrid>

protected void grArticles_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            HyperLink lbArtNr = (HyperLink)e.Item.Cells[3].FindControl("hlArtNr");
            HyperLink lbArtBen = (HyperLink)e.Item.Cells[5].FindControl("hlArtBen");
 
            lbArtNr.Attributes["href"] = "#";
            lbArtNr.Attributes["onclick"] = "openRadWin('" + ((HyperLink)e.Item.Cells[2].Controls[1]).Text + "');";
 
            lbArtBen.Attributes["href"] = "#";
            lbArtBen.Attributes["onclick"] = "openRadWin('" + ((HyperLink)e.Item.Cells[2].Controls[1]).Text + "');";
 
        }
    }


The Window opens up correctly, the window contains an aspx file that is pretty much emtpy except for holding a ascx file at the moment,
this is the code for the ascx.

<telerik:RadGrid ID="grArtPlan" runat="server" CellSpacing="0" GridLines="None"
        EnableEmbeddedSkins="False" Skin="Levweb"
        onneeddatasource="grArtPlan_NeedDataSource"
    AutoGenerateColumns="False">
 
<MasterTableView>
 
<Columns>
    <telerik:GridBoundColumn DataField="inlevdatum" FilterControlAltText="Filter column5 column" UniqueName="column5">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="ordernr" FilterControlAltText="Filter column5 column" UniqueName="column5">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="fsedel" FilterControlAltText="Filter column5 column" UniqueName="column5">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="levantal" FilterControlAltText="Filter column5 column" UniqueName="column5">
    </telerik:GridBoundColumn>
</Columns>
 
</MasterTableView>
 
</telerik:RadGrid>

protected void Page_Load(object sender, EventArgs e)
    {
        string art = Request.QueryString["art"];
    }
    protected void grArtPlan_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        LevWebService.SrvCoreClient service = new LevWebService.SrvCoreClient();
        DataTable dt = service.ListaLagerPlanBild(((LevWebService.SessUser)Session[common.userSession]).Id, Request.QueryString["art"]);
        grArtPlan.DataSource = dt;
    }

At this point i get all the relevent data into the datatable, but the rows generated looks empty (number of rows is drawn, but no data)
See atteched file for a screenshot of the problem. I also atteched a scrren of the data returned to the datatable that shows it has data.

Any ideas are welcome.

Regards

Maria Ilieva
Telerik team
 answered on 24 Apr 2012
1 answer
110 views
I'm not sure this can be done but figured I would post the question. 

For our application, we have a multi-dashboard solution with each dashboard having a set of floating docks (due to various sizes, etc).  This works well for most cases but recently we have had customers creating dashboards for 1920 x 1080 monitors. This would be fine if all user machines were 1920x1080 but with the use of tablets, laptops and various PCs this cannot be done.  So what I would like to do is create a display palette (zone) of 1920x1080 that would allow you to place floating docks on it.  Then on a small monitor, it would provide you scrollbars on the zone but on the full size 1920x1080 monitor it wouldn't.  Obviously this would work if we had docked controls but unfortunetly there are way to many control sizing factors preventing this. 

Has anyone done something like this or have suggestions on how this can be achieved.  Minimally I would be happy if a user with a low resolution monitor would at least get scrolls for a larger designed dashboard. 

I looked at the restricted zone example.  Here is an example and you notice the scroll doesn't work on the middle splitter section in association to the docks:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title>Test</title>
    <style type="text/css">
    html, body, form
    {   height:100%; margin:0px; padding:0px; overflow:hidden;  }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <telerik:RadSplitter ID="RadSplitter1" runat="server" Height="100%" Width="100%" Orientation="Horizontal">
        <telerik:RadPane ID="RadPane1" runat="server" Height="50" BackColor="Red">
            Top Pane
        </telerik:RadPane>
        <telerik:RadPane ID="RadPane2" runat="server" BackColor="Red">
            <div id="restrictionZone" style="border: solid 1px black; background-color:Green; width: 600px; height: 1200px;">
            Docks are only allowed here<br />
                <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
                    <telerik:RadDock ID="RadDock1" runat="server" Width="300px" OnClientDragEnd="OnClientDragEnd" Resizable="true" Top="55" Height="200">
                    </telerik:RadDock>
                </telerik:RadDockLayout>
            </div>
        </telerik:RadPane>
        <telerik:RadPane ID="RadPane3" runat="server" Height="50" BackColor="Red">
            Footer Pane
        </telerik:RadPane>
    </telerik:RadSplitter>
    </form>
    <script type="text/javascript">
        var restrictionZone = $get('restrictionZone');
        function OnClientDragEnd(dock) {
            var restrBounds = $telerik.getBounds(restrictionZone);
            var dockBounds = $telerik.getBounds(dock.get_element());
            var inBounds = Telerik.Web.UI.ResizeExtender.containsBounds(restrBounds, dockBounds);
            if (!inBounds) {
                if (dockBounds.x < restrBounds.x) {
                    dock.set_left(restrBounds.x);
                }
                else if (restrBounds.x + restrBounds.width < dockBounds.x + dockBounds.width) {
                    dock.set_left(restrBounds.x + restrBounds.width - dockBounds.width);
                }
                if (dockBounds.y < restrBounds.y) {
                    dock.set_top(restrBounds.y);
                }
                else if (restrBounds.y + restrBounds.height < dockBounds.y + dockBounds.height) {
                    dock.set_top(restrBounds.y + restrBounds.height - dockBounds.height);
                }
            }
        }
    </script>
</body>
</html>


Thanks in advanced,
Shane
Slav
Telerik team
 answered on 24 Apr 2012
5 answers
139 views
I am having trouble getting my item and header columns to align.  I have gotten to the point of trying to even set them all manually in the grid's preRender event but something is overriding it.

However, before I share some code I have a more immediate related question:  Is there some factor of your grid component that adjusts its rendering based on the presence of browser developer tools?  If I use the inspect feature of FF9 or flip on F12 in IE9 the grid immediately aligns itself correctly and remains that way after I turn the dev tools off.  This suggests to me that my alignment issue is not related to overriding CSS (which I doubt is at work here) but rather some aspect of the grid's java script.  Can you spread som light on this unusual issue?

Thanks,
Ed
Ed
Top achievements
Rank 1
 answered on 24 Apr 2012
1 answer
80 views
When in Design view, there is some extra space under the Editor, when I switch to HTML view, the space gets filled up. I have tried setting AutoResizeHeight to True, but the problem persists.
Rumen
Telerik team
 answered on 24 Apr 2012
3 answers
167 views
I've bumped up against an unexpected roadblock when trying to extract the entered HTML from a GridHTMLEditorColumn.

Briefly, I have something like this:

In the Grid:
<telerik:GridHTMLEditorColumn
    DataField="Content"
    HeaderText="Content"
    UniqueName="Content"
    Visible="false">
</telerik:GridHTMLEditorColumn>

Extracting the value:
var hashTable = new Hashtable();
 
using (var ownerTableView = e.Item.OwnerTableView)
{
    ownerTableView.ExtractValuesFromItem(hashTable, editedItem);
}

Then:
if (hashTable.ContainsKey("Content"))
{
    this.Content = hashTable["Content"].ToString();
}

Or:
var tableCell = editedItem["Content"];
 
if (tableCell != null)
{
    var radEditor = tableCell.Controls[0] as RadEditor;
 
    if (radEditor != null)
    {
        // At this point, all I have is string.Empty for radEditor.Content
        this.Content = string.IsNullOrEmpty(radEditor.Content) ? string.Empty : radEditor.Content;
    }
}

Nothing works. I can get hold of all my other bound column values. But I can't for the life of me work out how to get the HTML content.

Help!

Richard

Shinu
Top achievements
Rank 2
 answered on 24 Apr 2012
1 answer
101 views
Hi I have created a RadMenu dynamically on a Grid Pager the RadGrid has the following properties:-
<telerik:RadGrid ID="theGridView" runat="server"
   AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True" AllowAutomaticDeletes="True" CellSpacing="0"
   DataSourceID="theSqlDataSource" CssClass="gridview" Width="100%"
   AutoGenerateColumns="False" EnableHeaderContextFilterMenu="True"
   EnableHeaderContextMenu="True" ShowStatusBar="True" Skin="Windows7" ShowGroupPanel="true" GroupPanel-CssClass="hideGroupPanel" Culture="en-NZ"
   onitemdatabound="theGridView_ItemDataBound"
   OnItemCreated="theGridView_ItemCreated" onitemdeleted="theGridView_ItemDeleted">
   <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True">
      <Scrolling AllowScroll="True" UseStaticHeaders="True" />
      <Resizing AllowColumnResize="True" AllowResizeToFit="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="true" />
   </ClientSettings>
etc.
<PagerStyle AlwaysVisible="True" />
</MasterTableView>
<PagerStyle AlwaysVisible="True" />
<FilterMenu EnableImageSprites="True" />
</telerik:RadGrid>

The Menu is created using code in the RadGrid_ItemCreated event when the item is a GridPagerItem with the following code:-
RadMenu gridOptionsMenu = new RadMenu();
gridOptionsMenu.OnClientItemOpening = "GridMenuItemOpened";
gridOptionsMenu.ID = "gridOptionsMenu";
gridOptionsMenu.ExpandAnimation.Type = AnimationType.None;
RadMenuItem gridOptionMain = new RadMenuItem("Options");
RadMenuItem gridOptionTemplate = new RadMenuItem("");
gridOptionTemplate.Width = 300;
gridOptionMain.Items.Add(gridOptionTemplate);
gridOptionsMenu.Items.Add(gridOptionMain);
gridOptionsDiv.Controls.Add(gridOptionsMenu);
GridOptionsTemplate template = new GridOptionsTemplate();
foreach (RadMenuItem menuitem in gridOptionsMenu.GetAllItems())
{
   if (menuitem.Level > 0)
   {
      template.InstantiateIn(menuitem);
      template.SetValues(menuitem, theGridView.ClientID, theGridView.MasterTableView.IsFilterItemExpanded, false);
   }
}

the menu is shown when clicking the Options Menu item but is shown cut off as shown.

I have trued various css hacks and changing zIndex of various elements on the OnClientItemOpening in javascript but have got nowhere. What started out as a good idea and I thought reasonably easy to implement has turned into a few hours of frustration.

Please give me a hint on how to achieve this.




Kate
Telerik team
 answered on 24 Apr 2012
2 answers
190 views
Hello,

Need Help!I am using RadScheduler for displaying appointments.I have 2 Issues.

Issue 1 :
I am using DB2 database to display information for appointments.
I have a requirement to enable/disable button in each appointment based on database feild while the appointments are being loaded.
My Database field has either 'Y' or 'N'. If field is 'Y',disable the button.If field is 'N',enable the button on each appointment.
I added Button in Appointment Template along with other fields.

I referred this forum http://www.telerik.com/community/forums/aspnet-ajax/scheduler/i-wonder-if-it-is-not-available-in-rad-scheduler.aspx but couldn't helped me.

Code for the Reference:
<telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="CAETIME" DataKeyField="CAPPID"
                DataStartField="CASTIME" DataSubjectField="CAPVISIT" OnAppointmentCreated="RadScheduler1_AppointmentCreated"
                OnDataBound="RadScheduler1_DataBound" CustomAttributeNames="CACLIENT,CAAREP">
                <AppointmentTemplate>
                    <asp:Label ID="lblStart" runat="Server" Text='<%#Eval("Start")%>'></asp:Label>
                    <asp:Label ID="lblHyphen" runat="Server" Text='-'></asp:Label>
                    <asp:Label ID="lblEnd" runat="Server" Text='<%#Eval("End") %>'></asp:Label><br />
                    <b>Subject : </b>
                    <asp:Label ID="lblSub" runat="server" Text='<%#Eval("Subject")%>' /><br />
                    <b>Client : </b>
                    <asp:Label ID="lblClient" runat="Server" Text='<%#Eval("CACLIENT")%>'></asp:Label><br />
                    <asp:Button ID="Button1" runat="server" Text="Action Report" />
                </AppointmentTemplate>
            </telerik:RadScheduler>

Button1 should be disable/enable based on the field CAAREP(Action Report) which was include in CustomAttributeNames.

Issue 2:
My StartField and EndField are in DateTime format which are coming from database. I want to display only Time on Appointments.I tried the below way but it is displaying last appointment times on all the appointments.It is considering last appointment times.
public string stime, etime;
  DateTime dts, dte;
 
 using (DB2Command cmd = new DB2Command(viewAppT, conn))
           {
               cmd.CommandType = CommandType.Text;
               DB2DataAdapter adp = new DB2DataAdapter(cmd);
               DataSet dsAppt = new DataSet();
               adp.Fill(dsAppt);
               RadScheduler1.DataSource = dsAppt;
               DataView dv = dsAppt.Tables[0].DefaultView;
 
               RadScheduler1.DataSource = dv;
               RadScheduler1.DataBind();
               for (int i = 0; i < dv.Table.Rows.Count; i++)
               {
                   dts = Convert.ToDateTime(dv.Table.Rows[i]["CASTIME"]);
                   dte = Convert.ToDateTime(dv.Table.Rows[i]["CAETIME"]);
                   stime = dts.ToShortTimeString();
                   etime = dte.ToShortTimeString();
               }
                
                                            
               RadScheduler1.SelectedView = SchedulerViewType.MonthView;
               RadScheduler1.SelectedDate = Convert.ToDateTime(dv.Table.Rows[0]["CAETIME"]);
               RadScheduler1.Visible = true;
           }
<telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="CAETIME" DataKeyField="CAPPID"
               DataStartField="CASTIME" DataSubjectField="CAPVISIT" OnAppointmentCreated="RadScheduler1_AppointmentCreated"
               OnDataBound="RadScheduler1_DataBound" CustomAttributeNames="CACLIENT,CAAREP">
               <AppointmentTemplate>
                  <%-- <asp:Label ID="lblStart" runat="Server" Text='<%#Eval("Start")%>'></asp:Label>--%>
                   <asp:Label ID="Label1" runat="Server" Text='<%# stime %>'></asp:Label>
                   <asp:Label ID="lblHyphen" runat="Server" Text='-'></asp:Label>
                  <%-- <asp:Label ID="lblEnd" runat="Server" Text='<%#Eval("End") %>'></asp:Label><br />--%>
                     <asp:Label ID="Label2" runat="Server" Text='<%# etime %>'></asp:Label>
                   <b>Subject : </b>
                   <asp:Label ID="lblSub" runat="server" Text='<%#Eval("Subject")%>' /><br />
                   <b>Client : </b>
                   <asp:Label ID="lblClient" runat="Server" Text='<%#Eval("CACLIENT")%>'></asp:Label><br />
                   <asp:Button ID="Button1" runat="server" Text="Action Report" />
               </AppointmentTemplate>
           </telerik:RadScheduler>

Could someone Please provide me solution for this issue.

Many Thanks,
Sandhya.
Sandhya
Top achievements
Rank 1
 answered on 24 Apr 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?