Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
173 views
Dear dude
I want to use RadScheuduler to design clinic scheduler with different doctors. I want to set doctors times in RadScheduler. Then Patient set specified work time in another form. doctor can work in different place. Please see the diagram. Now I have a problem in patient Appointment. I should set time slot disable/enable based on doctorAppointment And Then patient insert appointment for special doctor based on timeslot. I used entityframework but I got may error. How can I Access doctorAppointment in PatientAppointment?
I defiened resourceType for Room,Doctor,DoctorAppointment,AppointmentType but in insertForm I can not Access roomID and DoctorID which are in DoctorAppointmentTable.
RadScheduler:
<telerik:RadScheduler runat="server" ID="PatientsScheduler" GroupBy="Doctor"
                DataSourceID="PatientsAppointmentEntityDataSource" DataKeyField="Id" DataSubjectField="FirstName"
                DataStartField="Start" DataEndField="End"  ....>
InsertTemplate Which has error to find FirstName:
    <InlineInsertTemplate>                 
                            <asp:Label ID="Label4" AssociatedControlID="FirstNameTextBox" runat="server" CssClass="inline-label"/>
                            <asp:TextBox ID="FirstNameTextBox" Rows="2" Columns="20" runat="server" Text='<%# Bind("FirstName") %>'
                                Width="97%" TextMode="MultiLine"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="FirstNameRequiredFieldValidator" runat="server" ValidationGroup="Insert"
                                ControlToValidate="FirstNameTextBox" ErrorMessage="نام بیمار اجباری">*</asp:RequiredFieldValidator>
                            <br />                      
                            <asp:Label ID="Label5" AssociatedControlID="StartInput" runat="server" CssClass="inline-label"/>
                            <telerik:RadDateInput ID="StartInput" SelectedDate='<%# Bind("Start") %>' runat="server"
                                EnableSingleInputRendering="false">
                            </telerik:RadDateInput>                            
                            <br />                    
                            <asp:Label ID="Label3" AssociatedControlID="AppointmentTypeComboBox" runat="server" />
                            <telerik:RadComboBox runat="server" ID="AppointmentTypeComboBox" DataTextField="Name"
                                DataValueField="Id" Width="90%" Skin="Office2007" SelectedValue='<%# Bind("AppointmentTypeId") %>'
                                DataSourceID="AppointmentTypesEntityDataSource">
                            </telerik:RadComboBox>                                    
                </InlineInsertTemplate>
ResourceTypes are:
   <ResourceTypes>                 
                    <telerik:ResourceType KeyField="Id" Name="Doctor" TextField="Name" ForeignKeyField="DoctorId"
                        DataSourceID="DoctorsEntityDataSource"></telerik:ResourceType>
                    <telerik:ResourceType KeyField="Id" Name="Room" TextField="Name" ForeignKeyField="RoomId"
                        DataSourceID="RoomsEntityDataSource"></telerik:ResourceType>
                    <telerik:ResourceType KeyField="Id" Name="AppointmentType" TextField="Name" ForeignKeyField="AppointmentTypeId"
                        DataSourceID="AppointmentTypesEntityDataSource"></telerik:ResourceType>
                         <telerik:ResourceType KeyField="Id" Name="DoctorAppointment" TextField="Subject" ForeignKeyField="DoctorAppointmentId"
                        DataSourceID="DoctorAppointmentsEntityDataSource"></telerik:ResourceType>
                </ResourceTypes>
And EntityDataSources Are:
  <asp:EntityDataSource ID="DoctorAppointmentsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="DoctorAppointments" EnableInsert="True">
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="PatientsAppointmentEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities"
            EnableInsert="True" EntitySetName="PatientAppointments">
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="RoomsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="Rooms">
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="DoctorsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" CommandText="SELECT it.[Id] , it.[FirstName] + ' ' + it.[LastName] as Name From DatabaseEntities.Doctors as it">
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="AppointmentTypesEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="AppointmentTypes">
        </asp:EntityDataSource> 


Please guide me on that. If you think it's better to change my method I would be glad for your kindness
Plamen
Telerik team
 answered on 28 Mar 2013
2 answers
317 views
Hi all i wanted to remove selected row in my grid using javascript. I know it by serverside but i want to do it using clientside.
can you give code for asp.net ajax and for radcontrols classic..

Thanks in advance,
RJ
RJ
Top achievements
Rank 1
 answered on 28 Mar 2013
6 answers
114 views
I've got a RadTimePicker in Grid EditForm, and I need to set the Min/Max and Interval/StartTime/EndTime

I've tried setting them in the ItemDatabound of the grid when in edit mode, and on PreRender of the control itself, if I step through debugger, I can see the value get's changed.  But when the editform is rendered, I get the default 1 hour interval.

I'm at a loss as what else to try.

Thanks in advance.

Roger

<telerik:RadTimePicker ID="txtcmps_StartTime" runat="server" Width="175px" TimeView-Columns="4" OnPreRender="txtcmps_StartTime_PreRender" TimeView-Height="300" TimeView-Width="325" DbSelectedDate='<%# Bind("cmps_StartTime") %>'  TimeView-CssClass="TimePicker" FocusedDate="1/1/1900 12:00:00 AM" MinDate="1/1/1900 12:00:00 AM" DateInput-MinDate="1/1/1900 12:00:00 AM" >       </telerik:RadTimePicker>
 
Code
 Public Sub txtcmps_StartTime_PreRender(sender As Object, e As System.EventArgs)
        'We'll set our start and end times and interval for txtcmps_StartTime
        If Not IsNothing(ViewState("cmp_StartTime")) Then
            Dim txtcmps_StartTime As Telerik.Web.UI.RadTimePicker = CType(sender, Telerik.Web.UI.RadTimePicker)
            txtcmps_StartTime.MinDate = CType(ViewState("cmp_StartTime"), DateTime)
            txtcmps_StartTime.MaxDate = CType(ViewState("cmp_EndTime"), DateTime)
 
            txtcmps_StartTime.TimeView.Interval = New TimeSpan(0, CType(ViewState("cmp_EnrollmentInterval"), Integer), 0)
            txtcmps_StartTime.TimeView.StartTime = New TimeSpan(CType(ViewState("cmp_StartTime"), DateTime).Hour, CType(ViewState("cmp_StartTime"), DateTime).Minute, CType(ViewState("cmp_StartTime"), DateTime).Second)
            txtcmps_StartTime.TimeView.EndTime = New TimeSpan(CType(ViewState("cmp_EndTime"), DateTime).Hour, CType(ViewState("cmp_EndTime"), DateTime).Minute, CType(ViewState("cmp_EndTime"), DateTime).Second)
 
        End If
    End Sub
RBarnes
Top achievements
Rank 1
 answered on 28 Mar 2013
1 answer
176 views
I have a simple template column with a hyperlink in it:

<telerik:GridTemplateColumn FilterControlAltText="Filter AMRLink column" HeaderText="AMR Link" UniqueName="AMRLink" FilterControlWidth="92%">
    <HeaderStyle Width="420px" />
        <ItemTemplate>
            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("AMRLink", "\\localserver.com\Department_Shares\Manufacturing\Engineering\GSIS AMR-MR\{0}") %>'
                                    Text='<%# Eval("AMRLink", "{0}") %>' Target="_blank"></asp:HyperLink>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:TextBox ID="txtAMRLink" runat="server" Text='<%# Bind("AMRLink") %>' Width="98%" />
        </EditItemTemplate>
</telerik:GridTemplateColumn>

It works great - it links to the correct file, and I can edit/insert just fine.

The thing is, when the user inserts/edits, they have to type in a couple more folders depths plus the file name
(e.g., "Shift1\Testers\TestReport_03_25_2013.pdf").  The directory where the file may be located is not consistent, hence their need to type in the directory names.

So, is it possible to have them click on a button, navigate around to the correct file, select it, and have that file path saved as the new hyperlink?

Thanks ahead of time...
Marin
Telerik team
 answered on 28 Mar 2013
4 answers
226 views
 we have wrote the localized codes for strings "today", "day", "week" and "month" shown in radscheduler control,and the strings will be read from database to get the localized strings. for example:                   _view.ResourceScheduler.Localization.AdvancedCalendarCancel = I18N.Tag("Cancel");
            _view.ResourceScheduler.Localization.AdvancedCalendarOK = I18N.Tag("OK");
            _view.ResourceScheduler.Localization.AdvancedCalendarToday = I18N.Tag("Today");
            _view.ResourceScheduler.Localization.HeaderToday = I18N.Tag("today");
            _view.ResourceScheduler.Localization.HeaderDay = I18N.Tag("Day");
            _view.ResourceScheduler.Localization.HeaderMonth = I18N.Tag("Month");
            _view.ResourceScheduler.Localization.HeaderWeek = I18N.Tag("Week");
            _view.ResourceScheduler.Localization.ShowMore = I18N.Tag("more...");
when we first load the pages which contain radscheduler control and don't do any operations for this control, it will be shown the correct localized strings, but when we click the navigation tab Day/Week/Month or select an event scheduler the localzied strings will be returned to English ones. Please see the attachment, how to fix this issue? 
Plamen
Telerik team
 answered on 28 Mar 2013
5 answers
229 views
Hi,

I have a RadGrid in my Page and with in ItemTemplate i have RadTimePicker Control.

I need to display 24 hrs in 15 min interval hence i need vertical scroll bar.

Request you to please suggest  any event with in with i can wire up my style for height and ovrflow or any other alternatiove way of having vertical scroll bar.

Thanks and regards,
Manish Patel
Vasil
Telerik team
 answered on 28 Mar 2013
15 answers
290 views
I've just upgraded to 2011.3.1115.35 and my RadGrid now crashes.

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index 
   
   System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index) +7602287
   Telerik.Web.UI.GridGroupByExpressionCollection.get_Item(Int32 index) +48

I've tracked this to having multiple <GroupByFields> defined in the aspx. Delete either of the <GroupByFields> children and it works fine.  I did not have this problem in Q1 2011

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false">
    <MasterTableView>
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField FieldName="Group1" ></telerik:GridGroupByField>
                    <telerik:GridGroupByField FieldName="Group2" ></telerik:GridGroupByField>
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="Group1" SortOrder="Descending"></telerik:GridGroupByField>
                    <telerik:GridGroupByField FieldName="Group2" SortOrder="Descending"></telerik:GridGroupByField>
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
        <Columns>
            <telerik:GridBoundColumn DataField="Group1" HeaderText="1" ></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Group2" HeaderText="2" ></telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

For completeness here is the VB for the page

Partial Class TestArea_Test
    Inherits System.Web.UI.Page
  
    Protected Sub RadGrid1_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
        Dim result As New List(Of Test)
        result.Add(New Test("first", "second"))
        RadGrid1.DataSource = result
    End Sub
  
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        RadGrid1.Rebind()
    End Sub
End Class
  
Class Test
    Private _Group1 As String
    Private _Group2 As String
  
    Public Sub New(ByVal g1 As String, ByVal g2 As String)
        Group1 = g1
        Group2 = g2
    End Sub
    Public Property Group1 As String
        Get
            Return _Group1
        End Get
        Set(value As String)
            _Group1 = value
        End Set
    End Property
    Public Property Group2 As String
        Get
            Return _Group2
        End Get
        Set(value As String)
            _Group2 = value
        End Set
    End Property
End Class

Cedric
Top achievements
Rank 2
 answered on 28 Mar 2013
1 answer
87 views
I want to change the column's text like an enum from an int to a value.  For example I get a data field "CompanyId" for 1 I want to display "ACME Inc" for 2 I want to display "Bike Shop"
Now I could change it on the object I've sent over, but I've been living in the XAML world for a while and I was wondering if there was an easy way to convert it.  I guess almost like a calculated column but that looks like it's only for numbers.
Radoslav
Telerik team
 answered on 28 Mar 2013
14 answers
1.0K+ views
Hi All

I have three rad combo box in my form, countries, states and cities.

When a country is selected its states should be loaded into the states list and so when a state is selected its cities should be loaded into the cities list.

i want to do this using client side APIs

after searching your form i found an solution and apply it as the following code:-

my form source 
  
<table>
 <tr>
              <td class="RC1"  style="width:10%;">
                 <asp:Label ID="lblCountry" runat="server" ></asp:Label>
              </td>
              <td style="width:90%;" class="RC2">
                  <telerik:RadComboBox ID="lstCountries" Runat="server" Width="200px" 
                    Filter="StartsWith" onclientdropdownopening="DropDownOpening" ValidationGroup="ValAddressInfo"  OnClientSelectedIndexChanged="loadStates">
                   </telerik:RadComboBox>
                   <asp:RequiredFieldValidator ID="reqCountry" runat="server" 
                           ControlToValidate="lstCountries" CssClass="Validator"  ValidationGroup="ValAddressInfo">*</asp:RequiredFieldValidator>
               </td>
            </tr>
            <tr>
             <td class="RC1" style="width:20%;" >
               <asp:Label ID="lblStates" runat="server"  ></asp:Label>
             </td>
             <td class="RC2" style="width:80%;">
                 <telerik:RadComboBox ID="lstStates" Runat="server"  
                      Width="200px" 
                     Filter="StartsWith" onclientdropdownopening="DropDownOpening" 
                     OnClientSelectedIndexChanged="loadCities"  
                     onitemsrequested="lstStates_ItemsRequested" OnClientItemsRequesting="statesItemRequesting"  EnableLoadOnDemand ="true" >
                      <CollapseAnimation Type="OutQuint" Duration="200" />  
                 </telerik:RadComboBox>
            </tr>
            <tr>
              <td class="RC1" style="width:20%;">
                <asp:Label ID="lblCities" runat="server" ></asp:Label>
              </td>
              <td class="RC2" style="width:80%;">
                 <telerik:RadComboBox ID="lstCities" Runat="server"  Width="200px" Filter="StartsWith" onclientdropdownopening="DropDownOpening" onitemsrequested="lstCities_ItemsRequested" OnClientItemsRequesting="citiesItemRequesting"  EnableLoadOnDemand ="true"  >
                </telerik:RadComboBox>
              </td>
            </tr>
</table>

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
  <script type="text/javascript" language="javascript">
           function loadStates(sender, args) {       
            var listStates = $find("<%=lstStates.ClientID %>");           
              
            var item = args.get_item();   
     
            if (item.get_index() > 0)   
            {
                listStates.requestItems(item.get_value(), false);                  
             }   
            else   
            {   
            }
  
        }
  
        function statesItemRequesting(sender, args) {
            var lst1 = $find("<%=lstCountries.ClientID %>");
            var context = args.get_context();
            context["country_code"] = lst1.get_selectedItem().get_value();
        }
  
        function loadCities(sender, args) {
            var listCities = $find("<%=lstCities.ClientID %>");
  
            var item = args.get_item();
  
            if (item.get_index() > 0) {
                listCities.requestItems(item.get_value(), false);
            }
            else {
            }
        }
  
        function citiesItemRequesting(sender, args) {
            var lst1 = $find("<%=lstCountries.ClientID %>");
            var lst2 = $find("<%=lstStates.ClientID %>");
            var context = args.get_context();
            context["country_code"] = lst1.get_selectedItem().get_value();
            context["state_code"] = lst2.get_selectedItem().get_value();
        }
  
      
         
  
  
   </script>
</telerik:RadScriptBlock>

in the code behind
  
protected void lstStates_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
  
{
  
int iCountryCode = Convert.ToInt32(Convert.ToInt32(e.Context["country_code"]));
  
bindList(iCountryCode,0,lstStates,2);
  
}
  
protected void lstCities_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
  
{
  
int iCountryCode = Convert.ToInt32(Convert.ToInt32(e.Context["country_code"]));
  
int iStateCode = Convert.ToInt32(Convert.ToInt32(e.Context["state_code"]));
  
bindList(iCountryCode, iStateCode, lstCities, 3);
  
}
 and the bindList is where i get the data from data base tables and fill it in the lists.

all are ok,,,,


BUT

i noticed that when i try to open the states combo box for example, it sticks then i should click any where in the form then try again to open it again so the items appear...

all functions are called and executed and the lists are filled...

but what is the reson for this behaviour?
this can ne be acceptable since the user may think that the list is stuck!!!

please help

asaad

Boyan Dimitrov
Telerik team
 answered on 28 Mar 2013
7 answers
273 views
It appears that the clientside may be lacking this functionality or it's just not documented anywhere that I can find. If I have the index of the RotatorItem that I want to display in the rotator, how to do I tell the rotator to go to that specific item using javascript. I have multiple rotators on a page and I want to be able to make them all rotate to the same item when the user selects a different value in the drop down list. The one hang up is just getting them to go to the selected value.$0$0$0$0Thanks,$0$0Adam$0
Slav
Telerik team
 answered on 28 Mar 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?