Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
391 views
Hi,

I am using cascaded drop down and i have used RadAjaxManager to update the another dropdown, but i am getting the following error while using it :

Microsoft JScript runtime error: Unable to set value of the property 'control': object is null or undefined

Moreover, i have the dropdowns in ascx page and i am calling that ascx in aspx. if i take the dropdowns in aspx it works smoothly.

Help me out on this.

Thanks & Regards,
Dhaval Shukla
Eric
Top achievements
Rank 1
 answered on 19 Jul 2012
1 answer
318 views
As I have posted previously, I am using a radcombobox as a data selector in a radgrid. The combobox is filled with options for the user to select, but I only want the combobox visible if the user clicks on the existing item.

All of the functionality works as expected, however, the combobox must be displayed the first time the page is rendered because setting the Visible property to false server-side prevents the html from being generated.

I have tried setting an attribute in the style for display:none but it is not recognized and the combo still shows.
How can I initially hide the combobox and still have the html generated?

Also, while I might consider a client-side solution as a last resort, it is important to note that I have the potential for hundreds of comboboxes because as I stated previously, these are being used in a radgrid.

Other points that might be important is that the data in the combobox is filled based on the value of a field in the current record. i.e. if column pID is 42, then all items in a specific table where pID is 42 are put into the combobox. This precludes the thought of creating the combobox dynamically client-side because I would need to make numerous postbacks everytime the combobox becomes visible. I am desparately trying to keep the number of server calls down. 
Keith
Top achievements
Rank 2
 answered on 19 Jul 2012
1 answer
227 views
Hi,

I've a rad editor on my page and I set the attributes of it as follows:

rreSuperVisory.Attributes.Add("CommentTypeCode", ((int)CommentTypeCode.MRTLApprovalComment).ToString());     
  rreSuperVisory.Attributes.Add("UserId", UserId.ToString());

I want to access these attributes through jquery from client side.

Could you please tell me how is it possible ? If not, could you please suggest an alternate solution ?

Thanks,
Sailaja

Rumen
Telerik team
 answered on 19 Jul 2012
1 answer
149 views
I am having an issue on multiple pages with the RadDatePicker.  If the user uses the Calendar and selects a date there is no issue, but about 35% of the time if the user manually enters the date byt typing it in it does not recognize the date as the selected date.  I am using version 2009.3.1314.35.

<telerik:RadDatePicker ID="dpMeetingDate" runat="server" MinDate="2009-01-01" Width="150px" ImagesPath="" Skin="Vista" Enabled="false">
        <Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x" Skin="Vista"  />
        <DatePopupButton ImageUrl="" HoverImageUrl="" />
</telerik:RadDatePicker>

when I try to save or sometimes try to filter by looking at the date entered if the user has manually entered it I get the error that no date was selected.

if (dpMeetingDate.SelectedDate == null)
{
  lblError.Text += "<br>  - Select a meeting date";
  canSave = false;
Eyup
Telerik team
 answered on 19 Jul 2012
1 answer
142 views
Hello...

I have a simple page (Principal.aspx)  with several links... Each link load a Aspx page on right, like that: 
$('#myRightdiv').load('Test.aspx', function () {          
});

My Test.aspx has a RadListView, and I have a pageLoad to get it on client :

function pageLoad() {
 listView = $find("myRadListView");           
 alert(listView);
}

The problem is sometimes that pageLoad is not fired at all... So I cant get the RadListView on client...
If I try to get that on my Principal.aspx , I always got a Null...

I´m using last 2012 Q2 and .NET 4.0 (VS 2012) ... With VS210 and .NET 3.5 its working fine...

Any idea?


Thanks
Tsvetina
Telerik team
 answered on 19 Jul 2012
1 answer
111 views
Hi team,

 We are using RadEditior in our Application . The version we are using is 2008.2.1001.20.
 When we try to copy from Word and paste its adding some $00 and we are loosing the formatting(in Firefox and Chrome).
 So we tried to use the Strip Word formating in Firefox its working fine. But its not working in Chrome.
 Please help us with the proper solution.

Thanks,
PMG
Rumen
Telerik team
 answered on 19 Jul 2012
1 answer
119 views
Dear Team,

I have an assignment to check the rad grid cell and if the cell has expected value then assign a context menu to the cell. Can anyone help me with the following:

1) attach the context menu on required cells only
2) Create separate context menu object for every cell which qualify the cell.

C#:
RadContextMenu oRadContextMenu = (RadContextMenu)RadContextMenu;
                    ContextMenuControlTarget oMenuTarget = new ContextMenuControlTarget();
 
GridTableCell gtcPreviousCell = (GridTableCell)e.Item.Cells[(e.Item.Cells.GetCellIndex(radCell)) - 1];
                            if (sColumnName == gtcPreviousCell.Column.UniqueName.ToString())
                            {
                                gtcPreviousCell.ID = sCellValue;
                                oMenuTarget.ControlID = gtcPreviousCell.ID;
                                oRadContextMenu.Targets.Add(oMenuTarget);
                            }

Thanks and Regards,
- Yogesh
Eyup
Telerik team
 answered on 19 Jul 2012
1 answer
131 views
Hi there,

 We are using the RadEditor version 2008.1.515.20 in our application. When the site is opening in the IE the Editor is loading with
"Internet Explorer cannot display the webpage " and we are not able to enter any thing.
 Please find attached screenshot.


The Aspx Code is :
<telerik:RadEditor runat="server" ID="txt_message_body" SkinID="BasicSetOfTools"   skin="Default2006" EditModes="All" Height="400px"  StripFormattingOptions="None" ToolbarMode="Default" Width="680px" >  
             
       <Tools>
     <telerik:EditorToolGroup Tag="FileManagers">
     <telerik:EditorTool Name="Undo" />
     <telerik:EditorTool Name="Redo" />
     <telerik:EditorTool Name="Bold" />
     <telerik:EditorTool Name="Italic" />
     <telerik:EditorTool Name="Underline" />
     <telerik:EditorTool Name="InsertOrderedList" />
     <telerik:EditorTool Name="InsertUnorderedList" />
     <telerik:EditorTool Name="Outdent" />
     <telerik:EditorTool Name="Indent" />
     <telerik:EditorTool Name="LinkManager" />
     <telerik:EditorTool Name="UnLink" />
     <telerik:EditorTool Name="InsertSymbol" />
     <telerik:EditorSeparator />
     <telerik:EditorTool Name="Cut" />
     <telerik:EditorTool Name="Copy" />
     <telerik:EditorTool Name="Paste" />
     <telerik:EditorSeparator />
     <telerik:EditorTool Name="FontName" />
     <telerik:EditorTool Name="RealFontSize" />        
     <telerik:EditorTool Name="ForeColor" />
     <telerik:EditorSeparator />
     <telerik:EditorTool Name="AjaxSpellCheck" />
     </telerik:EditorToolGroup>     
     </Tools>          

               </telerik:RadEditor>

Web.Config:

<httpHandlers>
      <remove path="*.asmx" verb="*"/>
      <add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
      <add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
      <add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"

validate="false"/>
    
    <add verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler, Telerik.Web.UI"/>
    <add path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler"    validate="false" />
    <add path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Culture=neutral, Version=2008.2.1001.20, PublicKeyToken=121fae78165ba3d4"
        validate="false" />
    <add path="Telerik.Web.UI.SpellCheckHandler.axd" verb="*" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Version=2008.2.1001.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4"

validate="false"/>
  <add path="ChartImage.axd" verb="*" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Version=2008.2.1001.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false"/>
 
  </httpHandlers>
   
 <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI"/>



    </httpModules>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules>
      <remove name="ScriptModule"/>
      <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI" preCondition="managedHandler"/>
     
    </modules>

    <handlers>
      <remove name="ScriptHandlerFactory"/>
      <remove name="ScriptHandlerFactoryAppServices"/>
      <remove name="ScriptResource"/>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral,

PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      
<add name="Telerik.RadUploadProgressHandler.ashx_*" path="Telerik.RadUploadProgressHandler.ashx" verb="*" type="Telerik.Web.UI.Upload.RadUploadProgressHandler, Telerik.Web.UI"

preCondition="integratedMode,runtimeVersionv2.0"/>


 <add name="Telerik_Web_UI_DialogHandler_aspx" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" />  

    </handlers>
  </system.webServer>


Thanks,
Aparna
Rumen
Telerik team
 answered on 19 Jul 2012
3 answers
190 views
Hi,

I have a RadGrid in UserControl and I am trying to perform basic Crud operation using Inline edit per this demo.http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/entityframeworkcrud/defaultcs.aspx . This functionality works in another page where we dont use usercontrol. Please help.

User Control.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FollowUp.ascx.cs"
    Inherits="MedAssets.AMS.Web.Controls.FollowUp" %>
  
  
      
<style type="text/css">
       .RemoveEdit
       {
            display:none !important;
           color:lightblue !important;
       }
   </style>
  
<ContentTemplate>
    <div class="formLayoutE" id="divStatus" runat="server" style="padding-left: 15px; padding-right: 5px; padding-top: 5px">
        <asp:Panel ID="pnlMain" runat="server" Height="95%" Width="70%">    
      
       
         <telerik:RadTabStrip ID="tbStripFollowUp" runat="server" MultiPageID="RadMultiPage1"  Skin="Vista"
                SelectedIndex="0" CssClass="tabStrip" CausesValidation="False"  OnTabClick="tbStripFollowUp_TabClick" 
                EnableViewState="False">
                <Tabs>
                    <telerik:RadTab Text="Current" SelectedCssClass="horizontalTabSelected" Selected="True">
                    </telerik:RadTab>
                    <telerik:RadTab Text="History" SelectedCssClass="horizontalTabSelected"  >
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>
              
              
             <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" 
                CssClass="multiPage" align="left" Width="100%"
                   EnableViewState="false" >
                
                <telerik:RadPageView ID="RadPageView1" runat="server">
                    <h3 class="formLayoutE_functionsheader">Scheduler</h3><br /> <br/>    
                      
                  <telerik:RadGrid ID="grdFollowUpAlert" runat="server" AutoGenerateColumns="false"  Skin="Windows7" Width="640px" EnableViewState="True"  
        AllowAutomaticDeletes="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False"
        OnItemCommand="grdFollowUpAlert_ItemCommand"
        OnItemDataBound="grdFollowUpAlert_ItemDataBound"
        OnNeedDataSource="grdFollowUpAlert_NeedsDataSource"
        OnInsertCommand="grdFollowUpAlert_InsertCommand"
        OnUpdateCommand="grdFollowUpAlert_UpdateCommand" 
        OnDeleteCommand="grdFollowUpAlert_DeleteCommand"
        OnCancelCommand="grdFollowUpAlert_CancelCommand"
        <ValidationSettings ValidationGroup="GroupAlphaRange" />
        <MasterTableView DataKeyNames="Id" CommandItemDisplay="Top" EditMode="EditForms">
        <CommandItemSettings AddNewRecordText="Add FollowUp" />
            <Columns>
                
                
                    <telerik:GridBoundColumn  DataField="FollowUpDateTime"  HeaderStyle-Width="100px" HeaderText="FollowUp Date" UniqueName="FollowUpDateTime" DataFormatString="{0:MM/dd/yyyy hh:mm tt}" />              
                    <telerik:GridBoundColumn DataField="Reason" HeaderStyle-Width="140px" HeaderText="Reason" UniqueName="Reason" DefaultInsertValue=" " />    
                    <telerik:GridBoundColumn  DataField="Name"  UniqueName="Name" HeaderStyle-Width="100px" HeaderText="Activity" DefaultInsertValue=" "  />
                    <telerik:GridBoundColumn DataField="CreatedBy" HeaderStyle-Width="55px" UniqueName="CreatedBy" HeaderText="Created By" /> 
                    <telerik:GridButtonColumn ConfirmText="Delete this item?" ConfirmDialogType="RadWindow" UniqueName="DeleteImageButton" HeaderStyle-Width="15px"  
                        ConfirmTitle="Confirm Delete" ButtonType="ImageButton"  CommandName="Delete" />
                          <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditImageButton" HeaderStyle-Width="15px" />
                <telerik:GridBoundColumn DataField="Id" Visible="false" />
                    <telerik:GridBoundColumn DataField="AccountId" HeaderStyle-Width="2px" HeaderText="AccountId" UniqueName="AccountId" Visible="False" />  
                    <telerik:GridBoundColumn DataField="WorkflowActivitySpecTypeId" HeaderStyle-Width="2px" HeaderText="WorkflowActivitySpecTypeId" UniqueName="WorkflowActivitySpecTypeId" Visible="False" />  
            </Columns>
            <EditFormSettings EditFormType="Template" InsertCaption="Add Followup" CaptionFormatString="Edit Followup">
                <FormTemplate
                    <table>
                        <tr>
                            <td>Assign From:</td>
                            <td><telerik:RadComboBox runat="server" ID="dropdownActivity" OnInit="OnInit_dropdownActivity" AppendDataBoundItems="True"
                            /></td>
                            <td>
                                  
                                                              
                            </td>
                        </tr>
                         
                        <tr>
                            <td>FollowUP DateTime:</td>
                            <td><telerik:RadDateTimePicker ID="followUpStartDate" runat="server" AutoPostBack="false"   
                            TimeView-RenderDirection="Vertical" Width="200px" /></td>
                            <td>
                                <asp:RequiredFieldValidator ID="valfollowUpStartDate" runat="server"
                                    ControlToValidate="followUpStartDate"
                                    ValidationGroup="valGroup"
                                    EnableClientScript="false"
                                    SetFocusOnError="true"
                                    Text="FollowUp Date is required"
                                    Display="Dynamic" />
                                 <asp:CustomValidator ID="valCustomFollowUpDateEndDateTime" runat="server"
                                    ControlToValidate="followUpStartDate"
                                    ValidationGroup="valGroup"
                                    ValidateEmptyText="false"
                                    OnServerValidate="ValidateFollowUpDateTimes"
                                    Text="FollowUp Date shouuld be greater than current date" 
                                    Display="Dynamic" />        
                            </td>
                        </tr>
                         
                        <tr>
                            <td valign="top">Reason:</td>
                            <td colspan="3">
                                <telerik:RadTextBox id="txtReason" runat="server" MaxLength="200" Columns="40" TextMode="MultiLine" Rows="4"
                                    SelectionOnFocus="SelectAll"   Text='<%# Bind("Reason") %>'/>
                            </td>
                        </tr>
                           <tr>
                            <td valign="top">Task Complete?:</td>
                            <td colspan="3">
                                <asp:CheckBox id="cbxTaskComplete" runat="server" Text="Match on Task Complete" />
                            </td>
                        </tr>
                       <tr
                            <td colspan="3">
                                <asp:Button ID="btnSave" runat="server" 
                                    Text='<%# (Container is GridEditFormInsertItem) ? "Add" : "Update" %>'
                                    CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' 
                                    ValidationGroup="valGroup" SkinID="Windows7">
                                </asp:Button>                                 
                                <asp:Button runat="server" ID="btnCancel" Text="Cancel" Width="75px" CommandName="Cancel" SkinID="Windows7" />
                            </td>
                        </tr>
                    </table>
                </FormTemplate>               
            </EditFormSettings>
            <NoRecordsTemplate>There are no Follow Up entries to display.</NoRecordsTemplate>
        </MasterTableView>
    </telerik:RadGrid>
  
                </telerik:RadPageView>
                <telerik:RadPageView ID="RadPageView2"  runat="server" CssClass="pageViewEducation">
                    <br/>
                   <h3 class="formLayoutE_functionsheader">Follow Up History</h3><br /> <br/>    
                  <telerik:RadGrid ID="grdFollowUpHistory" runat="server" CssClass="Grid" Width="90%" Height="90%"  OnNeedDataSource="grdFollowUpHistory_NeedsDataSource"
                  OnItemDataBound="grdFollowUpHistory_ItemDataBound"
                            Skin="Windows7" AutoGenerateColumns="false" GridLines="Vertical" AllowSorting="True" AllowPaging="True" >
                            <PagerStyle Mode="NextPrevAndNumeric" />
                              
                            <MasterTableView DataKeyNames="FollowupID">
                                <Columns>
                                  <telerik:GridBoundColumn  DataField="FollowUpDateTime"  HeaderStyle-Width="40px" HeaderText="FollowUp Date" UniqueName="FollowUpDateTime" DataFormatString="{0:MM/dd/yyyy hh:mm tt}" />              
                                  <telerik:GridBoundColumn DataField="Reason" HeaderStyle-Width="80px" HeaderText="Reason" UniqueName="Reason" DefaultInsertValue=" " />    
                                  <telerik:GridBoundColumn DataField="Name" HeaderStyle-Width="40px" UniqueName="Name" HeaderText="Activity" DefaultInsertValue=" "  />
                                  <telerik:GridBoundColumn DataField="CreatedBy" HeaderStyle-Width="40px" HeaderText="Created By" /> 
                                  <telerik:GridBoundColumn DataField="WorkflowActivitySpecTypeId" HeaderStyle-Width="2px" HeaderText="WorkflowActivitySpecTypeId" UniqueName="WorkflowActivitySpecTypeId" Visible="False" />
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
                          
  
                </telerik:RadPageView>
                 
            </telerik:RadMultiPage>
  
  
  
  
  
</asp:Panel>
    </div>
      
</ContentTemplate>

CodeBehind
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using MedAssets.AAA;
using MedAssets.AMS.Business.Common;
using MedAssets.AMS.Business.WorkDistribution;
using MedAssets.AMS.Common;
using MedAssets.AMS.DataAccess;
using MedAssets.AMS.Web.Admin.WorkDistribution;
using MedAssets.AMS.Workflow;
using MedAssets.Aaa.Security;
using MedAssets.Aaa.TaskQueues;
using MedAssets.Aaa.Users;
using MedAssets.Log;
using MedAssets.AMS.Workflow;
  
using StructureMap;
  
using Telerik.Web.UI;
  
namespace MedAssets.AMS.Web.Controls
{
  
    public partial class FollowUp : BaseWorkflowControl 
    {
          
  
        private const string mTimeZoneCookieName = "TZOS"; // Time zone Offset
        private IWorkFollowup iWorkFollowup = new WorkFollowup();
        private IWorkflow m_workflow;
        public IWorkflow Workflow
        {
            get
            {
                var workflow = m_workflow ?? (m_workflow = WorkflowService.GetActiveWorkflowForAccount(AccountADT.Account.Id));
                return workflow ?? (new Workflow.Workflow(new WorkflowKey(AccountADT.Account.FacilityId, Guid.NewGuid())) { AccountId = AccountADT.AccountId });
            }
            set { m_workflow = value; }
        }
  
  
       private CultureInfo enUS = new CultureInfo("en-US"); 
        private int? activitySpecTypeId;
        private DateTime followUpDate;
        private Boolean isComplete = false;
        private string reason = string.Empty;
        private Guid followUpId;
  
        protected void OnPreInit(EventArgs e)
        {
            setCookieForTimezoneOffset();   
        }
        protected void Page_Load(object sender, EventArgs e)
        {
           
            if(!IsPostBack)
            {
                m_workflow = WorkflowService.GetActiveWorkflowForAccount(AccountADT.Account.Id);
                PopulateGrid("grdFollowUpAlert", true);
                PopulateGrid("grdFollowUpHistory", true);
               // RadScheduler1.TimeZoneOffset = new TimeSpan(getTimezoneOffset(), 0, 0);
                InitializeAppointments();
                 
            }
  
        }
        
  
        private static int GetEnumValue(Enum wfEnum )
        {
            return (int)Enum.Parse(wfEnum.GetType(), wfEnum.ToString());
        }
  
  
  
        private void InitializeAppointments()
        {
  
              
  
            //DateTime start = DateTime.UtcNow.Date;
            //start = start.AddHours(6);
            //Appointments.Add(new AppointmentInfo("Take the car to the service", start, start.AddHours(1), string.Empty, null, new Reminder(30).ToString(), 1));
            //Appointments.Add(new AppointmentInfo("Meeting with Alex", start.AddHours(2), start.AddHours(3), string.Empty, null, string.Empty, 2));
  
            //start = start.AddDays(-1);
            //DateTime dayStart = RadScheduler1.UtcDayStart(start);
            //Appointments.Add(new AppointmentInfo("Bob's Birthday", dayStart, dayStart.AddDays(1), string.Empty, null, string.Empty, 1));
            //Appointments.Add(new AppointmentInfo("Call Charlie about the Project", start.AddHours(2), start.AddHours(3), string.Empty, null, string.Empty, 2));
  
            //start = start.AddDays(2);
            //Appointments.Add(new AppointmentInfo("Get the car from the service", start.AddHours(2), start.AddHours(3), string.Empty, null, string.Empty, 1));
        }
  
  
        public override void Populate()
        {
              
        }
  
        private void PopulateGrid(string gridName, bool needRebind)
        {
            var cbo = (RadGrid)FindControlRecursive(Page, gridName);
            if (gridName == "grdFollowUpAlert")
            {
               
                //if(IsWorkFlowOverridden(Workflow))
                //{
                //    //var tbControl = (RadTab)FindControlRecursive(Page, "Current");
                //    //tbControl.Visible = false;
                //    return;
                //}
                if (cbo != null)
                {
                    cbo.DataSource = GetFollowUpDetails().Where(a => a.IsComplete == false);
                    
                      
                }
  
            }
  
            if (gridName == "grdFollowUpHistory")
            {
                if (cbo != null)
                {
                    cbo.DataSource = GetFollowUpDetails().Where(a => a.IsComplete == true);
                    if (needRebind) { cbo.Rebind(); }
                }
            }
             
        }
  
        private IEnumerable<WorkFollowup> GetFollowUpDetails()
        {
            return ObjectFactory.GetInstance<IWorkflowFollowupManager>().GetWorkflowFollowUp(AccountId, FacilityId);
        }
  
        private void SaveFollowUp(IWorkFollowup workfollowup)
        {
            ObjectFactory.GetInstance<IWorkflowFollowupManager>().Save(workfollowup);
        }
  
        private void DeleteFollowUp(Guid followUpId)
        {
            ObjectFactory.GetInstance<IWorkflowFollowupManager>().Delete(followUpId);
        }
  
  
  
        private void setCookieForTimezoneOffset()
        {
            if (Request.Cookies[mTimeZoneCookieName] == null)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "Timezone", 
                     string.Format
                     (  @"<script language=""javascript"">document.cookie = ""{0}="" + new Date().getTimezoneOffset(); </script>",  
                              mTimeZoneCookieName)); 
                  
            }  
        }
        public int TimezoneOffset
        {
            get
            {
               return getTimezoneOffset();  
            }  
        }  
          
        private int getTimezoneOffset() 
        {  
            int returnValue = (Request.Cookies[mTimeZoneCookieName] == null) ? 0 : Convert.ToInt32(Request.Cookies[mTimeZoneCookieName].Value); 
              
          // JavaScript returns 300 if the offset is -5 offset so I convert the number  
            return (returnValue / 60) * -1;   
        }
  
  
  
  
        private IWorkDistributionManager _workDistributionManager;
  
        private IWorkDistributionManager WorkDistributionManager
        {
            get
            {
                return _workDistributionManager ??
                       (_workDistributionManager = ObjectFactory.GetInstance<IWorkDistributionManager>());
            }
        }
  
        private IUserTreeManager _userTreeManager;
  
        private IUserTreeManager UserTreeManager
        {
            get { return _userTreeManager ?? (_userTreeManager = ObjectFactory.GetInstance<IUserTreeManager>()); }
        }
  
        private ITaskQueueImpersonation iTaskQueueImpersonation = new TaskQueueImpersonation();
       
  
        protected void grdFollowUpAlert_NeedsDataSource(object sender, GridNeedDataSourceEventArgs args)
        {
  
            PopulateGrid("grdFollowUpAlert", false);
        }
  
        protected void grdFollowUpHistory_NeedsDataSource(object sender, GridNeedDataSourceEventArgs args)
        {
  
            PopulateGrid("grdFollowUpHistory", false);
        }
        protected void grdFollowUpAlert_ItemCommand(object sender, GridCommandEventArgs e)
        {
            switch (e.CommandName)
            {
                //cancel default edit command and load the edited data in the external form
                case RadGrid.EditCommandName:
                    //iTaskQueueImpersonation = WorkDistributionManager.GetTaskQueueImpersonation(
                    //    (Guid)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"]);
                    e.Item.OwnerTableView.IsItemInserted = false;
                    break;
                case RadGrid.InitInsertCommandName:
                    grdFollowUpAlert.MasterTableView.ClearEditItems();
                    break;
            }
             
        }
  
        protected void grdFollowUpAlert_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {
                  
            }
  
            if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
            {
                if (e.Item.OwnerTableView.IsItemInserted)
                {
                    var insertedItem = (GridEditFormItem)e.Item;
  
                    var ctlFollowUpStartDate = (RadDateTimePicker)insertedItem.FindControl("followUpStartDate");
                    ctlFollowUpStartDate.MinDate = DateTime.Today;
  
                }
                else
                {
                   iWorkFollowup  = (IWorkFollowup)e.Item.DataItem;
  
                    GridEditFormItem edititem = (GridEditFormItem)e.Item;
  
                    var ctldropdownActivity = (RadComboBox)edititem.FindControl("dropdownActivity");
  
                    RadComboBoxItem itemAc =
                        ctldropdownActivity.FindItemByValue(iWorkFollowup.WorkflowActivitySpecTypeId.ToString());
                    itemAc.Selected = true;
  
                    var minDate = iWorkFollowup.FollowupDateTime;
  
                    var ctlFollowUpDate = (RadDateTimePicker)edititem.FindControl("followUpStartDate");
                    ctlFollowUpDate.MinDate = minDate;
                    ctlFollowUpDate.DbSelectedDate = iTaskQueueImpersonation.StartDate.ToString();
  
                    var isComplete = (CheckBox)edititem.FindControl("cbxTaskComplete");
                    isComplete.Checked = iWorkFollowup.IsComplete;
                }
            }
  
            if (e.Item is GridDataItem)
            {
                GridDataItem ditem = (GridDataItem)e.Item;
  
                TableCell accountCell = (TableCell)ditem["AccountId"];
  
                if (IsWorkFlowOverriddenByAccountId(new Guid(accountCell.Text)))
                {
                    ditem.Display = false;
                }
                else
                {
                    //GridEditCommandColumn editcol = (GridEditCommandColumn)["EditImageButton"].Controls[0];
  
                    TableCell userCell = (TableCell) ditem["CreatedBy"];
                    if (userCell.Text != HttpContext.Current.User.Identity.Name)
                    {
                        var imgBtn = (ImageButton)ditem["DeleteImageButton"].Controls[0];
  
                        ditem["EditImageButton"].CssClass = "RemoveEdit"; 
                        var lnk = ditem["EditImageButton"].Controls[0] as LinkButton;
                        ditem["EditImageButton"].Controls.Remove(lnk);
                        imgBtn.Visible = false;
                        //editcol.Display = false;
                    }
  
                }
                TableCell specTypeId = (TableCell)ditem["WorkflowActivitySpecTypeId"];
                TableCell specTypeName = (TableCell)ditem["Name"];
                var en = (WorkflowActivitySpecType)Convert.ToInt32(specTypeId.Text);
                specTypeName.Text  = en.Description();
  
                TableCell followUpDateTime = (TableCell) ditem["FollowUpDateTime"];
  
                DateTime dt = DateTime.ParseExact(followUpDateTime.Text, "g", enUS, DateTimeStyles.None);
                //DateTime dt = DateTime.ParseExact(followUpDateTime.Text, "yyyyMMddHHmm", null);
                //DateTime loadedDate = DateTime.ParseExact(loadedString, "d", null);
  
                dt = dt.AddHours(TimezoneOffset);
  
                followUpDateTime.Text = dt.ToString();
  
                //if(!string.IsNullOrEmpty(specTypeId.Text))
                //{
                //    
                //    var wf = GetWorkFlowByAccountId(new Guid(accountCell.Text));
  
                //    var fid = new Guid("A73FC5C9-B2EC-4DE7-992C-07F38797CC9E");
                //    //var specTypeList =
                //    //    GetWorkFlowSpecByFacilityId(Workflow.FacilityId).Where(a => a.SpecType == en);
  
                //    var specTypeList =
                //     GetWorkFlowSpecByFacilityId(fid).Where(a => a.SpecType == en);
                //    foreach(var list in specTypeList )
                //    {
                //        foreach(var ts in list.TaskSpecList)
                //        {
                //            ts.WorkflowActivitySpecId = en;
                //        }
                //    }
  
                //    TableCell activitySpecTypeNameCell = (TableCell)ditem["Name"];
                //    activitySpecTypeNameCell.Text  = (specTypeList.Count() > 0)? specTypeList.FirstOrDefault().Name :string.Empty;
  
                //}
  
  
            }
        }
  
        protected void grdFollowUpHistory_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem ditem = (GridDataItem) e.Item;
  
                TableCell specTypeId = (TableCell) ditem["WorkflowActivitySpecTypeId"];
                TableCell specTypeName = (TableCell) ditem["Name"];
                var en = (WorkflowActivitySpecType) Convert.ToInt32(specTypeId.Text);
                specTypeName.Text = en.Description();
  
                TableCell followUpDateTime = (TableCell) ditem["FollowUpDateTime"];
  
                DateTime dt = DateTime.ParseExact(followUpDateTime.Text, "g", enUS, DateTimeStyles.None);
                //DateTime dt = DateTime.ParseExact(followUpDateTime.Text, "yyyyMMddHHmm", null);
                //DateTime loadedDate = DateTime.ParseExact(loadedString, "d", null);
  
                dt = dt.AddHours(TimezoneOffset);
  
                followUpDateTime.Text = dt.ToString();
            }
        }
        private static string GetDescription(Enum en)
        {
            Type type = en.GetType();
  
            MemberInfo[] memInfo = type.GetMember(en.ToString());
  
            if (memInfo != null && memInfo.Length > 0)
            {
                object[] attrs = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
  
                if (attrs != null && attrs.Length > 0)
                {
                    return ((DescriptionAttribute)attrs[0]).Description;
                }
            }
  
            return en.ToString();
        }
        protected void grdFollowUpAlert_InsertCommand(object sender, GridCommandEventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }
  
            //Get the GridEditFormInsertItem of the RadGrid 
            GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;
  
            //Access the textbox from the insert form template and store the values in variables. 
             var specType = (WorkflowActivitySpecType)System.Enum.Parse(typeof(WorkflowActivitySpecType), ((RadComboBox)insertedItem.FindControl("dropdownActivity")).SelectedItem.Text);
            var x = (int) specType;
            //activitySpecTypeId = ((RadComboBox)insertedItem.FindControl("dropdownActivity")).SelectedIndex > 0 ? 
            //    : null;
            //    Convert.ToInt32(((RadComboBox)insertedItem.FindControl("dropdownActivity")).SelectedItem.Value);
  
            followUpDate = (DateTime)((RadDateTimePicker)insertedItem.FindControl("followUpStartDate")).DbSelectedDate;
  
         
            var radReason = ((RadTextBox)insertedItem.FindControl("txtReason")).Text;
            if (radReason != string.Empty)
                reason = radReason;
  
            isComplete = ((CheckBox)insertedItem.FindControl("cbxTaskComplete")).Checked;
  
            followUpId = (Guid)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"];
  
     
            IWorkFollowup iworkfollowup = new WorkFollowup(new WorkFollowupKey(Guid.NewGuid()));
            iworkfollowup = UpdateFollowUp(iworkfollowup, false);
              
            SaveFollowUp(iworkfollowup);
  
          }
  
        protected void grdFollowUpAlert_UpdateCommand(object sender, GridCommandEventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }
  
            //Get the GridEditableItem of the RadGrid 
            GridEditableItem editedItem = e.Item as GridEditableItem;
  
            //Access the textbox from the edit form template and store the values in variables. 
            if (editedItem != null)
            {
                activitySpecTypeId =
                     Convert.ToInt32(((RadComboBox)editedItem.FindControl("dropdownActivity")).SelectedItem.Value);
  
                followUpDate = (DateTime)((RadDatePicker)editedItem.FindControl("followUpStartDate")).DbSelectedDate;
  
                
                var radReason = ((RadTextBox)editedItem.FindControl("txtReason")).Text;
                reason = radReason != string.Empty ? radReason : string.Empty;
  
                followUpId = (Guid)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"];
  
                isComplete = ((CheckBox)editedItem.FindControl("cbxTaskComplete")).Checked;
  
                IWorkFollowup iworkfollowup = new WorkFollowup(new WorkFollowupKey(followUpId));
                iworkfollowup = UpdateFollowUp(iworkfollowup, false);
              
                SaveFollowUp(iworkfollowup);
  
            }
        }
        
  
        private IWorkFollowup UpdateFollowUp(IWorkFollowup workfollowup, bool isNew)
        {
  
            workfollowup.AccountId = AccountId;
            workfollowup.FacilityId = FacilityId;
            workfollowup.WorkflowActivitySpecTypeId = activitySpecTypeId;
            workfollowup.FacilityId = FacilityId;
            workfollowup.FollowupDateTime = followUpDate;
              
  
  
            if (isNew)
            {
                 
                if (reason != string.Empty)
                    workfollowup.Reason = reason;
                workfollowup.IsComplete = false;
                workfollowup.CreatedBy = HttpContext.Current.User.Identity.Name;
                workfollowup.CreatedOn = DateTime.Now;
                  
            }
            else
            {
  
                workfollowup.Reason = reason == string.Empty ? null : reason;
                workfollowup.IsComplete = isComplete;
                workfollowup.ModifiedBy = HttpContext.Current.User.Identity.Name;
                workfollowup.ModifiedOn = DateTime.Now;
                //workfollowup.FollowupId = followUpId;
            }
  
            return workfollowup;
        }
  
        protected void grdFollowUpAlert_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            var id = (Guid)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"];
  
            DeleteFollowUp(id);
              
        }
  
        protected void grdFollowUpAlert_CancelCommand(object sender, GridCommandEventArgs e)
        {
            //grdFollowUpAlert.Rebind();
        }
  
      
        protected void ValidateFollowUpDateTimes(object sender, ServerValidateEventArgs args)
        {
            var validator = (CustomValidator)sender;
            var editItem = (GridEditFormItem)validator.NamingContainer;
  
            var ctlfollowUpDate = (RadDateTimePicker)editItem.FindControl("followUpStartDate");
            var dbSelectedDate = ctlfollowUpDate.DbSelectedDate;
             
  
            var dateFollowUp = (DateTimeOffset?)((DateTime)dbSelectedDate);
  
            args.IsValid = dateFollowUp > DateTime.Now;
  
        }
  
        protected void OnInit_dropdownActivity(object sender, EventArgs e)
        {
            LoadDropdown();
        }
  
        
        private void LoadDropdown()
        {
             
           var cbo = (RadComboBox)FindControlRecursive(Page, "dropdownActivity");
             if (cbo != null)
            {
                cbo.Items.Clear();
  
                var enumList = Enum.GetValues(typeof(WorkflowActivitySpecType)).Cast<WorkflowActivitySpecType>().ToList();
                  
                cbo.DataSource = enumList;
                 //cbo.DataTextField = "Name";
                 //cbo.DataValueField = "WorkflowActivitySpecTypeId";
                cbo.DataBind();
                cbo.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem { Text = "--Select a Value--", Value = "--Select a Value--" });
                cbo.SelectedIndex = 0; 
                  
            }
        }
  
        public static Control FindControlRecursive(Control root, string id)
        {
            if (id == string.Empty)
                return null;
  
            if (root.ID == id)
                return root;
  
            foreach (Control c in root.Controls)
            {
                Control t = FindControlRecursive(c, id);
                if (t != null)
                {
                    return t;
                }
            }
            return null;
        }
  
        private bool IsWorkFlowOverridden(IWorkflow workflow)
        {
            var workflowStatus = workflow.WorkflowStatus;
            return (workflowStatus == WorkflowStatus.AutoAccountOverride ||
                    workflowStatus == WorkflowStatus.ManualAccountOverride);
        }
  
        private bool IsWorkFlowOverriddenByAccountId(Guid accountId)
        {
  
            var workflow = WorkflowService.GetActiveWorkflowForAccount(accountId) ??
                (new Workflow.Workflow(new WorkflowKey(AccountADT.Account.FacilityId, Guid.NewGuid())) { AccountId = accountId });
              
            var workflowStatus = workflow.WorkflowStatus;
            return (workflowStatus == WorkflowStatus.AutoAccountOverride ||
                    workflowStatus == WorkflowStatus.ManualAccountOverride);
        }
  
        private IWorkflow GetWorkFlowByAccountId(Guid accountId)
        {
  
            return WorkflowService.GetActiveWorkflowForAccount(accountId) ??
                (new Workflow.Workflow(new WorkflowKey(AccountADT.Account.FacilityId, Guid.NewGuid())) { AccountId = accountId });
  
            
        }
        private IEnumerable<IWorkflowActivitySpec> GetWorkFlowSpecByFacilityId(Guid facilityId)
        {
            return ObjectFactory.GetInstance<IWorkflowFollowupManager>().GetWorkflowSpecByFaclilityId(facilityId);
  
              
        }
  
        protected void tbStripFollowUp_TabClick(object sender, RadTabStripEventArgs e)
        {
           
        }
  
    }
}
Kris
Top achievements
Rank 1
 answered on 19 Jul 2012
4 answers
231 views
Hi,
i am using rad-grid with hierarchy and in that for the details table i am having the edit button and when i am clicking on edit below the row will appear and including that ":" is appearing in front of the label

below is the sample code i used and the image is also attached

please give me the solution ASAP

 
<Telerik:GridTemplateColumn UniqueName="editit">  
                                    <HeaderTemplate>  
                                        <asp:Label ID="lblParameterValue" runat="server" Text="Parameter Value"></asp:Label></HeaderTemplate>  
                                    <ItemTemplate>  
                                        <asp:Label ID="lblParameterValue" runat="server" Text='<%#Eval("ParaValue") %>'></asp:Label>  
                                    </ItemTemplate>  
                                    <EditItemTemplate>  
                                        <asp:Label ID="lblParameterDesc" runat="server" Text='<%#Eval("ParameterDesc") %>'></asp:Label>  
                                        <asp:TextBox ID="txtParameterValue" runat="server" Text='<%#Eval("ParaValue") %>' />  
                                        <asp:Label ID="lblParameterName" runat="server" Text='<%#Eval("ParameterName") %>'  
                                            Visible="false"></asp:Label>  
                                        <%--<ajaxToolkit:FilteredTextBoxExtender ID="filterAccountNumber" runat="server" TargetControlID="txtParameterValue"  
                                    FilterType="Numbers" />--%>  
                                        <asp:Label ID="lblParameterKey1" runat="server" Text='<%#Eval("ParameterKey") %>'  
                                            Visible="false"></asp:Label>  
                                        <asp:Label ID="lblMinLength" Visible="false" runat="server" Text='<%#Eval("MinLength") %>'></asp:Label>  
                                        <asp:Label ID="lblMaxLength" Visible="false" runat="server" Text='<%#Eval("MaxLength") %>'></asp:Label>  
                                        <asp:Label ID="lblAllowedSplChars" Visible="false" runat="server" Text='<%#Eval("AllowedSplChars") %>'></asp:Label>  
                                        <asp:Label ID="lblisSpaceAllowed" Visible="false" runat="server" Text='<%#Eval("isSpaceAllowed") %>'></asp:Label>  
                                        <asp:Label ID="lblRegularExp" Visible="false" runat="server" Text='<%#Eval("RegularExp") %>'></asp:Label>  
                                        <asp:Label ID="lblDataType" Visible="false" runat="server" Text='<%#Eval("DataType") %>'></asp:Label>  
                                    </EditItemTemplate> 
 
 
 
 

Thanks in advance
Vara Prasad.M
Sadi
Top achievements
Rank 1
 answered on 19 Jul 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?