Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
162 views

I'm trying to create a dynamic datagrid for editing and updating, which is mostly working except that when I do a postback, it adds extra "datarow" columns to the grid. This also causes an error when I go to edit, with the message, "There is no column 'column'". At first, I didn't have NeedsDataSource, which was causing the grid to vanish when there was a post back. Now, it keeps adding columns.

 

ASPX:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ReferenceTables.aspx.vb" Inherits="Test.ReferenceTables" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Test</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>

                        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
            </telerik:RadScriptManager>

            <telerik:RadGrid ID="rgGridSearch" 
                runat="server" 
                AutoGenerateColumns="False" 
                ShowStatusBar="True"
                Width="100%"
                AllowAutomaticInserts="True" 
                AllowAutomaticUpdates="True" 
                AllowPaging="true" 
                PageSize="10"
                Skin="WebBlue">
            
                <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
                            <MasterTableView 
                                EditMode="InPlace" 
                                CommandItemDisplay="top" 
                               
                                >
                                <Columns>
                                <telerik:GridEditCommandColumn UniqueName="EditCommandColumnActivity">
                                    <HeaderStyle Width="80px"></HeaderStyle>
                                    <ItemStyle Width="80px"></ItemStyle>
                                </telerik:GridEditCommandColumn>
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>

                        <telerik:RadGrid 
                            ID="rgGridTemplate" 
                            runat="server"
                            DataSourceID="dsStaff"  
                            AutoGenerateColumns="False" 
                            ShowStatusBar="True" 
                            Width="100%"
                            AllowAutomaticInserts="True" 
                            AllowAutomaticUpdates="True"
                            Skin="WebBlue">
                            
                            <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
                            <MasterTableView 
                                EditMode="InPlace"
                                CommandItemDisplay="top" 
                                DataKeyNames="Staff_Member_ID" 
                                DataSourceID="dsStaff">
                                <Columns>
                                <telerik:GridEditCommandColumn UniqueName="EditCommandColumnActivity">

                                    <HeaderStyle Width="80px"></HeaderStyle>

                                    <ItemStyle Width="80px"></ItemStyle>

                                </telerik:GridEditCommandColumn>

                                    <telerik:GridBoundColumn DataField="Staff_Member_ID" DataType="System.Int32" FilterControlAltText="Filter Staff_Member_ID column" HeaderText="Staff_Member_ID" ReadOnly="True" SortExpression="Staff_Member_ID" UniqueName="Staff_Member_ID"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Staff_Member_First_Name" FilterControlAltText="Filter Staff_Member_First_Name column" HeaderText="First Name" SortExpression="Staff_Member_First_Name" UniqueName="Staff_Member_First_Name"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Staff_Member_Last_Name" FilterControlAltText="Filter Staff_Member_Last_Name column" HeaderText="Last Name" SortExpression="Staff_Member_Last_Name" UniqueName="Staff_Member_Last_Name"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Staff_Member_Middle_Initial" FilterControlAltText="Filter Staff_Member_Middle_Initial column" HeaderText="Middle Initial" SortExpression="Staff_Member_Middle_Initial" UniqueName="Staff_Member_Middle_Initial"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Staff_Member_Email_Address" FilterControlAltText="Filter Staff_Member_Email_Address column" HeaderText="Email" SortExpression="Staff_Member_Email_Address" UniqueName="Staff_Member_Email_Address"></telerik:GridBoundColumn>
                                    <telerik:GridCheckBoxColumn DataField="Staff_Member_Active" DataType="System.Boolean" FilterControlAltText="Filter Staff_Member_Active column" HeaderText="Active" SortExpression="Staff_Member_Active" UniqueName="Staff_Member_Active"></telerik:GridCheckBoxColumn>
                                </Columns>
                            </MasterTableView>

                        </telerik:RadGrid>

                        <asp:SqlDataSource ID="dsStaff" runat="server" 
                            
                            ConnectionString="<%$ ConnectionStrings:TestConnectionString %>" 
                            
                            SelectCommand="SELECT
                            [Staff_Member_ID], 
                            [Staff_Member_First_Name], 
                            [Staff_Member_Last_Name],
                            [Staff_Member_Middle_Initial], 
                            [Staff_Member_Email_Address], 
                            [Staff_Member_Active] 
                            
                            FROM [buStaff_Member]" 
                            
                            DeleteCommand="
                            DELETE FROM [buStaff_Member] 
                            WHERE [Staff_Member_ID] = @Staff_Member_ID" 
                            
                            InsertCommand="INSERT INTO [buStaff_Member] 
                            ([Staff_Member_First_Name],
                            [Staff_Member_Last_Name],
                            [Staff_Member_Middle_Initial], 
                            [Staff_Member_Email_Address],
                            [Staff_Member_Active]) 
                            
                            VALUES (@Staff_Member_First_Name,
                            @Staff_Member_Last_Name, 
                            @Staff_Member_Middle_Initial,
                            @Staff_Member_Email_Address,
                            @Staff_Member_Active)" 
                            
                            UpdateCommand="UPDATE [buStaff_Member]
                            SET [Staff_Member_First_Name] = @Staff_Member_First_Name,
                            [Staff_Member_Last_Name] = @Staff_Member_Last_Name,
                            [Staff_Member_Middle_Initial] = @Staff_Member_Middle_Initial,
                            [Staff_Member_Email_Address] = @Staff_Member_Email_Address,
                            [Staff_Member_Active] = @Staff_Member_Active 
                            
                            WHERE [Staff_Member_ID] = @Staff_Member_ID">

                            <DeleteParameters>
                                <asp:Parameter Name="Staff_Member_ID" Type="Int32" />
                            </DeleteParameters>
                            <InsertParameters>
                                <asp:Parameter Name="Staff_Member_First_Name" Type="String" />
                                <asp:Parameter Name="Staff_Member_Last_Name" Type="String" />
                                <asp:Parameter Name="Staff_Member_Middle_Initial" Type="String" />
                                <asp:Parameter Name="Staff_Member_Email_Address" Type="String" />
                                <asp:Parameter Name="Staff_Member_Active" Type="Boolean" />
                            </InsertParameters>
                            <UpdateParameters>
                                <asp:Parameter Name="Staff_Member_First_Name" Type="String" />
                                <asp:Parameter Name="Staff_Member_Last_Name" Type="String" />
                                <asp:Parameter Name="Staff_Member_Middle_Initial" Type="String" />
                                <asp:Parameter Name="Staff_Member_Email_Address" Type="String" />
                                <asp:Parameter Name="Staff_Member_Active" Type="Boolean" />
                                <asp:Parameter Name="Staff_Member_ID" Type="Int32" />
                            </UpdateParameters>
                        </asp:SqlDataSource>

        </div>
    </form>
</body>
</html>

========================================================================================================================

VB code

========================================================================================================================

Imports System.Data.SqlClient
Imports Telerik.Web.UI

Public Class ReferenceTables
  Inherits System.Web.UI.Page


  Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

    If Not IsPostBack Then
      SetupGrid()
    End If

  End Sub

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

  End Sub


  Private Sub SetupGrid()

    Dim Gridtype As String = Request.QueryString("type").ToString

    Select Case Gridtype
      Case "Staff"
        SetupStaffGrid()
' To Do - Other dynamic grids.

    End Select

  End Sub

#Region "Initialize Edit Grid"

  Private Sub SetupStaffGrid()


    ' The datasource will eventually be dynamic. For now, use the datasource on the form.
    ' Dim dsStaff As New SqlDataSource(dbData.GetConnection.ConnectionString, "SELECT Staff_Member_ID, Staff_Member_First_Name, Staff_Member_Last_Name, Staff_Member_Email_Address FROM buStaff_Member")

    rgGridSearch.DataSource = dsStaff
    rgGridSearch.MasterTableView.DataKeyNames = New String() {"Staff_Member_ID"}
    rgGridSearch.AllowPaging = True
    rgGridSearch.Skin = "WebBlue"

    'Add Staff table

    Dim boundColumn As New GridBoundColumn()

    SetupBoundColumn(rgGridSearch, "Staff_Member_ID", "Staff ID", False, True)
    SetupBoundColumn(rgGridSearch, "Staff_Member_First_Name", "First Name")
    SetupBoundColumn(rgGridSearch, "Staff_Member_Last_Name", "Last Name")
    SetupBoundColumn(rgGridSearch, "Staff_Member_Middle_Initial", "Middle Initial")
    SetupBoundColumn(rgGridSearch, "Staff_Member_eMail_Address", "Email")
    SetupBoundColumn(rgGridSearch, "Staff_Member_Active", "Active")


  End Sub

  Private Sub SetupBoundColumn(rg As RadGrid, DataField As String, HeaderText As String, Optional Visible As Boolean = True, Optional ReadOnlyField As Boolean = False)

    Dim boundColumn As New GridBoundColumn With {
      .DataField = DataField,
      .HeaderText = HeaderText,
      .Visible = Visible,
      .ReadOnly = ReadOnlyField
    }
    rg.MasterTableView.Columns.Add(boundColumn)

  End Sub

  Private Sub rgGridSearch_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles rgGridSearch.NeedDataSource

    SetupGrid()

  End Sub

#End Region

End Class

JenMaryland
Top achievements
Rank 1
 answered on 13 Aug 2020
1 answer
489 views

Hi all,

I cannot get the tabs to be the same width, even if I specify the width.  Also, the tab control does not fill the strip until the browser is resized.  Sadly I cannot provide screenshots but the tabs do not fill the entire strip as it leaves some of the strip bare.

 

 

 

 

UI:

            <telerik:RadTabStrip runat="server" ID="rts" Width="100%" AutoPostBack="False" 
                Skin="Silk" MultiPageID="rmp" SelectedIndex="0" 
                CausesValidation="False" Align="Justify"
                OnClientTabSelected="OnClientTabSelected" EnableAriaSupport="True" RenderMode="Classic">
                <KeyboardNavigationSettings CommandKey="Alt" FocusKey="T" />
                <Tabs>
                    <telerik:RadTab Text="Text" PageViewID="pv1" Value="pv1" Selected="True"></telerik:RadTab>
                    <telerik:RadTab Text="Some Text" PageViewID="pv2" Value="pv2"></telerik:RadTab>
                    <telerik:RadTab Text="Some More TextView" PageViewID="pv3" Value="pv3"></telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>

 

CSS:

        .RadTabStrip_Silk .rtsLevel1 .rtsLink,
        .RadTabStrip_Silk .rtsLevel1 .rtsLink:hover,
        .RadTabStrip_Silk .rtsLevel1 .rtsSelected:hover {
            background-color: blue !important;
            color: white !important;
            background-image: none !important;
        }

        .RadTabStrip_Silk .rtsLevel1 .rtsSelected {
            background-color: red !important;
            color: white !important;
            text-align: center;
            background-image: none !important;
        }

 

Thanks,

Attila Antal
Telerik team
 answered on 13 Aug 2020
3 answers
775 views
Hi Team,
    I have rad grid with checkboxes in itemtemplate,after binding values in grid, i need to show confirmation alert msg box (with yes and no), if click no , then not call sever side, if yes then call server side code and proceed with checked or unchecked code.Here i paste client and server side code for ur reference.I can show msg and trigger sierver side code.
But in OnClientCheckedChanging even, if i pur if condition , always it reach else condtion,even statement is true.

Client side code : 
    function radchkClicking(sender, args) {
           
           // alert(sender.get_checked());
            var chkstatus1 = sender.get_checked(); // here if i declare variable and pass value as true, then it reach if condiftion, if get from checkbox sender event ,always reach else condition.
             if (chkstatus == "true") {
                args.set_cancel(!window.confirm("Are you sure want to InActive?"));
            }
            else {
                args.set_cancel(!window.confirm("Are you sure want to Active?"));

            }

        }

Rad Grid columns:

 <Columns>
<telerik:GridBoundColumn  HeaderStyle-Font-Size="13px"  ItemStyle-Font-Size="12px" HeaderStyle-ForeColor ="Black" ItemStyle-ForeColor ="Black"  HeaderStyle-Width="100px" HeaderText="ID" DataField="ID" UniqueName="ID">
                                    </telerik:GridBoundColumn>
                                  

                                      <telerik:GridTemplateColumn HeaderStyle-Font-Size="13px"  HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle"  ItemStyle-Font-Size="12px" HeaderStyle-ForeColor ="Black" ItemStyle-ForeColor ="Black" HeaderStyle-Width="70px" HeaderText="Account Status">
                                        <ItemTemplate>
                                         
                                                <telerik:RadCheckBox ID="radchkStatus" runat="server" OnClientCheckedChanging="radchkClicking"     OnClick="radchkStatus_Click" ToolTip='<%# Bind("id") %>'    >
                                                </telerik:RadCheckBox>

                                         </ItemTemplate>
                                          </telerik:GridTemplateColumn>
</Columns>

Pls replay asap
Thanks
Peter Milchev
Telerik team
 answered on 13 Aug 2020
3 answers
298 views

I am attempting to reduce the amount of cell padding in my multi-level grouped grid (2 levels w/ subtotals and totals).

I have successfully reduced the top and botton cell padding on the GridHeaderItem, GridGroupHeaderItem, and GridDataItem.

However, for the life of me I cannot figure out how to change the cell padding in the GridGroupFooterItem.

The same mechanism I tried for the other items hasn't worked.

 

protected void RadGrid_Summary_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
  {
   if (e.Column is GridGroupSplitterColumn c)
   {
    c.HeaderStyle.Width = Unit.Pixel(10);
    c.HeaderStyle.Font.Size = FontUnit.Point(1);
    c.FooterStyle.Width = Unit.Pixel(10);
    c.FooterStyle.Font.Size = FontUnit.Point(1);
    c.ItemStyle.Width = Unit.Pixel(10);
    c.ItemStyle.Font.Size = FontUnit.Point(1);
    c.Resizable = false;
   }
  }
 
  protected void RadGrid_Summary_ItemCreated(object sender, GridItemEventArgs e)
  {
   if (e.Item is GridGroupHeaderItem headerItem)
   {
    headerItem.CssClass = "GridMinClass";
    if (headerItem.Cells.Count > 1 && headerItem.Cells[1].Controls.Count > 0 && headerItem.Cells[1].Controls[0] is Button headerButton1)
    {
     headerButton1.Visible = false;
     headerButton1.Height = Unit.Pixel(0);
    }
    if (headerItem.Cells.Count > 0 && headerItem.Cells[0].Controls.Count > 0 && headerItem.Cells[0].Controls[0] is Button headerButton2)
    {
     headerButton2.Visible = false;
     headerButton2.Height = Unit.Pixel(0);
    }
   }
   if (e.Item is GridGroupFooterItem footerItem)
   {
    footerItem.CssClass = "GridMinClass";
   }
   if (e.Item is GridDataItem dataItem)
   {
    dataItem.CssClass = "GridMinClass";
   }
  }
  
 
gridmin.css:
 
.GridMinClass {
 padding: 0;
 padding-left: 0;
 padding-right: 0;
 padding-top: 0;
 padding-bottom: 0;
}
Attila Antal
Telerik team
 answered on 12 Aug 2020
4 answers
120 views

I need to implement a custom paging template in a radgrid.

Is there a way to skin radbuttons in the paging template w/ the "standard" icons which normally appear in the paging template?

something like

<telerik:RadButton runat="server" ID="RadGrid_Button_PageFirst" CssClass="rgPageFirst" />

doesn't seem to work.

Doncho
Telerik team
 answered on 11 Aug 2020
1 answer
99 views

 Hi,

I have a slider with a number of sliding zones.

I want to save data (in server side) when I close/collapse one of these sliding zone.

I have collected the data in a hiddenfield using javascript.

Now I need to save the content of this hiddenfield in the database.

 

Thank you for your help

 

Anne

Vessy
Telerik team
 answered on 11 Aug 2020
1 answer
154 views

Hello!

I've been having problems attempting to reach values from my RadSpreadsheet component, which have been entered directly into the spreadsheet.

Retrieving cell values works fine when using a SpreadsheetDocumentProvider or a custom provider, which populates the RadSpreadsheet with sheets, rows and cell values. But only the initially populated cells have accessable values - if any new values were to be added, they would show up as NULL when I would try to reach them.

In the image I attempt to get a cell value (and save a referenced workbook) in a button click event.

 

Telerik UI for ASP.NET AJAX 2020.2.617

 

Peter Milchev
Telerik team
 answered on 11 Aug 2020
4 answers
150 views
Hello, I have some aspx pages already written and working with code-behind, I'd like to display these pages within a TABStrip...is there a way to load a webform into RadMultiPageView so each webform can be rendered within the tab when clicked...I'd perfer to not have to recreate all the webforms as ascx user controls.  I tried setting the NavigationURL of each tab but that just behaves like a hyperlink and redirects you to the aspx page you must press the BACK button to get back to the page with the TabStrip.

Thanks
Vessy
Telerik team
 answered on 11 Aug 2020
1 answer
168 views

Hi,

     I have a radtreeview which will order the hierarchy level by level. Here is the code

uiAvailableLocations.DataValueField = FujiXerox.Common.Systems.Sustainability.Constants.Location.ID;
uiAvailableLocations.DataTextField = FujiXerox.Common.Systems.Sustainability.Constants.Location.LocationName;
uiAvailableLocations.DataFieldID = FujiXerox.Common.Systems.Sustainability.Constants.Location.ID;
uiAvailableLocations.DataFieldParentID = FujiXerox.Common.Systems.Sustainability.Constants.Location.ParentID;
uiAvailableLocations.DataSource = ds;
uiAvailableLocations.DataBind();

 

The dataset ds will return the data in alphabetically order. At most times, the treeview can be sort in parent child order normally. But for some strange moments, it will just render the result alphabetically but not in parent child order. The code is same, however sometimes it just render the data alphabetically. What is the reason and how can I fix it?

 

Peter Milchev
Telerik team
 answered on 11 Aug 2020
2 answers
119 views

Hi I’ve got the problem with the radcalendar please see the attached as that shows you what i'm looking to produce.

 

This is the aspx;

<%@ Page Title="" Language="C#" MasterPageFile="~/App_Templates/Local/ConfigLayoutContainer.master" AutoEventWireup="true" CodeBehind="OnCall.aspx.cs" Inherits="ConfigurationModule.rota.OnCall" %>
<%@ Register TagPrefix="user" Namespace="TESTones.Web.UI.Telerik" Assembly="TESTones.Web.UI" %>
 
<asp:Content ID="Header" ContentPlaceHolderID="InstanceHeader" runat="server">
    <title>TESTones | Configuration Module | Manage Overtime</title>
    <link href="/styles/global.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .rcWeekend {
            background-color: #2291a1 !important;
        }
         
        .rcDisabled
        {
            background-color: #fb1f33 !important;
            border: 1px solid #fb1f33 !important;
            background-repeat: no-repeat;
            background-position: 5px 5px !important;
        }
    </style>
</asp:Content>
 
<asp:Content ID="Page" ContentPlaceHolderID="InstanceContent" runat="server">
 
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Modal="true" Width="800" Height="600" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"  >
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="btnSave">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="JustOnePanel" LoadingPanelID="LoadPanel1"></telerik:AjaxUpdatedControl>
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadAjaxLoadingPanel ID="LoadPanel1" runat="server">
</telerik:RadAjaxLoadingPanel>
 
<telerik:RadToolBar ID="RadToolBar1" runat="server" CssClass="PageMenu">
    <Items>
        <telerik:RadToolBarButton Value="Name" runat="server">
            <ItemTemplate>
                <h1>
                    <asp:Label ID="Label4" runat="server" Text="Manage On Call" /></h1>
            </ItemTemplate>
        </telerik:RadToolBarButton>
    </Items>
</telerik:RadToolBar>
     
 
    <div class="Form">
        <div class="ContentLeft" style="width: 200px;">
            <p>
                <asp:Label ID="lblEngineer" CssClass="formLabel" Text="Engineer" runat="server" />
                <telerik:RadComboBox ID="ddlEngineer"
                    runat="server" AppendDataBoundItems="true" AutoPostBack="True" Filter="Contains" EmptyMessage="Please Select..." CssClass="SearchFormDropdown" EnableLoadOnDemand="True"
                                     OnSelectedIndexChanged="ddlEngineer_SelectedIndexChanged"/>
            </p>
        </div>
        <div>
            <telerik:RadCalendar Width="350px" Height="200px" ID="RadCalendar1" runat="server" EnableMultiSelect="True" AutoPostBack="True" CultureInfo="en-GB"
                                  OnSelectionChanged="RadCalendar1_SelectionChanged">
                <WeekendDayStyle CssClass="rcWeekend" />
                <CalendarTableStyle CssClass="rcMainTable" />
                <OtherMonthDayStyle CssClass="DayStyle" />
                <OutOfRangeDayStyle CssClass="rcOutOfRange" />
                <DisabledDayStyle CssClass="rcDisabled" />
                <SelectedDayStyle CssClass="rcSelected" />
                <DayOverStyle CssClass="rcHover" />
                <FastNavigationStyle CssClass="RadCalendarMonthView RadCalendarMonthView_WebBlue" />
                <ViewSelectorStyle CssClass="rcViewSel" />
                <DayStyle CssClass="DayStyle" />
            </telerik:RadCalendar>
        </div>
         
        <telerik:RadAjaxPanel ID="JustOnePanel" runat="server">
 
            <div class="ContentRight">
                <p>
                    <div style="margin-top: 34px; margin-left: 15px;">
                        <telerik:RadButton  runat="server" ID="btnSave" Text="Save On Call Selection" OnClick="btnSaveChanges_Click" >
                            <Icon PrimaryIconLeft="5px" PrimaryIconTop="2px" PrimaryIconUrl="../images/icons/tick.png"  />
                        </telerik:RadButton>
                        <asp:Label ID="lblSaved" CssClass="formLabel" Text="Saved" ForeColor="green" runat="server" />
                    </div>
                </p>
            </div>
 
        </telerik:RadAjaxPanel>
    </div>
</asp:Content>

 

and this is the cs;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI;
using Ninject;
using Test.Core.Sevices;
using Telerik.Web.UI;
using Telerik.Web.UI.Calendar;
 
namespace ConfigurationModule.rota
{
    public partial class OnCall : Page
    {
        #region Dependency declarations
        [Inject]
        public IResourceService svcResourceService { get; set; }
        [Inject]
        public ICheapSingleUserStorageService svcUser { get; set; }
        #endregion
 
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lblSaved.Visible = false;
                BindEngineersDropDown();
                SetUpCalendar();
            }
        }
 
        protected void BindEngineersDropDown()
        {
            ddlEngineer.DataSource = svcResourceService.ListByContracts(svcUser.Get().ContractCollection().ToList());
            ddlEngineer.DataBind();
        }
 
        protected void ddlEngineer_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblSaved.Visible = false;
            SetUpCalendar();
        }
 
 
        protected void RadCalendar1_SelectionChanged(object sender, SelectedDatesEventArgs e)
        {
            lblSaved.Visible = false;
        }
 
 
        protected void SetUpCalendar()
        {
            RadCalendar1.RangeMinDate = DateTime.Today;
            RadCalendar1.SpecialDays.Clear();
            RadCalendar1.SelectedDates.Clear();
 
            var onCallList = svcResourceService.GetOnCallList(ddlEngineer.SelectedValue).ToList();
 
            foreach (var rotaOverride in onCallList)
            {
                var calendarDay = new RadCalendarDay { Date = rotaOverride.Date };
 
                 
                if (rotaOverride.TypeId == 2)
                {
                    calendarDay.ItemStyle.CssClass = "rcSelected2";
                    calendarDay.IsSelectable = false;
                    RadCalendar1.SpecialDays.Add(calendarDay);
                }
                else
                {
                    RadCalendar1.SelectedDates.Add(new RadDate(rotaOverride.Date));
                }
 
                 
            }
        }
 
        protected void btnSaveChanges_Click(object sender, EventArgs e)
        {
            List<DateTime> dates = new List<DateTime>();
 
            foreach (RadDate date in RadCalendar1.SelectedDates)
            {
                var d = date.Date;
                dates.Add(d);
            }
 
            svcResourceService.UpdateOnCallList(dates, ddlEngineer.SelectedValue.ToString());
            lblSaved.Visible = true;
        }
 
    }
}

Martin
Top achievements
Rank 1
 answered on 10 Aug 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?