Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
122 views
Hi All,

I have tried Telerik ASP.Net Ajax Component trial version, and I have development some simple application in visual studio and working well, but After I tried to publish and deploy in IIS, and try to call the application that I've developed before, the page /application not working properly, the page has showed but freeze, the ajax is not work. anoyone can help me?

nb:
I develop and publish in same machine (win server 2008 R2 64bit)

thanks,
Pantara
Rory
Top achievements
Rank 1
 asked on 20 Jun 2012
1 answer
66 views
Hello,

How could i change the following code in order to support multiple resources (ResourceType User cannot be concurrently to more than one ResourceType Room)?

using System.Web.UI;
using Telerik.Web.UI;
 
namespace Telerik.Web.Examples.Scheduler.Default
{
    public partial class DefaultCS : System.Web.UI.Page
    {
        private const int AppointmentsLimit = 1;
 
        private bool ExceedsLimit(Appointment apt)
        {
            int appointmentsCount = 0;
            foreach (Appointment existingApt in RadScheduler1.Appointments.GetAppointmentsInRange(apt.Start, apt.End))
            {
                if (existingApt.Visible)
                    appointmentsCount++;
            }
 
            return (appointmentsCount > AppointmentsLimit - 1);
        }
 
        private bool AppointmentsOverlap(Appointment appointment)
        {
            if (ExceedsLimit(appointment))
            {
                foreach (Appointment a in RadScheduler1.Appointments.GetAppointmentsInRange(appointment.Start, appointment.End))
                {
                    if (a.ID != appointment.ID)
                    {
                        return true;
                    }
                }
            }
 
            return false;
        }
 
        private void RegisterScript()
        {
            Label1.Text = "Invalid move! There are appointments arranged for this time period.";
            ScriptManager.RegisterClientScriptBlock(this, GetType(), "LabelUpdated",
                    "$telerik.$('.lblError').show().animate({ opacity: 0.9 }, 2000).fadeOut('slow');", true);
        }
 
        protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
        {
            if (ExceedsLimit(e.Appointment))
            {
                e.Cancel = true;
                RegisterScript();
            }
        }
 
        protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e)
        {
            if (AppointmentsOverlap(e.ModifiedAppointment))
            {
                e.Cancel = true;
                RegisterScript();
            }
        }
 
        protected void RadScheduler1_RecurrenceExceptionCreated(object sender, RecurrenceExceptionCreatedEventArgs e)
        {
            if(AppointmentsOverlap(e.ExceptionAppointment))
            {
                e.Cancel = true;
                RegisterScript();
            }
        }
    }
}


This is how did i try to give a solution to this problem:

protected bool ExceedsLimit(Appointment apt)
    {
        
        foreach (Appointment existingApt in RadScheduler1.Appointments.GetAppointmentsInRange(apt.Start, apt.End))
        {
            foreach (Resource existingRes in existingApt.Resources.GetResourcesByType("User"))
            {
 
                if (((apt.Resources.GetResource(existingRes.Type, existingRes.Key)) != null))
                {
                         
                        return true;
                }
            }
        }
     
        return false;
    }
 
    private bool AppointmentsOverlap(Appointment appointment)
    {
        
            foreach (Appointment a in RadScheduler1.Appointments.GetAppointmentsInRange(appointment.Start, appointment.End))
            {
                 
 
                    if (ExceedsLimit(appointment) && a.ID != appointment.ID)
                    {
                        return true;
                    }
                
            }
       
 
        return false;
    }
 
 
    protected void RadScheduler1_AppointmentInsert(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e)
    {
        if (ExceedsLimit(e.Appointment))
        {
            Messages.Text = "This resource has already been scheduled for this time slot.";
            e.Cancel = true;
            
 
 
             
        }
    }
 
    protected void RadScheduler1_AppointmentUpdate(object sender, Telerik.Web.UI.AppointmentUpdateEventArgs e)
    {
        if (AppointmentsOverlap(e.ModifiedAppointment))
        {
            Messages.Text = "This resource has already been scheduled for this time slot.";
            e.Cancel = true;
 
 
 
        }
    }

  Thank you very much.
Plamen
Telerik team
 answered on 20 Jun 2012
3 answers
68 views
Hi, I'm working with RadGrid in different pages of my website, usually those pages have headers controls and other buttons like Save, Close etc.

When the user is inserting or updating an item in the grid they usually don't see the checkmark button in the edit line and try to click others buttons in the page to save or commit changes.

I was wondering if it's possible to gray out all the page but the edit line inside the grid until the user save or cancel the changes using the grid line buttons, similar to the Radwindow behavior. this could be done using some radcontrols or there is any tweak to the radgrid to accomplish that?

Thanks a lot.
Shinu
Top achievements
Rank 2
 answered on 20 Jun 2012
6 answers
169 views
Good morning,

I have been trying to setup a RadScheduler using VS2010 and .NET 4.0 While trying to add the AdvancedForm.js

<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
        <Scripts>
            <asp:ScriptReference Path="AdvancedForm.js" />
        </Scripts>
    </asp:ScriptManagerProxy>

I get an error: ASP:Net tags: ASP.net tag asp:ScriptManagerProxy not registered

Any ideas?
Svetlozar
Telerik team
 answered on 20 Jun 2012
3 answers
146 views
Hi all I am having my textbox designed as follows

<telerik:RadMaskedTextBox Mask="###-##-####" runat="server" ID="txtSSN" Width="200px" AutoPostBack="true" OnTextChanged="ssnchanged">
        </telerik:RadMaskedTextBox>

On my server side code I code as follows

protected void ssnchanged(object sender, EventArgs e)
   {
       if (txtSSN.Text.Length != 9)
       {
          RadWindowManager1.VisibleOnPageLoad = true;
           string scriptstring = "radalert('You must save Employee Information to proceed further..', 250, 80,'Information');";
           ScriptManager.RegisterStartupScript(this, this.GetType(), "radalert", scriptstring, true);
       }
   }

But unable to load the Window can some one help me..
Shinu
Top achievements
Rank 2
 answered on 20 Jun 2012
3 answers
1.0K+ views
how to get the "Rad Editor" Control Content  value at the ClientSide (java Script), without postback.

Thanks & Regards
Srinivas
vishwa
Top achievements
Rank 1
 answered on 19 Jun 2012
1 answer
95 views
I am using jquery in a menu.  I would like to use the RadSplitter in the master page; however, when I roll over the dropdown gets cut off because of the RadPanel.  How can I get the menu to ignore the RadPanel line? (possibly a z index setting?)

<telerik:RadSplitter ID="SplitterMain" BorderStyle="None" PanesBorderSize="0"
                             BorderSize="0" runat="server" LiveResize="False"
                             ResizeWithParentPane="False" ResizeWithBrowserWindow="True" 
                             Orientation="Horizontal" Width="100%">
                <telerik:RadPane runat="server" Height="115px" Width="100%" Locked="true">
Header content
</telerik:RadPane>
<telerik:RadPane runat="server">
Body content
</telerik:RadPane>
<telerik:RadPane runat="server">
Footer content
</telerik:RadPane>
</telerik:RadSplitter>

Thanks.
Eric
Top achievements
Rank 1
 answered on 19 Jun 2012
2 answers
2.0K+ views
Hello,

I have a RadGrid control with a GridTemplateColumn. I need to hide an "Action" TemplateColumn in Edit mode and to display that colum in normal mode. I defined the following ItemDatabound event to hide the "Action" TemplateColumn:

protected void oRgRoulement_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
           // Hide the Action TemplateColumn in edit mode
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
                   (oRgRoulement.MasterTableView.GetColumn("Action") as GridTemplateColumn).Visible = false;
        }

What should I do to display the action TemplateColumn when the user will leave the edit mode ? In other words, how to determine if a row is already in edit mode ?

Thanks,

Steven




Jess
Top achievements
Rank 1
 answered on 19 Jun 2012
7 answers
255 views
Hi,

I am looking to implement a feature within the RadGrid that allows the pasting of clipboard information copied from an Excel sheet.

I found an old thread that seeks to implement this, and I managed to get it working with GridBoundColumns that contain a regular string. Basically, I copy items from Excel, I click on a cell in the Grid, then I click on a "Paste From Excel" button I added to the CommandItemTemplate, and it pastes the clipboard informatoin.

Thing is, I am having issues getting this to work with other types of columns, such as a GridDateTimeColumn or a GridNumericColumn.

In the case of the GridDateTimeColumn, nothing appears in the cell, and I'm thinking it's due to formatting issues within javascript.

In the case of the GridNumericColumn, the value is pasted into the cell, but as soon as I click on the cell, the value disappears.

Here's the javascript code:

var lastFocused;
 
                function pasteFromExcel() {
                    debugger;
                    if (!lastFocused) return;
                    var clipData = window.clipboardData.getData('Text');
                    var crlf = String.fromCharCode(13) + String.fromCharCode(10);
                    var table = clipData.split(crlf);
                    for (var tRow = 0; tRow < table.length - 1; tRow++)
                        table[tRow] = table[tRow].split(String.fromCharCode(9));
                    Array.remove(table, table[table.length - 1]);
                    fillTable(table);
                }
 
                function fillTable(table) {
                    var pCell = lastFocused.parentNode;
                    var pRow = pCell.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
                    var pBody = pRow.parentNode;
                    var maxRows = pBody.rows.length;
                    var maxCols = pRow.cells.length;
 
                    for (var row = 0; row < table.length; row++) {
                        for (var col = 0; col < table[row].length; col++) {
                            debugger;
                            var cCellIndex = pCell.parentNode.cellIndex + col;
                            var cRowIndex = pRow.sectionRowIndex + row;
 
                            if (cRowIndex < maxRows && cCellIndex < maxCols) {
                                var cCell = pBody.rows[cRowIndex].cells[cCellIndex];
                                var pInput = cCell.getElementsByTagName("input")[0];
 
                                pInput.style.backgroundColor = "#F7FAFF";
 
                                if (cCellIndex == 0)
                                    pInput.value = new Date(Date.parse(table[row][col]));
                                else if (cCellIndex == 2)
                                    pInput.value = parseFloat(table[row][col]);
                                else
                                    pInput.value = table[row][col];
                            }
                        }
                    }
                }
 
                function gridFocus(e) {
                    e = e || window.event;
                    var target = e.target || e.srcElement;
                    if (target.tagName.toLowerCase() == "input" && target.type.toLowerCase() == "text")
                        lastFocused = target;
                }

Please note that I hard-coded some condition checks for the cCellIndex variable for testing purposes.

Here's some of the relevant RadGrid definition:

<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="false" AllowMultiRowEdit="true"
    AutoGenerateColumns="false" AllowPaging="false" PageSize="1000" AllowSorting="True"
    CellSpacing="0" DataSourceID="RadGrid1TableDataSource" GridLines="None" Skin="Office2007"
    RegisterWithScriptManager="false" ShowFooter="true" EnableLinqExpressions="false" ValidationSettings-EnableValidation="false"  OnClick="gridFocus(event)">
 <MasterTableView EditMode="InPlace" DataKeyNames="PeriodID" AllowAutomaticDeletes="true"
        AllowAutomaticInserts="true" CommandItemDisplay="Bottom">
<columns>
<telerik:GridBoundColumn DataField="PeriodID" UniqueName="PeriodID"
                HeaderText="<%$ Resources:GlobalResources, PeriodID %>"
                Visible="false" />
<telerik:GridTemplateColumn DataField="RepaymentDate" UniqueName="RepaymentDate"
                HeaderText="<%$ Resources:GlobalResources, RepaymentDate %>"
                FooterText="Totals:">
                <ItemTemplate>
                    <%# DataBinder.Eval(Container.DataItem, "RepaymentDate", "{0:dd MMM yyyy}")%>
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadDatePicker ID="RepaymentDatePicker" runat="server" RegisterWithScriptManager="false"
                        SelectedDate='<%# DataBinder.Eval(Container.DataItem, "RepaymentDate") == DBNull.Value ? (DateTime?)null : DataBinder.Eval(Container.DataItem, "RepaymentDate")%>' />
                </EditItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadDatePicker ID="RepaymentDatePicker" runat="server" RegisterWithScriptManager="false" />
                </InsertItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn DataField="MovementTypeText" UniqueName="MovementTypeText"
                HeaderText="<%$ Resources:GlobalResources, MovementTypeText %>" />
            <telerik:GridNumericColumn DataField="OutstandingBeforeRepaymentAmount" UniqueName="OutstandingBeforeRepaymentAmount"
                HeaderText="<%$ Resources:GlobalResources, OutstandingBeforeRepaymentAmount %>"
                NumericType="Number" />
</columns>
<CommandItemTemplate>
            <table cellpadding="5" style="width: 100%">
                <tr>
                    <td align="left">
                        <asp:LinkButton ID="btnAddNewRecord" runat="server" CommandName="InitInsertSpecial">
                            <img style="border:0px" alt="" src="../Images/add.png" />Add New Record
                        </asp:LinkButton>
                        <telerik:RadNumericTextBox ID="txtLineNum" runat="server"
                            Type="Number" Value="1" MinValue="1" MaxValue="30" ClientEvents-OnKeyPress="CommandKeyPress">
                            <NumberFormat GroupSeparator="" DecimalDigits="0" />
                        </telerik:RadNumericTextBox>
                    </td>
                    <td align="center">
                        <asp:LinkButton ID="btnPasteFromExcel" runat="server" OnClientClick="pasteFromExcel(); return false;">
                            Paste From Excel
                        </asp:LinkButton>
                    </td>
                    <td align="right">
                        <asp:LinkButton ID="btnDeleteSelected" runat="server" CommandName="DeleteSelected"
                            OnClientClick="javascript:return confirm('Delete all selected periods?')">
                            <img src="../Images/delete.png" alt="" style="border:0px" />Delete Selected
                        </asp:LinkButton>
                    </td>
                </tr>
            </table>
        </CommandItemTemplate>
</MasterTableView>
</telerik:RadGrid>

I hope this is clear enough.

Anybody has any ideas?

Thank you.
Elsa
Top achievements
Rank 1
 answered on 19 Jun 2012
0 answers
159 views
This is my scenario:

Master Page.
centerBody div--> in content page the app generate programmatically a RadSplitter with 2 panes (left and center)

ContentPage --> add in center Pane grid.

I need do this grid with heigt = centerBody heigth or Splitter height.

this is my contentPage.aspx:


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">


            window.onload = regrid;         


            function regrid() {
                
/try1: this option
                var scrollArea = $find("<%= CommunityGrid.ClientID %>" +  "_GridData");
                if (scrollArea) {

// this isn't work 
                    scrollArea.style.height = 700 + "px";
                }
                   
//try 2: this option

var scrollArea = $find("<%= CommunityGrid.ClientID %>");
                if (scrollArea) {

// this isn't work 
                    scrollArea.get_element().style.height = 700 + "px";
                } 

            }


            function ShowEditForm(id, rowIndex) {


                var grid = $find("<%= CommunityGrid.ClientID %>");


                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                grid.get_masterTableView().selectItem(rowControl, true);


                var oWindow = window.radopen("CommunityForm.aspx?ID=" + id, "UserListDialog");




                return false;
            }


            function RowDblClick(sender, eventArgs) {
                editedRow = eventArgs.get_itemIndexHierarchical();
                $find("<%= CommunityGrid.ClientID %>").get_masterTableView().editItem(editedRow);
            }


            function ShowDelete(id, rowIndex) {
                var grid = $find("<%= CommunityGrid.ClientID %>");


                var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
                grid.get_masterTableView().selectItem(rowControl, true);


                var oWindow = window.radopen("DeleteCommunity.aspx?ID=" + id, "ConfirmDelete");


                return false;
            }




            function ShowInsertForm() {


                var oWindow = window.radopen("CommunityForm.aspx", "UserListDialog");


                return false;
            }




            function confirmCallBackFn(arg) {


                var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");


                if (arg == true)
                { ajaxManager.ajaxRequest("Remove"); }


            }


            function refreshGrid(arg) {


                if (arg != null) { $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest(arg); }
                else {
                    if (arg) {
                        $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest(arg);
                    }
                    else {
                        $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("RebindAndNavigate");
                    }
                }
            } 
              
        </script>
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManagerProxy ID="AjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="AjaxManagerProxy1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="CommunityGrid" LoadingPanelID="LoadginPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="CommunityGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="CommunityGrid" LoadingPanelID="LoadginPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <UC:header runat="server" ID="headerPage" />
    <div id="containerSubWHelp" runat="server" >
        <telerik:RadGrid ID="CommunityGrid" runat="server" OnNeedDataSource="CommunityGrid_NeedDataSource"
            OnUpdateCommand="CommunityGrid_UpdateCommand" OnInsertCommand="CommunityGrid_InsertCommand"
            AutoGenerateColumns="False" OnItemCommand="CommunityGrid_ItemCommand" OnPreRender="CommunityGrid_PreRender"
            OnItemCreated="CommunityGrid_ItemCreated" OnDeleteCommand="CommunityGrid_DeleteCommand"
            OnItemDataBound="CommunityGrid_ItemDataBound"  >
            <MasterTableView DataKeyNames="Id">
                <Columns>
                    <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" HeaderStyle-Width="25px"
                        AllowFiltering="false" Resizable="false">
                        <ItemTemplate>
                            <asp:ImageButton ID="EditLink" runat="server" ImageUrl="~/UI/Images/pencil.png">
                            </asp:ImageButton>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridEditCommandColumn HeaderStyle-Width="25px" UniqueName="EditCommandColumn"
                        ButtonType="ImageButton" EditImageUrl="../Images/grid_edit.png" Resizable="false">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridButtonColumn UniqueName="btnDelete" ConfirmDialogType="RadWindow" ButtonType="ImageButton"
                        CommandName="Delete" ConfirmDialogHeight="100px" ConfirmDialogWidth="300px" HeaderStyle-Width="25px"
                        Resizable="false" />
                    <telerik:GridTemplateColumn DataField="Id" HeaderText="Id" UniqueName="Id" Visible="false">
                        <InsertItemTemplate>
                            <telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Bind("Id") %>' Width="150px"
                                ReadOnly="true" Enabled="false" />
                        </InsertItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadTextBox ID="RadTextBox1" runat="server" Text='<%# Eval("Id") %>' ReadOnly="true"
                                Width="150px" />
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Name" UniqueName="Name" DataField="Name">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                                CssClass="validator" ControlToValidate="txtName"></asp:RequiredFieldValidator><br />
                            <asp:CustomValidator ID="cvName" CssClass="validator" OnServerValidate="cvName_ServerValidate"
                                Display="Dynamic" runat="server" ControlToValidate="txtName"></asp:CustomValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblName" runat="server" Width="200px" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Description" DataField="Description" UniqueName="Description">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDescription" Width="250px" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblDescription" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Description") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                <CommandItemTemplate>
                    <UC:AddButtons ID="AddButtons" runat="server" />
                </CommandItemTemplate>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick"    />
                <Scrolling UseStaticHeaders="true"/>
            </ClientSettings>
        </telerik:RadGrid>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
            <Windows>
                <telerik:RadWindow ID="UserListDialog" runat="server" Height="600px" Width="800px"
                    ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true" VisibleStatusbar="false"
                    Behaviors="Close" Skin="Vista" />
                <telerik:RadWindow ID="ConfirmDelete" runat="server" Skin="Vista" Left="15%" ReloadOnShow="true"
                    ShowContentDuringLoad="false" Modal="true" VisibleStatusbar="false" VisibleTitlebar="false"
                    Behaviors="Close" Height="150px" Width="300px" />
            </Windows>
        </telerik:RadWindowManager>
    </div>
</asp:Content>


Where is the error?

July
Top achievements
Rank 2
 asked on 19 Jun 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?