Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
98 views
Hi,

I am using a RadGrid with a HeaderContextMenu.  I would like to use a custom skin on the RadGrid (EnableEmbeddedSkins="false", Skin=""), but an embedded skin (Skin="Default") on the RadMenu/HeaderContextMenu.  How do I accomplish this?

Thanks,
Dave
Shinu
Top achievements
Rank 2
 answered on 31 May 2013
2 answers
113 views
Hello

I'm having trouble with a RadWindow, but first I want to quickly explain the order of the items that I have on the page.

Please see image001.png code corresponding to the following

<td colspan="6">
                   <telerik:RadTabStrip ID="tabInformation" runat="server" SelectedIndex="0" Width="100%"
                       MultiPageID="RadMultiPage1" CausesValidation="False" OnTabClick="tabInformation_TabClick">
                       <Tabs>
                           <telerik:RadTab runat="server" Text="Comentarios" Selected="True" PageViewID="Comments">
                           </telerik:RadTab>
                           <telerik:RadTab runat="server" Text="Teléfonos" PageViewID="Phones">
                           </telerik:RadTab>
                           <telerik:RadTab runat="server" Text="Direcciones" PageViewID="Address">
                           </telerik:RadTab>
                           <telerik:RadTab runat="server" Text="Correos Electrónicos" PageViewID="Emails">
                           </telerik:RadTab>
                       </Tabs>
                   </telerik:RadTabStrip>
                   <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">
 
                       <telerik:RadPageView ID="RadPageView4" runat="server" Width="100%">
                           <telerik:RadTextBox ID="txtComments" runat="server" Height="100px" TextMode="MultiLine" Width="550px"></telerik:RadTextBox>
                       </telerik:RadPageView>
                       <telerik:RadPageView ID="RadPageView1" runat="server">
                           <telerik:RadToolBar ID="radPhones" runat="server" OnButtonClick="radPhones_ButtonClick">
                               <Items>
                                   <telerik:RadToolBarButton runat="server" CommandName="New" ImageUrl="~/Images/ToolBar/new.png"
                                       Text="Nuevo" CausesValidation="false">
                                   </telerik:RadToolBarButton>
                               </Items>
                           </telerik:RadToolBar>
                           <telerik:RadGrid ID="dtgPhones" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None">
                               <ExportSettings>
                                   <Pdf PageWidth="" />
                               </ExportSettings>
                               <MasterTableView NoMasterRecordsText="No hay registros para mostrar.">
                                   <CommandItemSettings ExportToPdfText="Export to PDF" />
                                   <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True"></RowIndicatorColumn>
                                   <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True"></ExpandCollapseColumn>
                                   <Columns>
                                       <telerik:GridBoundColumn DataField="PHONE_ID" FilterControlAltText="Filter PHONE_ID column" HeaderText="ID" UniqueName="PHONE_ID" Visible="false"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="PERSON_ID" FilterControlAltText="Filter PERSON_ID column" HeaderText="ID_PERSON" UniqueName="PERSON_ID" Visible="false"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="INDICATIVE" FilterControlAltText="Filter INDICATIVE column" HeaderText="Indicativo" UniqueName="INDICATIVE"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="PHONE" FilterControlAltText="Filter NUMERO column" HeaderText="Número" UniqueName="NUMERO"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="EXTENSION" FilterControlAltText="Filter EXTENSION column" HeaderText="Ext." UniqueName="EXTENSION"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="TYPE_DESCRIPTION" FilterControlAltText="Filter TYPE_DESCRIPTION column" HeaderText="Tipo" UniqueName="TYPE_DESCRIPTION"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="TYPE" FilterControlAltText="Filter TYPE column" HeaderText="Tipo" UniqueName="TYPE" Visible="False">
                                       </telerik:GridBoundColumn>
                                       <telerik:GridCheckBoxColumn DataField="PRINCIPAL" FilterControlAltText="Filter PRINCIPAL column" HeaderText="Principal" UniqueName="PRINCIPAL">
                                           <HeaderStyle HorizontalAlign="Center" />
                                           <ItemStyle HorizontalAlign="Center" />
                                       </telerik:GridCheckBoxColumn>
                                       <telerik:GridCheckBoxColumn DataField="ACTIVE" FilterControlAltText="Filter ACTIVE column" HeaderText="Active" UniqueName="ACTIVE">
                                           <HeaderStyle HorizontalAlign="Center" />
                                           <ItemStyle HorizontalAlign="Center" />
                                       </telerik:GridCheckBoxColumn>
                                   </Columns>
                                   <PagerStyle PageSizeControlType="RadComboBox" />
                               </MasterTableView><PagerStyle PageSizeControlType="RadComboBox" />
                               <FilterMenu EnableImageSprites="False"></FilterMenu>
                           </telerik:RadGrid>
                       </telerik:RadPageView>
 
                       <telerik:RadPageView ID="RadPageView2" runat="server">
                           <telerik:RadGrid ID="dtgAddress" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None">
                               <ExportSettings>
                                   <Pdf PageWidth="" />
                               </ExportSettings>
                               <MasterTableView NoMasterRecordsText="No hay registros para mostrar.">
                                   <CommandItemSettings ExportToPdfText="Export to PDF" />
                                   <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                                       <HeaderStyle Width="20px" />
                                   </RowIndicatorColumn>
                                   <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                                       <HeaderStyle Width="20px" />
                                   </ExpandCollapseColumn>
                                   <Columns>
                                       <telerik:GridBoundColumn DataField="ADDRESS_ID" FilterControlAltText="Filter ADDRESS_ID column" HeaderText="ID" UniqueName="ADDRESS_ID" Visible="false"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="PERSON_ID" FilterControlAltText="Filter PERSON_ID column" HeaderText="PersonID" UniqueName="PERSON_ID" Visible="false"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="ADDRESS" FilterControlAltText="Filter ADDRESS column" HeaderText="Dirección" UniqueName="ADDRESS"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="TYPE" FilterControlAltText="Filter TYPE column" HeaderText="Tipo" UniqueName="TYPE" Visible="false"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="TYPE_DESCRIPTION" FilterControlAltText="Filter TYPE_DESCRIPTION column" HeaderText="Tipo" UniqueName="TYPE_DESCRIPTION"></telerik:GridBoundColumn>
                                       <telerik:GridCheckBoxColumn DataField="PRINCIPAL" FilterControlAltText="Filter PRINCIPAL column" HeaderText="Principal" UniqueName="PRINCIPAL">
                                           <HeaderStyle HorizontalAlign="Center" />
                                           <ItemStyle HorizontalAlign="Center" />
                                       </telerik:GridCheckBoxColumn>
                                       <telerik:GridCheckBoxColumn DataField="ACTIVE" FilterControlAltText="Filter ACTIVE column" HeaderText="Active" UniqueName="ACTIVE">
                                           <HeaderStyle HorizontalAlign="Center" />
                                           <ItemStyle HorizontalAlign="Center" />
                                       </telerik:GridCheckBoxColumn>
                                   </Columns>
                                   <PagerStyle PageSizeControlType="RadComboBox" />
                               </MasterTableView>
                               <PagerStyle PageSizeControlType="RadComboBox" />
                               <FilterMenu EnableImageSprites="False">
                               </FilterMenu>
                           </telerik:RadGrid>
                       </telerik:RadPageView>
                       <telerik:RadPageView ID="RadPageView3" runat="server">
                           <telerik:RadGrid ID="dtgEmails" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AutoGenerateColumns="False" CellSpacing="0" GridLines="None">
                               <ExportSettings>
                                   <Pdf PageWidth="" />
                               </ExportSettings>
                               <MasterTableView NoMasterRecordsText="No hay registros para mostrar.">
                                   <CommandItemSettings ExportToPdfText="Export to PDF" />
                                   <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                                       <HeaderStyle Width="20px" />
                                   </RowIndicatorColumn>
                                   <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                                       <HeaderStyle Width="20px" />
                                   </ExpandCollapseColumn>
                                   <Columns>
                                       <telerik:GridBoundColumn DataField="MAIL_ID" FilterControlAltText="Filter MAIL_ID column" HeaderText="ID" UniqueName="MAIL_ID" Visible="false"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="PERSON_ID" FilterControlAltText="Filter PERSON_ID column" HeaderText="PersonID" UniqueName="PERSON_ID" Visible="false"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="EMAIL" FilterControlAltText="Filter EMAIL column" HeaderText="Correo" UniqueName="EMAIL"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="TYPE" FilterControlAltText="Filter TYPE column" HeaderText="Tipo" UniqueName="TYPE" Visible="false"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn DataField="TYPE_DESCRIPTION" FilterControlAltText="Filter TYPE_DESCRIPTION column" HeaderText="Tipo" UniqueName="TYPE_DESCRIPTION"></telerik:GridBoundColumn>
                                       <telerik:GridCheckBoxColumn DataField="PRINCIPAL" FilterControlAltText="Filter PRINCIPAL column" HeaderText="Principal" UniqueName="PRINCIPAL">
                                           <HeaderStyle HorizontalAlign="Center" />
                                           <ItemStyle HorizontalAlign="Center" />
                                       </telerik:GridCheckBoxColumn>
                                       <telerik:GridCheckBoxColumn DataField="ACTIVE" FilterControlAltText="Filter ACTIVE column" HeaderText="Active" UniqueName="ACTIVE">
                                           <HeaderStyle HorizontalAlign="Center" />
                                           <ItemStyle HorizontalAlign="Center" />
                                       </telerik:GridCheckBoxColumn>
                                   </Columns>
                                   <EditFormSettings>
                                       <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                       </EditColumn>
                                   </EditFormSettings>
                                   <PagerStyle PageSizeControlType="RadComboBox" />
                               </MasterTableView>
                               <PagerStyle PageSizeControlType="RadComboBox" />
                               <FilterMenu EnableImageSprites="False">
                               </FilterMenu>
                           </telerik:RadGrid>
                       </telerik:RadPageView>
 
                   </telerik:RadMultiPage>
                   <telerik:RadWindowManager ID="RadWindowEditors" runat="server" Behaviors="Resize, Close, Move" VisibleStatusbar="False"></telerik:RadWindowManager>
               </td>

This is the problem
You can navigate the tabs without problems, but if the user is in the tab "Telefonos" and press the button Nuevo (New) shows the window see imagen002.png, the user can save or close and the window disappears, but when switching between tabs, the window reappears, as if the user would click on the button again.

The code of the Nuevo (New) button is as follows:

RadWindowEditors.Modal = true;
RadWindowEditors.CenterIfModal = true;
 
string url = string.Format("PersonsPhonesEditor.aspx?action=new&personID={0}", lblIDPerson.Text.Trim());
 
RadWindow newWindow = new RadWindow();
newWindow.NavigateUrl = url;
newWindow.VisibleOnPageLoad = true;
newWindow.Height = 300;
newWindow.Width = 550;
RadWindowEditors.Windows.Add(newWindow);


Thanks


Jhon Williams
Top achievements
Rank 1
 answered on 31 May 2013
1 answer
596 views
Hello, 
How to extract values from a GridEditFormItem from server side.
Here is my code.

ASP Markup :
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" CellSpacing="0"
    Skin="Transparent" GridLines="None" PageSize="10" AllowCustomPaging="True" AutoGenerateColumns="False"
    AllowSorting="True" OnItemDataBound="RadGrid1_ItemDataBound1" OnRowDrop="RadGrid1_OnRowDrop"
    AllowAutomaticUpdates="true" OnUpdateCommand="RadGrid1_UpdateCommand">
    <PagerStyle Mode="NumericPages" />
    <ClientSettings AllowRowsDragDrop="True">
        <Selecting AllowRowSelect="true" />
        <ClientEvents OnRowDropping="rowDropping" OnRowDblClick="RowDblClick" OnCommand="GridCommand" />
        <Resizing AllowColumnResize="true" />
    </ClientSettings>
    <MasterTableView AllowCustomPaging="False" AutoGenerateColumns="false" Caption="<%$Resources:BrandixResources, PWI_UnplannedItemsGrid_Title%>"
        Visible="True" DataKeyNames="ID, Effort" AllowNaturalSort="false" ClientDataKeyNames="Subject, Description, Effort">
        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
        <SortExpressions>
            <telerik:GridSortExpression FieldName="DueDateTime" SortOrder="Ascending" />
        </SortExpressions>
        <Columns>
            <telerik:GridBoundColumn UniqueName="ID" Visible="false" DataField="ID" ReadOnly="True">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="<%$Resources: Resources, Subject%>"
                DataField="Subject" UniqueName="Subject" ReadOnly="True">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="<%$Resources: Resources,  DueDate%>"
                DataField="DueDateTime" DataFormatString="{0:dd/MM/yyyy} {0:hh}:{0:mm} {0:tt}"
                ReadOnly="True">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="<%$Resources: Resources, Effort%>"
                DataField="Effort">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="<%$Resources: Resources,  UnplannedHours%>"
                DataField="UnplannedHours" ReadOnly="True">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn HeaderText="<%$Resources: Resources,  DraftPlan%>"
                UniqueName="DraftPlan" SortExpression="Status" ReadOnly="True">
                <ItemTemplate>
                    <asp:Label ID="lblGridStatus" runat="server" />
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn UniqueName="EditCommandColumn1">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
</telerik:RadGrid>

Javascript : 

var editedRow;
 
        function RowDblClick(sender, eventArgs) {
            editedRow = eventArgs.get_itemIndexHierarchical();
            $find("<%= RadGrid1.ClientID %>").get_masterTableView().editItem(editedRow);
        }
 
        function GridCommand(sender, args) {
            if (args.get_commandName() != "Edit") {
                editedRow = null;
            }
        }


C# code : 
Attempt 1 :
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem item = e.Item as GridEditableItem;
    Dictionary<string, string> values = new Dictionary<string, string>();
    item.ExtractValues(values);
    int id = Convert.ToInt32(item.GetDataKeyValue("ID"));
}

Attempt 2 : 
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem item = e.Item as GridEditableItem;
    Dictionary<string, string> values = new Dictionary<string, string>();
    e.Item.OwnerTableView.ExtractValuesFromItem(values, item);
}

When I double click a row, the edit form pops below the row. But when I change the value and click update. It is not getting the new value. Instead its getting the old value. Please tell me how to get the new value.

Img1 : The new value I entered,
Img2 : Value I get from the code.

Really need some help on this.
Elliott
Top achievements
Rank 2
 answered on 30 May 2013
7 answers
538 views
Hi All

I have a radgrid and a button

While clicking the button the datas in the radgrid in exported to the pdf.

But the font size in pdf is 12pt.

I want it to be 8pt.

Is there any possible way.

Thank you

-Anto
L
Top achievements
Rank 1
 answered on 30 May 2013
4 answers
197 views
I generate the columns for my RadGrid in code behind.  I do this by creating a DataTable from a stored procedure and then binding the DataTable to the RadGrid.  I now want to display a graphic in certain columns based in the information in that cell.  I normally do it in the .aspx code like this:
<telerik:GridTemplateColumn DataField="State" DataType="System.Boolean" FilterControlAltText="Filter Public column" HeaderText="State" SortExpression="State" UniqueName="State">
<ItemTemplate>
<asp:Image ID="Image1" ImageUrl="~/images/true.png" Visible='<%# (bool)Eval("State") == true %>' runat="server" />
<asp:Image ID="Image2" ImageUrl="~/images/false.png" Visible='<%# (bool)Eval("State") == false %>' runat="server" />
</ItemTemplate>
</telerikf:GridTemplateColumn>
I can't seem to figure out how to do this in code behind.  I can add an image to the column, but it is the same image for all cells in the column.  I don't know where to add code (in the column definition) that changes the image based on the value of the cell.  Here is how I create the column and add an image which is the same for all cells.         
string templateColumnName = dc.ColumnName;
GridTemplateColumn templateColumn = new GridTemplateColumn();
templateColumn.ItemTemplate = new MyItemTemplate(templateColumnName);
templateColumn.HeaderText = templateColumnName;
templateColumn.DataField = dc.ColumnName;
this.RadGrid1.MasterTableView.Columns.Add(templateColumn);
 
private class MyItemTemplate : ITemplate 
{ 
        protected Image myimage;
        private string colname;
        public MyItemTemplate(string cName) 
        { 
            colname = cName; 
        } 
        public void InstantiateIn(System.Web.UI.Control container) 
        {
            myimage = new Image();
            myimage.ImageUrl = "";  // Setting an image here works, but is the same for all cells
            myimage.ID = "templateColumnImage";
            container.Controls.Add(myimage);            
       } 
}

I have thought of adding the rows to the RadGrid one at a time, but I would rather define the column and then just bind the RadGrid to the DataTable.  I also want to select between more than two images, so the "Visable = (bool)Eval" in the first example is not sufficient, but I figure I can change a given solution to work how I want it. 
Scott
Top achievements
Rank 1
 answered on 30 May 2013
3 answers
229 views
Hi, I'm trying to use a RadDatePicker inside a Repeater. In the ItemDataBound event, I want to get a reference to the RadDatePicker. However, when I do this:
RadDatePicker dtStart = item.FindControl("dtStart") as RadDatePicker; 

I get this error:

Cannot convert type 'System.Web.UI.Control' to 'Telerik.Web.UI.Skins.RadDatePicker' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion 

I know I've done something similar when the RadDatePicker is inside an edit template of a RadGrid. Is there anyway to accomplish this?
Matt
Top achievements
Rank 1
 answered on 30 May 2013
1 answer
80 views
Does anybody know what the date was of the first release of the Telerik Control library for support of IE 9 and IE 10 ??????

Thanks.
Caleb
Top achievements
Rank 1
 answered on 30 May 2013
4 answers
217 views
I have the following code wit an inlineEditTemplate. I am not getting the correct value for the AppointmentTypeID on appointment insert.  The value is always one, regardless of the value selected in the radcombobox. What Am I missing or doing wrong?
<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="WorkPlanProject.Master"
    CodeBehind="PersonalCalendar.aspx.vb" Inherits="WQS_Presentation.PersonalCalendar"
    Title="Calendar" %>
  
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../StyleSheets/VesselSheet.css" rel="stylesheet" type="text/css" />
    <link href="../StyleSheets/welcome.css" type="text/css" />
  
    <script src="../Scripts/jquery-1.4.2.js" type="text/javascript"></script>
  
    <script src="../Scripts/welcome.js" type="text/javascript"></script>
  
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  
    <script type="text/javascript">
  
        /* Firefox resize scrollable content */
        function hideScrollableArea(sender, eventArgs) {
            if ($telerik.isFirefox)
                $telerik.$('.rsContentScrollArea').css('overflow', 'hidden');
        }
        function showScrollableArea(sender, eventArgs) {
            if ($telerik.isFirefox)
                $telerik.$('.rsContentScrollArea').css('overflow', 'auto');
        }
       
    </script>
  
    <div>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Office2007" />
        <div>
            <div>
                My Schedule</div>
            <telerik:RadSplitter runat="server" ID="RadSplitter1" PanesBorderSize="0" Width="734px"
                Height="552px" Skin="Office2007">
                <telerik:RadPane runat="Server" ID="leftPane" Width="240px" MinWidth="240" MaxWidth="300"
                    Scrolling="None" OnClientResizing="hideScrollableArea" OnClientResized="showScrollableArea"
                    OnClientExpanding="hideScrollableArea" OnClientExpanded="showScrollableArea"
                    OnClientCollapsing="hideScrollableArea" OnClientCollapsed="showScrollableArea">
                    <div>
                        <telerik:RadCalendar runat="server" ID="RadCalendar1" Skin="Office2007" AutoPostBack="true"
                            EnableMultiSelect="false" DayNameFormat="FirstTwoLetters" EnableNavigation="true"
                            EnableMonthYearFastNavigation="false" OnSelectionChanged="RadCalendar1_SelectionChanged"
                            OnDefaultViewChanged="RadCalendar1_DefaultViewChanged">
                        </telerik:RadCalendar>
                        <telerik:RadCalendar runat="server" ID="RadCalendar2" Skin="Office2007" AutoPostBack="true"
                            EnableMultiSelect="false" DayNameFormat="FirstTwoLetters" EnableNavigation="false"
                            EnableMonthYearFastNavigation="false" OnSelectionChanged="RadCalendar2_SelectionChanged">
                        </telerik:RadCalendar>
                        <asp:SqlDataSource ID="SqlDSAppointmentTypes" runat="server" ConnectionString="<%$ ConnectionStrings:DATACOREConnectionString %>"
                            SelectCommand="usp_UIGetAppointmentTypes" SelectCommandType="StoredProcedure">
                        </asp:SqlDataSource>
                    </div>
                    <telerik:RadPanelBar runat="server" Skin="Office2007" ID="PanelBar" Width="100%">
                        <Items>
                            <telerik:RadPanelItem runat="server" Text="My Team Calendars" Expanded="true">
                                <Items>
                                    <telerik:RadPanelItem runat="server">
                                        <ItemTemplate>
                                            <div>
                                                <div>
                                                    <asp:CheckBox ID="chkDevelopment" runat="server" Text="Development" Checked="true"
                                                        AutoPostBack="true" OnCheckedChanged="CheckBoxes_CheckedChanged" />
                                                </div>
                                                <div>
                                                    <asp:CheckBox ID="chkMarketing" runat="server" Text="Marketing" Checked="true" AutoPostBack="true"
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" />
                                                </div>
                                                <div>
                                                    <asp:CheckBox ID="CheckBox1" runat="server" Text="Inspections" Checked="true" AutoPostBack="true"
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" />
                                                </div>
                                            </div>
                                        </ItemTemplate>
                                    </telerik:RadPanelItem>
                                </Items>
                            </telerik:RadPanelItem>
                            <telerik:RadPanelItem runat="server" Text="My Calendar" Expanded="true">
                                <Items>
                                    <telerik:RadPanelItem runat="server">
                                        <ItemTemplate>
                                            <div>
                                                <div>
                                                    <asp:CheckBox ID="chkQ1" runat="server" Text="Personal" Checked="true" AutoPostBack="true"
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" />
                                                </div>
                                                <div>
                                                    <asp:CheckBox ID="chkQ2" runat="server" Text="Work" Checked="true" AutoPostBack="true"
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" />
                                                </div>
                                            </div>
                                        </ItemTemplate>
                                    </telerik:RadPanelItem>
                                </Items>
                            </telerik:RadPanelItem>
                        </Items>
                    </telerik:RadPanelBar>
                </telerik:RadPane>
                <telerik:RadSplitBar runat="server" ID="RadSplitBar2" CollapseMode="Forward" />
                <telerik:RadPane runat="Server" ID="rightPane" Scrolling="None" Width="590px">
                    <telerik:RadScheduler runat="server" ID="RadScheduler1" Skin="Office2007" Height="551px"
                        ShowFooter="true" DayStartTime="08:00:00" DayEndTime="21:00:00" FirstDayOfWeek="Monday"
                        LastDayOfWeek="Friday" EnableDescriptionField="true" DataKeyField="AppointmentID"
                        DataSubjectField="AppointmentSubject" DataStartField="AppointmentStartDate" DataEndField="AppointmentEndDate"
                        AppointmentStyleMode="Default" OnNavigationComplete="RadScheduler1_NavigationComplete"
                        OnAppointmentDataBound="RadScheduler1_AppointmentDataBound" OnAppointmentDelete="RadScheduler1_AppointmentDelete"
                        OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
                        EnableCustomAttributeEditing="true" AdvancedForm-Enabled="true">
                        <AdvancedForm Modal="false" DateFormat="M/d/yyyy" TimeFormat="h:mm tt" Enabled="true" />
                        <TimelineView UserSelectable="false" />
                        <ResourceTypes>
                            <telerik:ResourceType KeyField="AppointmentTypeID" Name="AppointmentTypes" TextField="AppointmentTypeName"
                                ForeignKeyField="AppointmentTypeID" DataSourceID="SqlDSAppointmentTypes" />
                            <telerik:ResourceType KeyField="AppointmentOwnerID" Name="User" TextField="UserName"
                                ForeignKeyField="AppointmentOwnerPersonID" />
                        </ResourceTypes>
                        <ResourceStyles>
                            <%--AppointmentStyleMode must be explicitly set to Default (see above) otherwise setting BackColor/BorderColor
                         will switch the appointments to Simple rendering (no rounded corners and gradients)--%>
                            <telerik:ResourceStyleMapping Type="Calendar" Text="Development" BackColor="#D0ECBB"
                                BorderColor="#B0CC9B" />
                            <telerik:ResourceStyleMapping Type="Calendar" Text="Marketing" ApplyCssClass="rsCategoryRed" />
                            <telerik:ResourceStyleMapping Type="Calendar" Text="Work" ApplyCssClass="rsCategoryOrange" />
                        </ResourceStyles>
                        <AppointmentTemplate>
                            <span style="font-weight: bold; font-size: xx-small">
                                <br />
                                <h2>
                                    <%# Eval("Subject") %></h2>
                            </span>
                            <br />
                            <b>Starts on: </b><%# Eval("Start")%>   <b>Ends on: </b><%# Eval("End") %>  
                        </AppointmentTemplate>
                        <InlineInsertTemplate>
                            <div>
                                <table width="734px">
                                    <tr>
                                        <td>
                                            <%--Subject--%>
                                            <asp:Label ID="lblSubject" Text="Subject: " runat="server" Font-Bold="true" Font-Size="XX-Small"></asp:Label>
                                            <telerik:RadTextBox ID="RadTextBox1" runat="server" Skin="Sunset" Text='<%# Bind("Subject") %>'>
                                            </telerik:RadTextBox>
                                        </td>
                                    </tr>
                                    <%--Start and End times--%>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblStartOn" runat="server" Font-Size="XX-Small" Text="Starts on" Font-Bold="true"></asp:Label>
                                            <telerik:RadDateTimePicker ID="RadDateTimePicker1" Font-Size="XX-Small" Skin="Sunset"
                                                runat="server" SelectedDate='<%# Bind("Start")%>'>
                                            </telerik:RadDateTimePicker>
                                            <asp:Label ID="lblEndOn" runat="server" Font-Size="XX-Small" Text="Ends on" Font-Bold="true"></asp:Label>
                                            <telerik:RadDateTimePicker ID="RadDateTimePicker2" Font-Size="XX-Small" Skin="Sunset"
                                                runat="server" SelectedDate='<%# Bind("End")%>'>
                                            </telerik:RadDateTimePicker>
                                            <br />
                                            <telerik:RadComboBox ID="ddlAppointmentType" 
                                                runat="server" DataSourceID="SqlDSAppointmentTypes" DataTextField="AppointmentTypeName"
                                                DataValueField="AppointmentTypeID" AutoPostBack="true">
                                            </telerik:RadComboBox>
                                            <%--Ok and cancel buttons floated right--%>
                                            <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">
                                                <asp:Image runat="server" ID="insertImage" ImageUrl="~/Images/Buttons/ok_checkmark_green.png"
                                                    AlternateText="insert" />
                                            </asp:LinkButton>
                                            <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel">
                                                <asp:Image runat="server" ID="Image2" ImageUrl="~/Images/Buttons/CancelItem.png"
                                                    AlternateText="cancel" />
                                            </asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </InlineInsertTemplate>
                        <InlineEditTemplate>
                            <div>
                                <table width="734px">
                                    <tr>
                                        <td>
                                            <%--Subject--%>
                                            <asp:Label ID="lblSubject" Text="Subject: " runat="server" Font-Bold="true" Font-Size="XX-Small"></asp:Label>
                                            <telerik:RadTextBox ID="RadTextBox1" runat="server" Skin="Sunset" Text='<%# Bind("Subject") %>'>
                                            </telerik:RadTextBox>
                                        </td>
                                    </tr>
                                    <%--Start and End times--%>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lblStartOn" runat="server" Font-Size="XX-Small" Text="Starts on" Font-Bold="true"></asp:Label>
                                            <telerik:RadDateTimePicker ID="RadDateTimePicker1" Font-Size="XX-Small" Skin="Sunset"
                                                runat="server" SelectedDate='<%# Bind("Start")%>'>
                                            </telerik:RadDateTimePicker>
                                            <asp:Label ID="lblEndOn" runat="server" Font-Size="XX-Small" Text="Ends on" Font-Bold="true"></asp:Label>
                                            <telerik:RadDateTimePicker ID="RadDateTimePicker2" Font-Size="XX-Small" Skin="Sunset"
                                                runat="server" SelectedDate='<%# Bind("End")%>'>
                                            </telerik:RadDateTimePicker>
                                            <%--Ok and cancel buttons floated right--%>
                                            <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">
                                                <asp:Image runat="server" ID="insertImage" ImageUrl="~/Images/Buttons/ok_checkmark_green.png"
                                                    AlternateText="insert" />
                                            </asp:LinkButton>
                                            <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel">
                                                <asp:Image runat="server" ID="Image2" ImageUrl="~/Images/Buttons/CancelItem.png"
                                                    AlternateText="cancel" />
                                            </asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </InlineEditTemplate>
                        <TimeSlotContextMenuSettings EnableDefault="true" />
                        <AppointmentContextMenuSettings EnableDefault="true" />
                    </telerik:RadScheduler>
                    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                        <AjaxSettings>
                            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                        </AjaxSettings>
                    </telerik:RadAjaxManager>
                </telerik:RadPane>
            </telerik:RadSplitter>
        </div>
    </div>
</asp:Content>
And the Code Behind:
Imports System
Imports Telerik.Web.UI
Imports System.Web.UI.WebControls
Imports Telerik.Web.UI.Calendar
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.IO
  
Partial Public Class PersonalCalendar
    Inherits System.Web.UI.Page
    Private AppointmentManager As New ABC_BusinessRules.ApointmentManager
    Private Const ProviderSessionKey As String = "Telerik.Web.Examples.Scheduler.Outlook2007.DefaultCS"
    Private checkBoxIDs As Dictionary(Of Integer, String)
    
      
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ' BindSchedular(DateTime.Today)
        checkBoxIDs = New Dictionary(Of Integer, String)()
        checkBoxIDs.Add(1, "chkDevelopment")
        checkBoxIDs.Add(2, "chkMarketing")
        checkBoxIDs.Add(3, "chkQ1")
        checkBoxIDs.Add(4, "chkQ2")
        'BindSchedular(RadScheduler1.SelectedDate)
        If Not IsPostBack Then
            BindSchedular(RadScheduler1.SelectedDate)
            RadCalendar1.SelectedDate = RadScheduler1.SelectedDate
            SyncCalendars()
        End If
  
        
  
    End Sub
    Protected Sub RadScheduler1_NavigationComplete(ByVal sender As Object, ByVal e As SchedulerNavigationCompleteEventArgs)
        RadCalendar1.FocusedDate = RadScheduler1.SelectedDate
        SyncCalendars()
    End Sub
  
    Protected Sub RadCalendar1_DefaultViewChanged(ByVal sender As Object, ByVal e As DefaultViewChangedEventArgs)
        SyncCalendars()
    End Sub
  
    Private Sub SyncCalendars()
        RadCalendar2.FocusedDate = RadCalendar1.FocusedDate.AddMonths(1)
    End Sub
  
    Protected Sub RadCalendar1_SelectionChanged(ByVal sender As Object, ByVal e As SelectedDatesEventArgs)
        If RadCalendar1.SelectedDates.Count > 0 Then
            RadScheduler1.SelectedDate = RadCalendar1.SelectedDate
            RadCalendar2.SelectedDate = RadCalendar1.SelectedDate
        End If
    End Sub
  
    Protected Sub RadCalendar2_SelectionChanged(ByVal sender As Object, ByVal e As SelectedDatesEventArgs)
        If RadCalendar2.SelectedDates.Count > 0 Then
            RadScheduler1.SelectedDate = RadCalendar2.SelectedDate
            RadCalendar1.SelectedDate = RadCalendar2.SelectedDate
        End If
    End Sub
  
    Protected Sub RadScheduler1_AppointmentDataBound(ByVal sender As Object, ByVal e As SchedulerEventArgs)
        Dim radCalendarDay As New RadCalendarDay(RadCalendar1)
        radCalendarDay.[Date] = e.Appointment.Start
        radCalendarDay.ItemStyle.CssClass = "DayWithAppointments"
        RadCalendar1.SpecialDays.Add(radCalendarDay)
        RadCalendar2.SpecialDays.Add(radCalendarDay)
  
        e.Appointment.Visible = True
  
        For Each key As Integer In checkBoxIDs.Keys
            Dim chkBox As CheckBox = TryCast(PanelBar.Items(0).Items(0).FindControl(checkBoxIDs(key)), CheckBox)
            If chkBox Is Nothing Then
                chkBox = TryCast(PanelBar.Items(1).Items(0).FindControl(checkBoxIDs(key)), CheckBox)
            End If
  
            If chkBox.Checked Then
                Dim userRes As Resource = e.Appointment.Resources.GetResource("Calendar", key.ToString())
                If userRes IsNot Nothing Then
                    e.Appointment.Visible = True
                End If
  
            End If
  
  
  
        Next
    End Sub
    Protected Sub RadScheduler1_AppointmentDelete(ByVal sender As Object, ByVal e As SchedulerCancelEventArgs)
        RadCalendar1.SpecialDays.Clear()
        RadCalendar2.SpecialDays.Clear()
    End Sub
    Protected Sub RadScheduler1_AppointmentUpdate(ByVal sender As Object, ByVal e As AppointmentUpdateEventArgs)
        RadCalendar1.SpecialDays.Clear()
        RadCalendar2.SpecialDays.Clear()
    End Sub
  
  
    Public Sub BindSchedular(ByVal SelectedDate As DateTime)
        'Get the Users Profile
        Dim strUserID As String
        Dim m As MembershipUser = Membership.GetUser()
        strUserID = m.UserName
        Dim iOwnerPersonID As Integer
        iOwnerPersonID = AppointmentManager.oDal.GetPersonIDbyUserName(strUserID)
        RadScheduler1.DataSource = AppointmentManager.GetAllItems(iOwnerPersonID)
        RadScheduler1.DataBind()
  
    End Sub
  
  
  
    Protected Sub RadScheduler1_AppointmentInsert(ByVal sender As Object, ByVal e As SchedulerCancelEventArgs)
        'If e.Appointment.Resources.Count < 1 Then
        '    e.Appointment.Resources.Add(RadScheduler1.Resources.GetResource("Calendar", "1"))
        'End If
        Dim AppointmentSet As New ABC_BusinessEntity.AppointmentSet
        Dim Appointment As New ABC_BusinessEntity.Appointment
        Dim dtAppointmentStart As DateTime
        Dim dtAppointmentEnd As DateTime
        Dim strAppointmentSubject As String
  
        'Subject
        If e.Appointment.Subject = String.Empty Then
            e.Cancel = True
            Exit Sub
        Else
            strAppointmentSubject = e.Appointment.Subject
        End If
        dtAppointmentStart = e.Appointment.Start
        dtAppointmentEnd = e.Appointment.End
  
        'Get the Users Profile
        Dim strUserID As String
        Dim m As MembershipUser = Membership.GetUser()
        strUserID = m.UserName
  
  
        'If e.Appointment.Resources.Count < 1 Then
        '    e.Appointment.Resources.Add(RadScheduler1.Resources.GetResource("AppointmentTypes", 1))
  
        'End If
  
        'If e.Appointment.Resources.GetResourceByType("AppointmentTypes") IsNot Nothing Then
        '    e.Appointment.Resources.Add(RadScheduler1.Resources.GetResource("AppointmentTypes", 1))
  
        'End If
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
        With Appointment
            '.AppointmentDescription=
            '.AppointmentDuration=
            .AppointmentEndDate = dtAppointmentEnd.ToUniversalTime
            '.AppointmentID=
            '.AppointmentLocationID=
            '.AppointmentLocationTypeID=
            .AppointmentOwnerPersonID = AppointmentManager.oDal.GetPersonIDbyUserName(strUserID)
            '.AppointmentRecurrenceParentID=
            '.AppointmentRecurrenceRuleID=
            .AppointmentRecurrenceState = 7
            '.AppointmentReminderID=
            .AppointmentResourceID = Nothing
            .AppointmentStartDate = dtAppointmentStart.ToUniversalTime
            .AppointmentSubject = strAppointmentSubject
            '.AppointmentTypeID = e.Appointment.Resources.GetResourceByType("AppointmentTypes").Key
  
            .AppointmentTypeID = RadScheduler1.Resources.GetResourceByType("AppointmentTypes").Key
  
  
  
  
            '.AppointmentTypeID = 
  
        End With
  
        'Insert into database...
        AppointmentSet.Add(Appointment)
        AppointmentManager.oDal.SaveAppointment(AppointmentSet)
        RadScheduler1.Rebind()
  
    End Sub
    Protected Sub ddlAppointmentType_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
  
    End Sub
    Protected Sub CheckBoxes_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)
        RadScheduler1.Rebind()
    End Sub
  
    Private Sub RadScheduler1_AppointmentCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentCreatedEventArgs) Handles RadScheduler1.AppointmentCreated
        'Dim appointmenttype As Resource = e.Appointment.Resources.GetResourceByType("AppointmentTypes")
        'Dim cbo As New RadComboBox
        'cbo = DirectCast(e.Container.FindControl("ddlAppointmentType"), RadComboBox)
        'cbo.SelectedValue = appointmenttype.Key
  
    End Sub
  
      
  
    Private Sub RadScheduler1_AppointmentDelete1(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerCancelEventArgs) Handles RadScheduler1.AppointmentDelete
        Dim AppointmentID As Integer = e.Appointment.ID
        AppointmentManager.oDal.DeleteAppointment(AppointmentID)
        RadScheduler1.Rebind()
  
    End Sub
  
    Private Sub RadScheduler1_AppointmentUpdate1(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentUpdateEventArgs) Handles RadScheduler1.AppointmentUpdate
        Dim AppointmentSet As New ABC_BusinessEntity.AppointmentSet
        Dim Appointment As New ABC_BusinessEntity.Appointment
        Dim dtAppointmentStart As DateTime
        Dim dtAppointmentEnd As DateTime
        Dim strAppointmentSubject As String
  
        'Subject
  
        If e.ModifiedAppointment.Subject = String.Empty Then
            e.Cancel = True
            Exit Sub
        Else
            strAppointmentSubject = e.ModifiedAppointment.Subject
        End If
        dtAppointmentStart = e.ModifiedAppointment.Start
        dtAppointmentEnd = e.ModifiedAppointment.End
  
        'Get the Users Profile
        Dim strUserID As String
        Dim m As MembershipUser = Membership.GetUser()
        strUserID = m.UserName
  
        With Appointment
            .AppointmentID = e.ModifiedAppointment.ID
            '.AppointmentDescription=
            '.AppointmentDuration=
            .AppointmentEndDate = dtAppointmentEnd
            '.AppointmentID=
            '.AppointmentLocationID=
            '.AppointmentLocationTypeID=
            .AppointmentOwnerPersonID = AppointmentManager.oDal.GetPersonIDbyUserName(strUserID)
            '.AppointmentRecurrenceParentID=
            '.AppointmentRecurrenceRuleID=
            .AppointmentRecurrenceState = 7
            '.AppointmentReminderID=
            .AppointmentResourceID = Nothing
            .AppointmentStartDate = dtAppointmentStart
            .AppointmentSubject = strAppointmentSubject
            .AppointmentTypeID = 1
  
  
        End With
  
        'Update database...
        AppointmentSet.Add(Appointment)
        AppointmentManager.oDal.UpdateAppointment(AppointmentSet)
        RadScheduler1.Rebind()
    End Sub
  
    Protected Function GetAvailableUsers(ByVal container As Control) As IEnumerable
        Dim appointment As Appointment = (DirectCast(container, SchedulerFormContainer)).Appointment
  
        Dim availableUsers As New List(Of Resource)(RadScheduler1.Resources.GetResourcesByType("User"))
        For Each appointmentInRange As Appointment In RadScheduler1.Appointments.GetAppointmentsInRange(appointment.Start, appointment.[End])
            If appointmentInRange Is appointment Then
                Continue For
            End If
  
            For Each occupiedUser As Resource In appointmentInRange.Resources.GetResourcesByType("User")
                availableUsers.Remove(occupiedUser)
            Next
        Next
  
        Return availableUsers
    End Function
  
    Private Sub RadScheduler1_FormCreating(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerFormCreatingEventArgs) Handles RadScheduler1.FormCreating
        If e.Mode = SchedulerFormMode.Insert OrElse e.Mode = SchedulerFormMode.AdvancedInsert Then
            e.Appointment.Resources.Add(RadScheduler1.Resources.GetResourceByType("AppointmentTypes"))
        End If
  
    End Sub
  
    Private Sub RadScheduler1_NavigationComplete1(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerNavigationCompleteEventArgs) Handles RadScheduler1.NavigationComplete
  
    End Sub
  
   
      
  
   
  
      
  
     
  
    
End Class



 

shahab
Top achievements
Rank 1
 answered on 30 May 2013
4 answers
1.3K+ views

I set GridBoundColumn DataField="id" Visible="false" and have <MasterTableView EditMode="PopUp">

When i click on edit the PopUp dialog display textfield with the id?
The update still works fine.....

I set GridBoundColumn ReadOnly="True" and now the id textfield is lost.
But now when i try update the PopUp form, it not work??

How to set the GridBoundColumn Visible="false" and not display it in the PopUp dialog?
Or have i missed something?

The DataField="id" is my update id.........

Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGrid1.UpdateCommand
    Dim editItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
    Dim newValues As New Hashtable()
    e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editItem)
    Dim UppdateId As String = newValues("id").ToString()

Carlin
Top achievements
Rank 1
 answered on 30 May 2013
2 answers
347 views
I have a table like this

<mastertableview datakeynames = "someid, otherid, ...">
<detailtables>
<gridtableview>
<detailtables>
<gridtableview>
<columns>
<gridtemplatecolumn>
<itemtemplate>
<a onClick = 'somejavascriptfunction( I need the value of someid from mastertableview here (how do i do it?)'> Text </a>
</itemtemplate>
</gridtemplatecolumn>
</column>
</gridtableview>
</detailtables>
</gridtableview>
</detailtables>
</masterview>
Janak
Top achievements
Rank 1
 answered on 30 May 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?