Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
419 views
Hi
I have a link button inside the GridTemplateColumn, and i want to know the row index when i click on the link button client side.
Below is the code i have:

<telerik:RadGrid ID="grdDetailSummary" runat="server">
         <MasterTableView DataKeyNames="Id" ClientDataKeyNames="Id">
                <Columns>
                     <telerik:GridTemplateColumn HeaderText="Open" UniqueName="colOpenLink">
                        <ItemTemplate>
                            <asp:LinkButton runat="server" ID="lnkReason" Font-Underline="true"  Text="Open" OnClientClick="javascript:OpenNewWindow()"></asp:LinkButton>
                        </ItemTemplate>
                     </telerik:GridTemplateColumn>
                </Columns>
        </MasterTableView>
    </telerik:RadGrid>
 
<script language="javascript" type="text/javascript">
        function OpenNewWindow() {
            //I want to know the row index here, and ultimately i want to get the value from datakeyvalues.
        }
        </script>
Shinu
Top achievements
Rank 2
 answered on 11 Oct 2012
2 answers
128 views
Hi,

I have created a dynamic tooltip for a radcombobox with checkboxes.  As items in the combobox are checked or unchecked I change the tooltip for the combobox to the items that are selected.  I have been able to get this to work successfully using the following code.
Private Sub rcbCompany_ItemChecked(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles rcbCompany.ItemChecked
 
       prpSelectedCount = Me.rcbCompany.GetCheckedIndices.Count
       Dim strToolTipField = IIf(prpDisplayType = "Name", e.Item.Text, e.Item.Value.ToString)
 
       If e.Item.Checked = True Then
           'If an item has been checked, add the company number to the prpSelectedValue list and the company code/name to the prpToolTip list.
           prpSelectedValue = prpSelectedValue + "," + e.Item.Attributes("CompanyNumber")
           prpToolTip = prpToolTip + strToolTipField
 
       Else
           'If no companies are check set prpSelectedValue and the prpToolTip to Nothing,
           If prpSelectedCount = 0 Then
               prpSelectedValue = ""
               prpToolTip = ""
           Else
               'otherwise remove the unchecked company from the prpSelectedValue property
               prpSelectedValue = prpSelectedValue.Replace("," + e.Item.Attributes("CompanyNumber"), "")
               prpToolTip = prpToolTip.Replace(";" + strToolTipField, "")
           End If
       End If
 
       'Remove the extra comma, if any at the beginning of the string
       If prpSelectedValue.StartsWith(",") = True Then
           prpSelectedValue = prpSelectedValue.Remove(0, 1)
       End If
 
       If prpToolTip.StartsWith(";") = True Then
           prpToolTip = prpToolTip.Remove(0, 1)
       End If
 
       Me.rcbCompany.ToolTip = prpToolTip
       rttManagerCompany.TargetControls.Clear()
       rttManagerCompany.TargetControls.Add(Me.rcbCompany.ClientID, True)
 
       RaiseEvent OnItemCheckedCompanyHandler(sender, e)
   End Sub
 
Private Sub rttManagerCompany_AjaxUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.ToolTipUpdateEventArgs) Handles rttManagerCompany.AjaxUpdate
       Dim lblToolTip As New Label()
       lblToolTip.Text = prpToolTip
       e.UpdatePanel.ContentTemplateContainer.Controls.Add(lblToolTip)
   End Sub

My problem becomes when I try to put in a new line in the tooltip text to separate the selected items.
I changed the tooltip expression to

prpToolTip = prpToolTip + "<br/>" + strToolTipField. 
After I added the new line character(<br/>) I get the following error.
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

As a test to see if it was my generated tooltip that was causing the problem, I changed the lblToolTip.Text in the rttManagerCompany_AjaxUpdate to "line1 <br/> line2" and I still get the error.  If I remove the <br/> I do not get an error and the tooltip displays as line1line2. 

Can anyone tell me how to get a new line in the tooltip.

Thank you for your help.
Tracy

After I add the new line

Tracy
Top achievements
Rank 1
 answered on 11 Oct 2012
8 answers
1.4K+ views
Hi ,I want create a ComboBox with multi-column ,and with dynamic from database.

I have searched a helpfull article:
http://andrewwhitten.wordpress.com/2010/05/15/multiple-select-telerik-radcombobox-in-code-behind/

but I don't know how to get the value from client-side and code behind side

private string item1
        {
            get
            {
                RadComboBoxItem item = this.combobox1.SelectedItem; 
                if (item != null)
                {
                    Label lbl= item.FindControl("item1") as Label;
                    if (lbl!= null) // is always be null
                        return  lbl.Text;
                }
                return "";
            }
        }

how could I get the selectedItem? 

or have other better ideas for multi-column radcomboBox? 

Thanks
Satish
Top achievements
Rank 1
 answered on 10 Oct 2012
1 answer
140 views
I am using a radgrid with gridclientselectcolumn with AllowMultiRowSelection="true", the shift key select works however, it selects the rows from the top most selected row till the currently selected row. Say, If I select row 2, then row 4 and then i hold shift and select row 7 it will select all rows from 2 till 7 instead of 2 and 4 to 7
Jayesh Goyani
Top achievements
Rank 2
 answered on 10 Oct 2012
3 answers
98 views
If I right click on a schedule entry that is an exception from a series, select edit, then select the entire series I get the following when debugging:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

It works fine so long as I edit the series from any item in the series that is not an exception.

Thanks!
Ivana
Telerik team
 answered on 10 Oct 2012
1 answer
118 views
Hi
I am new to telerik controls.I used radscheduler with recurrence but I am not able to get recurrence rule in server side while inserting a appointment in database.
An appointment is inserted with out the recurrence.I am binding the scheduler to a datasource.
<telerik:RadScheduler ID="RadScheduler1" runat="server"
               DataDescriptionField="CH_DESC" DataEndField="CH_TOTIME" 
               DataKeyField="CH_BOOKID" 
               DataStartField="CH_FROMTIME" DataSubjectField="CH_BOOKSUBJECT"                
               OnAppointmentDelete="RadScheduler1_AppointmentDelete"
               OnAppointmentUpdate="RadScheduler1_AppointmentUpdate"
               OnAppointmentInsert="RadScheduler1_AppointmentInsert"
               OnAppointmentCreated="RadScheduler1_AppointmentCreated"
               OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
               MinutesPerRow="15" TimeLabelRowSpan="1"
               Skin="Windows7"  GroupBy="Hall"  Height="400px"
               DayStartTime="09:00:00" DayEndTime="19:00:00" 
               WorkDayStartTime="09:00:00" WorkDayEndTime="19:00:00"
               EnableDescriptionField="True" ShowAllDayRow="False"  AdvancedForm-Modal="true"
               StartInsertingInAdvancedForm="True" AdvancedForm-Enabled="true" AdvancedForm-EnableCustomAttributeEditing="true" 
               DataRecurrenceParentKeyField="CH_RECPID"  DataRecurrenceField="CH_REC" EnableRecurrenceSupport="true">
           <AdvancedForm  EnableCustomAttributeEditing="true"/>          
           <AppointmentTemplate>
           <div class="rsCategoryViolet">
           <br />
              Subject:<%# Eval("Subject")%><br />Time:<%#Convert.ToDateTime(Eval("Start")).ToShortTimeString()%>- <%#Convert.ToDateTime(Eval("End")).ToShortTimeString()%>  <br />
          
          
           </div>
           </AppointmentTemplate>
           </telerik:RadScheduler>
       </asp:Panel>


By default CH_RECPID,CH_REC is set to empty string.
Please tell me a solution for this.
thanks in advance
Boyan Dimitrov
Telerik team
 answered on 10 Oct 2012
2 answers
143 views
Hi friends,

<telerik:RadFormDecorator ID="id runat="server" ControlsToSkip="Textbox"></telerik:RadFormDecorator>


Seems not to be working for textboxes, instead, the below serves the purpose.
<telerik:RadFormDecorator ID="id runat="server" ControlsToSkip="Textarea"></telerik:RadFormDecorator>


Am I missing something ?

Thanks,
-Aarsh
Aarsh
Top achievements
Rank 1
 answered on 10 Oct 2012
2 answers
375 views
I have a three level radgrid hierarchy and I have trouble retrieving the value for one of my columns within the 2nd level of my radgrid.  I have this code which retrieves the key for the radgrid parent as shown below:

parentItem.OwnerTableView.DataKeyValues(parentItem.ItemIndex)("ID").ToString


But I don't need the value of the key, instead I need the value of the 2nd column in one of the hierarchy levels in my radgrid.

How could I retrieve that value instead of the key....?
Aret
Top achievements
Rank 1
 answered on 10 Oct 2012
2 answers
78 views
Hi friends,

<telerik:RadFormDecorator ID="id runat="server" ControlsToSkip="Textbox"></telerik:RadFormDecorator>

Seems not to be working for textboxes, instead, the below serves the purpose.

<telerik:RadFormDecorator ID="id runat="server" ControlsToSkip="Textarea"></telerik:RadFormDecorator>


Am I missing something ?

Thanks,
-Aarsh
Aarsh
Top achievements
Rank 1
 answered on 10 Oct 2012
3 answers
140 views
In the process of updating some functionality I refactored out a user control (below).
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TeamTodayScheduler.ascx.cs" Inherits="Private_Dashboard_TeamTodayScheduler" %>
 
<telerik:RadAjaxManager ID="ramTeamToday" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="lb">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rsTeamToday" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<asp:LinkButton ID="lb" runat="server" CssClass="customRSHeader" ForeColor="#333" Width="100%" OnClick="lb_Click" />
<telerik:RadScheduler ID="rsTeamToday" runat="server" AllowDelete="false" AllowEdit="false" AllowInsert="false"
        ShowFooter="false" ShowHeader="false" ShowResourceHeaders="false" SelectedView="TimelineView"
        OverflowBehavior="Expand" Visible="false" DataSourceID="ldsSchedules" DataKeyField="ScheduleID"
        DataStartField="ScheduleStartDate" DataEndField="ScheduleEndDate" DataSubjectField="EmployeeName"
        DataRecurrenceField="ScheduleRecurrenceRule" DataRecurrenceParentKeyField="ScheduleRecurrenceParentID"
        OnTimeSlotCreated="rsToday_TimeSlotCreated">
    <TimelineView GroupBy="Employee" GroupingDirection="Vertical" ReadOnly="true" ShowInsertArea="false"
        StartTime="08:00:00" SlotDuration="00:15:00" NumberOfSlots="36" TimeLabelSpan="4"
        ColumnHeaderDateFormat="h tt" EnableExactTimeRendering="true" />
    <ResourceTypes>
        <telerik:ResourceType KeyField="EmployeeID" Name="Employee" TextField="EmployeeID"
            ForeignKeyField="ScheduleEmployeeID" DataSourceID="ldsEmployees" />
        <telerik:ResourceType KeyField="ScheduleActivityTypeID" Name="Activity" TextField="ScheduleActivityTypeName"
            ForeignKeyField="ScheduleActivityTypeID" DataSourceID="ldsActivityTypes" />
    </ResourceTypes>
    <ResourceStyles>
        <telerik:ResourceStyleMapping Type="Activity" Text="Work" ApplyCssClass="WorkSchedule" />
        <telerik:ResourceStyleMapping Type="Activity" Text="Class" ApplyCssClass="ClassSchedule" />
        <telerik:ResourceStyleMapping Type="Activity" Text="Sick" ApplyCssClass="SickSchedule" />
        <telerik:ResourceStyleMapping Type="Activity" Text="Vacation" ApplyCssClass="VacationSchedule" />
        <telerik:ResourceStyleMapping Type="Activity" Text="Extended Leave of Absence" ApplyCssClass="OffSiteSchedule" />
    </ResourceStyles>
</telerik:RadScheduler>
<asp:LinqDataSource ID="ldsActivityTypes" runat="server" ContextTypeName="SciNET.BusinessObjects.SciNETDataContext"
    TableName="ScheduleActivityTypes" />
<asp:LinqDataSource ID="ldsEmployees" runat="server" ContextTypeName="SciNET.BusinessObjects.SciNETDataContext"
        TableName="Employees" OnSelecting="ldsEmployees_Selecting">
    <WhereParameters>
        <asp:Parameter DbType="Int32" Name="TeamID" />
    </WhereParameters> 
</asp:LinqDataSource>
<asp:LinqDataSource ID="ldsSchedules" runat="server" ContextTypeName="SciNET.BusinessObjects.SciNETDataContext"
    TableName="Schedules" OrderBy="ScheduleActivityTypeID Descending" OnSelecting="ldsSchedules_Selecting" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SciNET.BusinessObjects;
using Telerik.Web.UI;
 
public partial class Private_Dashboard_TeamTodayScheduler : System.Web.UI.UserControl
{
    protected SciNETDataContext dbContext = new SciNETDataContext();
 
    public int TeamID
    {
        get { return Convert.ToInt32(ldsEmployees.WhereParameters["TeamID"].DefaultValue); }
        set { ldsEmployees.WhereParameters["TeamID"].DefaultValue = value.ToString(); }
    }
 
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            lb.Text = TeamID == 0 ? "Full-Timers" : (from team in dbContext.EmployeeTeams
                                                     where team.EmployeeTeamID == TeamID
                                                     select team).Single().EmployeeTeamName;
        }
    }
 
    protected void lb_Click(object sender, EventArgs e)
    {
        rsTeamToday.Visible = !rsTeamToday.Visible;
    }
 
    protected void rsToday_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
    {
        if (e.TimeSlot.Start <= DateTime.Now && e.TimeSlot.End >= DateTime.Now) e.TimeSlot.CssClass = "Highlight";
    }
 
    protected void ldsEmployees_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        if (TeamID == 0) e.Result = (from emp in dbContext.Employees
                                     where !emp.EmployeeDateTerminated.HasValue
                                     where emp.EmployeeRoles.Count(role => role.EmployeeRoleTypeID == 0) > 0
                                     select emp).ToList();// 0 stands for Full-timer ^^^
        else e.Result = (from emp in dbContext.Employees
                         where !emp.EmployeeDateTerminated.HasValue
                         where emp.EmployeeTeamID == Convert.ToInt32(e.WhereParameters["TeamID"])
                         where emp.EmployeeRoles.Count(role => role.EmployeeRoleTypeID == 0) == 0
                         select emp).ToList();
        if (((List<Employee>)e.Result).Count == 0) Visible = false;
    }
 
    protected void ldsSchedules_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {// Note: This grabs everyone's schedules. It's easier to let the grouping filter out the ones we don't need.
        e.Result = (from schedule in dbContext.Schedules
                    orderby schedule.ScheduleActivityTypeID descending
                    select new
                    {
                        ScheduleID = schedule.ScheduleID,
                        ScheduleSubject = schedule.ScheduleSubject,
                        ScheduleActivityTypeID = schedule.ScheduleActivityTypeID,
                        ScheduleStartDate = schedule.ScheduleStartDate,
                        ScheduleEndDate = schedule.ScheduleEndDate,
                        ScheduleEmployeeID = schedule.ScheduleEmployeeID,
                        ScheduleRecurrenceRule = schedule.ScheduleRecurrenceRule,
                        ScheduleRecurrenceParentID = schedule.ScheduleRecurrenceParentID,
                        EmployeeName = schedule.Employee.EmployeeGivenName + " " + schedule.Employee.EmployeeLastName
                    }).ToList();
    }
}
As is, a javascript TypeError: Telerik.Web.UI.RadScheduler is undefined appears, the scheduler renders and works in every aspect except that the appointments' subjects don't appear. Removing both resource types (not just one) displays the subjects. Moving the code back to the parent page just throws slightly different javascript errors--c[0] or n is undefined; usually related to some sorting thing--but visually makes no change. It seems independent of all other properties of the radscheduler. I've looked at similar issues that suggested the web.config needed a handler, but mine's setup correctly. Another suspected the grouping, but that's not the issue here.
An appointment template ignores the data; it'll display hard-coded content. The data is accessible in the code-behind, and I've used it to manipulate the Tooltip which works fine, but the appointment subject refuses to display.

From what I've gathered, it's not connecting the scripts RadScheduler needs to run, but the fix they recommended (EnableEmbeddedScripts) didn't work for me.
Boyan Dimitrov
Telerik team
 answered on 10 Oct 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?