Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
133 views
Hello,

I've sound some other discussions in the forum on not posting back with a client search, but, I'd like it to leave the drop down open. This happens if the client search function throws an error, so I feel like there should be a way to tell it to cancel and not close the results box. Here's what I have right now:

function txtAutoSearch_Search(sender, args) {
    if (args.get_value() == null) {
        sender._element.control._postBackOnSearch = false;
    } else {
        sender._element.control._postBackOnSearch = true;
    }
}

This actually works very nicely as a way to make it so that, if they haven't selected a result, it won't post back. But, when people hit "enter", the results still close, and that confuses some folks. Is there a way to safely cancel the post and leave the box open? Basically, some line I could add after the "_postBackOnSearch = false;" bit?

Thanks,

Mike

Kasim
Top achievements
Rank 2
 answered on 12 Mar 2019
0 answers
186 views

I am trying to prevent users from creating overlapping events in our calendar.  I was able to implement this somewhat successfully using the demo at https://demos.telerik.com/aspnet-ajax/scheduler/examples/limitconcurrentappointments/defaultvb.aspx.  I am having an issue though due to the fact that we use a customized Advanced Form template for our events.  On insert or update, I can use the ExceedsLimit() function to cancel the insert or update, but the Advanced Form is cleared out and loses all of the information the user has entered.  Ideally we would present the user with an error message and allow them to fix the data rather than having to enter it all over from scratch.  Is this possible?

I updated the Advanced Insert and Edit Forms demo located at https://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultvb.aspx to demonstrate the issue.

DefaultVB.aspx

<%@ Page Language="vb" AutoEventWireup="true" Inherits="Scheduler.Examples.AdvancedFormTemplate.DefaultVB"
    CodeFile="DefaultVB.aspx.vb" MasterPageFile="~/MasterPageCDNDisabled.master" %>
 
<%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="scheduler" TagName="AdvancedForm" Src="AdvancedFormCS.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link rel="Stylesheet" type="text/css" href="styles.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceholder1" runat="Server">
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <telerik:RadScriptBlock runat="Server" ID="RadScriptBlock1">
        <script type="text/javascript" src="scripts.js"></script>
    </telerik:RadScriptBlock>
    <telerik:RadNotification runat="server" ID="RadNotification1" Title="Error" TitleIcon="warning" ContentIcon="warning"
        Position="Center" Width="430px" Height="200px" AutoCloseDelay="10000" ShowSound="warning" Font-Size="Large">
        <NotificationMenu Visible="false"></NotificationMenu>
    </telerik:RadNotification>
    <div class="demo-container no-bg">
        <telerik:RadScheduler RenderMode="Lightweight" runat="server" ID="RadScheduler1"
            SelectedDate="2012-04-16"
            OnDataBound="RadScheduler1_DataBound"
            OnAppointmentCreated="RadScheduler1_AppointmentCreated"
            OnAppointmentInsert="RadScheduler1_AppointmentInsert"
            OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
            OnClientFormCreated="schedulerFormCreated"
            CustomAttributeNames="AppointmentColor"
            EnableDescriptionField="true">
            <AdvancedForm Modal="true" EnableTimeZonesEditing="true" />
            <Reminders Enabled="true" />
            <AppointmentTemplate>
                <div class="rsAptSubject">
                    <%# Eval("Subject") %>
                </div>
                <%# Eval("Description") %>
            </AppointmentTemplate>
            <AdvancedEditTemplate>
                <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit"
                    Subject='<%# Bind("Subject") %>'
                    Description='<%# Bind("Description") %>'
                    Start='<%# Bind("Start") %>'
                    End='<%# Bind("End") %>'
                    RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'
                    Reminder='<%# Bind("Reminder") %>'
                    AppointmentColor='<%# Bind("AppointmentColor") %>'
                    UserID='<%# Bind("User") %>'
                    RoomID='<%# Bind("Room") %>'
                    TimeZoneID='<%# Bind("TimeZoneID") %>' />
            </AdvancedEditTemplate>
            <AdvancedInsertTemplate>
                <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert"
                    Subject='<%# Bind("Subject") %>'
                    Start='<%# Bind("Start") %>'
                    End='<%# Bind("End") %>'
                    Description='<%# Bind("Description") %>'
                    RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'
                    Reminder='<%# Bind("Reminder") %>'
                    AppointmentColor='<%# Bind("AppointmentColor") %>'
                    UserID='<%# Bind("User") %>'
                    RoomID='<%# Bind("Room") %>'
                    TimeZoneID='<%# Bind("TimeZoneID") %>' />
            </AdvancedInsertTemplate>
            <TimelineView UserSelectable="false" />
            <TimeSlotContextMenuSettings EnableDefault="true" />
            <AppointmentContextMenuSettings EnableDefault="true" />
        </telerik:RadScheduler>
    </div>
 
</asp:Content>

 

DefaultVB.aspx.vb

Imports System
Imports System.Web.UI
Imports System.Drawing
Imports System.Web.UI.WebControls
 
Imports Telerik.Web.UI
 
Namespace Scheduler.Examples.AdvancedFormTemplate
    Public Class DefaultVB
        Inherits System.Web.UI.Page
 
        Private Const ProviderSessionKey As String = "Telerik.Web.Examples.Scheduler.AdvancedFormTemplate.DefaultVB"
 
        ' You can safely ignore this method.
        ' Its purpose is to limit the changes to the underlying data only to the active user session.
        Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
 
            Dim manager As ScriptManager = RadScriptManager.GetCurrent(Page)
            manager.Scripts.Add(New ScriptReference(ResolveUrl("AdvancedForm.js")))
 
            Dim provider As XmlSchedulerProvider
            If ((Session(ProviderSessionKey) Is Nothing) _
               OrElse Not IsPostBack) Then
                provider = New XmlSchedulerProvider(Server.MapPath("~/App_Data/Appointments_CustomTemplates.xml"), False)
                Session(ProviderSessionKey) = provider
            Else
                provider = CType(Session(ProviderSessionKey), XmlSchedulerProvider)
            End If
            RadScheduler1.Provider = provider
        End Sub
 
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
            RadScheduler1.TimeZoneID = "Pacific Standard Time"
        End Sub
 
        Protected Sub RadScheduler1_DataBound(ByVal sender As Object, ByVal e As EventArgs)
            RadScheduler1.ResourceTypes.FindByName("User").AllowMultipleValues = True
            RadScheduler1.ResourceTypes.FindByName("Room").AllowMultipleValues = False
        End Sub
 
        Protected Sub RadScheduler1_AppointmentCreated(ByVal sender As Object, ByVal e As AppointmentCreatedEventArgs)
            If e.Appointment.RecurrenceState = RecurrenceState.Master OrElse e.Appointment.RecurrenceState = RecurrenceState.Occurrence Then
                Dim recurrenceStateDiv As New Label()
                recurrenceStateDiv.CssClass = "rsAptRecurrence"
                Dim recurrenceStateIcon As New Label()
                recurrenceStateIcon.CssClass = "t-font-icon t-i-recurrence"
                recurrenceStateDiv.Controls.Add(recurrenceStateIcon)
                e.Container.Controls.AddAt(0, recurrenceStateDiv)
            End If
            If e.Appointment.RecurrenceState = RecurrenceState.Exception Then
                Dim recurrenceStateDiv As New Label()
                recurrenceStateDiv.CssClass = "rsAptRecurrenceException"
                Dim recurrenceStateIcon As New Label()
                recurrenceStateIcon.CssClass = "t-font-icon t-i-recurrence-exception"
                recurrenceStateDiv.Controls.Add(recurrenceStateIcon)
                e.Container.Controls.AddAt(0, recurrenceStateDiv)
            End If
        End Sub
 
        Protected Sub RadScheduler1_AppointmentDataBound(ByVal sender As Object, ByVal e As SchedulerEventArgs)
            Dim colorAttribute As String = e.Appointment.Attributes("AppointmentColor")
            If Not String.IsNullOrEmpty(colorAttribute) Then
                Dim colorValue As Integer
                If Integer.TryParse(colorAttribute, colorValue) Then
                    Dim borderColorValue As Integer = CInt(If(colorValue < -&H7F7F7F, colorValue + &H202020, colorValue - &H202020))
                    e.Appointment.BackColor = Color.FromArgb(colorValue)
                    e.Appointment.BorderColor = Color.FromArgb(borderColorValue)
                End If
            End If
            e.Appointment.ToolTip = e.Appointment.Subject + ": " + e.Appointment.Description
        End Sub
 
        Protected Sub RadScheduler1_AppointmentInsert(sender As Object, e As SchedulerCancelEventArgs)
            If ExceedsLimit(e.Appointment) Then
                e.Cancel = True
                RadNotification1.Show("Cannot add appointment! There are too many appointments in this time slot. You can only have " & AppointmentsLimit)
            End If
        End Sub
 
        Private Const AppointmentsLimit As Integer = 1
 
        Private Function ExceedsLimit(apt As Appointment) As Boolean
            Dim appointmentsCount As Integer = 0
            For Each existingApt As Appointment In RadScheduler1.Appointments.GetAppointmentsInRange(apt.Start, apt.[End])
                If existingApt.Visible Then
                    appointmentsCount += 1
                End If
            Next
 
            Return (appointmentsCount > AppointmentsLimit - 1)
        End Function
    End Class
End Namespace
Michael
Top achievements
Rank 1
 asked on 11 Mar 2019
11 answers
649 views
Hello,

A while back I was using the normal RadChart and not the HTML version.  Once the HTML version came out I switched everything over to it and have been pretty happy.  Recently I have come across the problem where I have too many labels on the pie chart (i.e. there are many items that are 2% or less making up the chart) which makes the chart look pretty messy.

In the normal RadChart there was a way to hide the labels on the databind event if the value of the dataitem was less than a certain percentage.  However, I cannot seem to find a way to do this with the HTML chart.

Does anyone have an example how I can hide label that are less than a certain percentage on the HTML pie chart?

Thanks,.
Ron
Vessy
Telerik team
 answered on 11 Mar 2019
9 answers
1.1K+ views
I had added a RequiredFieldValidator to dropdownlist that make sure user had selected value before insert to db. but the checking is not working that will not prompt error message.

<telerik:RadDropDownList ID="rdl_bu" runat="server" DataSourceID="LDS_BU" DefaultMessage="Please select..."
 DataValueField="BU_ID" DataTextField="BU_name" AutoPostBack="true" >
</telerik:RadDropDownList>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="rdl_bu"
         InitialValue="Please Select..." ErrorMessage="Please select a Business Unit."></asp:RequiredFieldValidator>
Attila Antal
Telerik team
 answered on 11 Mar 2019
12 answers
611 views
Hi

The upload controls (buttons) don't render sometimes. It happens a couple of times and then works after a while.
I'm using 2012.3.1308.35.
Any idea what the causes may be?
Peter Milchev
Telerik team
 answered on 11 Mar 2019
1 answer
364 views

Hi Team,

Can we able to change the colour of pagination button (next, prev next , prev etc..) ?

Regards,

Ramesh.

 

Vessy
Telerik team
 answered on 11 Mar 2019
4 answers
309 views

When I click "add new row", required field validation raises exceptions/constraints one cell at a time. i.e. not allowing the rows data to be entered in any other order / or for the entire row to appear in edit mode.

behavior reproducible on BatchEditing demo page: http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

It seems like I would have noticed this before, so maybe it's update related: I have a RadGrid that has Batch Edit row mode enabled.

Is that intended? Can it be changed with an attribute? if not, how about some client side js? I'll be debugging, but would appreciate an available solution.

 

Thanks

 

 

Attila Antal
Telerik team
 answered on 11 Mar 2019
7 answers
314 views

I have a textbox filter on a radgrid and need to get all results between two integers. So I enter "1974 2000" and use the 'between' selection to get all values between 1974 and 2000. I now need to retrieve the current filter expression in order to pass to a stored procedure. I tried using FilterExpression like so:

string EntitySQL = grid.MasterTableView.FilterExpression;

and get: "((Convert.ToInt32(iif(it[InstallationYear\"]==Convert.DBNull,null,it[\"InstallationYear\"])) >= 1974) AND ( Convert.ToInt32(iif(it[\"InstallationYear\"]==Convert.DBNull,null,it[\"InstallationYear\"])) <= 2000))"

But when I use GetEntitySqlFilterExpression like so:

string EntitySQL = grid.MasterTableView.GetEntitySqlFilterExpression();

The result is blank. For some reason GetEntitySqlFilterExpression() does not process the "between" filtering command. I'd like to use this expression because it is much easier to understand and use. Does anyone know why the "between" filtering command is not recognized?

Marin Bratanov
Telerik team
 answered on 10 Mar 2019
2 answers
193 views

hello 

is there any way to filter the combobox by textbox using startwith and highlight all the startwith items ?

 

thanks

 

KinG
Top achievements
Rank 1
 answered on 10 Mar 2019
0 answers
86 views

Hello,

I'm trying to upload some file programmatically from a python script thru one of our forms but I've hit a stumbling block.

When I check the Web Inspector, I see that file uploads trigger a multi-part form POST that includes the below field:

ctl00_ContentPlaceHolder1_uFile_ClientState:
{  
   "isEnabled":"true",
   "uploadedFiles":[  
      {  
         "fileInfo":{  
            "FileName":"test.xlsx",
            "ContentType":null,
            "ContentLength":9365,
            "DateJson":"2019-03-08T16:00:12.472Z",
            "Index":0
         },
         "metaData":"long string of random gibberish"
      }
   ]
}

And this is where I'm having difficulties. If I copy the metadata field from the web inspector, and test using the same file that I used at the time, then it works. But if I try uploading another file then it fails. And I guess that it's because I am not updating the metadata field accordingly.

So, can someone help explain to me what goes into that field? And how is it encoded?

Any insight you could share would be greatly appreciated.

Hisham
Top achievements
Rank 1
 asked on 09 Mar 2019
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?