After the Q3 upgrade, the routine I got from a blog I was refered too quit working. I need to access the Subject label and change the text, however, I have a java error about the parent control (Parent.Controls(0)). The error occurs at the bottom of this routing, (around line 69) but basically, some of this works and some of this does not.
I want to change subject text to say: "Event Summary". Can you help me?
Thanks,
~bg
I want to change subject text to say: "Event Summary". Can you help me?
Thanks,
~bg
Protected Sub RadScheduler1_FormCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerFormCreatedEventArgs) Handles RadScheduler1.FormCreated | |
HiddenFieldAppointmentID.Value = e.Container.Appointment.ID | |
grdEvent.DataBind() | |
If (e.Container.Mode = SchedulerFormMode.AdvancedEdit) OrElse (e.Container.Mode = SchedulerFormMode.AdvancedInsert) Then | |
'Find and hide the advanced control panel: | |
'Dim advancedPanel As Panel = DirectCast(e.Container.FindControl("AdvancedControlsPanel"), Panel) | |
'advancedPanel.Visible = false; | |
RadScheduler1.Height = 350 | |
''Find the Recurrency checkbox and hide it. | |
Dim recuranceCheckbox As CheckBox = DirectCast(e.Container.FindControl("RecurrentAppointment"), CheckBox) | |
recuranceCheckbox.Visible = False | |
''Find the All Day checkbox and hide it. | |
Dim AllDayEvent As CheckBox = DirectCast(e.Container.FindControl("AllDayEvent"), CheckBox) | |
AllDayEvent.Visible = False | |
'Find the Subject textbox and set its Height: | |
Dim subjectTextbox As TextBox = DirectCast(e.Container.FindControl("Subject"), TextBox) | |
subjectTextbox.Height = Unit.Pixel(20) | |
subjectTextbox.MaxLength = 50 | |
subjectTextbox.CssClass = "NormalBlack" | |
'subjectTextbox.BackColor = System.Drawing.Color.LemonChiffon | |
''Find the DropDownList for the Room resource and set its SelectedIndex property. | |
''This is useful if you want to default to a specific resource selection. However, | |
''you should leave only the AdvancedInsert clause from the if statement above. | |
Dim resEventTypeDDL As DropDownList = DirectCast(e.Container.FindControl("resType"), DropDownList) | |
resEventTypeDDL.Width = 600 | |
'resEventTypeDDL.SelectedIndex = 1 | |
'Find the TextBox for the EventLocation custom attribute and set its properties: | |
Dim attrEventLocationTextbox As TextBox = DirectCast(e.Container.FindControl("AttrEventLocation"), TextBox) | |
'attrEventLocationTextbox.BackColor = System.Drawing.Color.LemonChiffon | |
attrEventLocationTextbox.MaxLength = 255 | |
attrEventLocationTextbox.Width = 600 | |
attrEventLocationTextbox.CssClass = "NormalBlack" | |
Dim attrEventDescriptionTextbox As TextBox = DirectCast(e.Container.FindControl("AttrEventDescription"), TextBox) | |
'attrEventDescriptionTextbox.BackColor = System.Drawing.Color.LemonChiffon | |
attrEventDescriptionTextbox.TextMode = TextBoxMode.MultiLine | |
attrEventDescriptionTextbox.Rows = 4 | |
attrEventDescriptionTextbox.Width = 600 | |
attrEventDescriptionTextbox.CssClass = "NormalBlack" | |
'The description labels for Subject, Resources and Custom Attributes require a different | |
'approach since they are WebControls which dynamically add a label. | |
'Change the description for the EventLocation attribute: | |
Dim attrWebcontrol1 As WebControl = DirectCast(e.Container.FindControl("LblAttrEventLocation"), WebControl) | |
Dim attrLabel1 As New Label() | |
attrLabel1.Text = "Location:" | |
attrWebcontrol1.Controls.Clear() | |
attrWebcontrol1.Controls.Add(attrLabel1) | |
Dim attrWebcontrol2 As WebControl = DirectCast(e.Container.FindControl("LblAttrEventDescription"), WebControl) | |
Dim attrLabel2 As New Label() | |
attrLabel2.Text = "Description:" | |
attrWebcontrol2.Controls.Clear() | |
attrWebcontrol2.Controls.Add(attrLabel2) | |
'Change the description for the Subject. Please, note that since the description control | |
'for Subject does not render an ID, you need to use the first child of the Parent control | |
'of the subject TextBox. | |
Dim subjectDescription As WebControl = DirectCast(subjectTextbox.Parent.Controls(0), WebControl) | |
Dim subjectLabel1 As New Label() | |
subjectLabel1.Text = "Event Summary:" | |
subjectDescription.Controls.Clear() | |
subjectDescription.Controls.Add(subjectLabel1) | |
End If | |
End Sub |