Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
194 views
Hi all,

I would like to manage 4 checkbox in my radtreeview.
Here's the code :


<telerik:RadTreeView ID="rtv" Height="250px" Width="350px" BorderStyle="Solid" BorderWidth="2px" BorderColor="Black" runat="server" 
Font-Names="Calibri" Font-Size="10px" CheckBoxes="true" CheckChildNodes="true" TriStateCheckBoxes="True">   
<NodeTemplate>
<asp:Label ID="lbl_equipe" Width="100px" Font-Size="10px" runat="server"><%# DataBinder.Eval(Container.DataItem, "EQUIPE")%></asp:Label>
<asp:CheckBox onclick="return false;" Text="I" Font-Size="8px" TextAlign="Left" Checked="false" ID="primo_operatore" runat="server"/>
<asp:CheckBox onclick="return false;" Text="II" Font-Size="8px" TextAlign="Left" ID="secondo_operatore" runat="server"/>
<asp:CheckBox onclick="return false;" Text="III" Font-Size="8px" TextAlign="Left" ID="terzo_operatore" runat="server"/>
</NodeTemplate>
</telerik:RadTreeView>

One checkbox is the built-in checkbox (CheckBoxes="true")
The other three cbx are inside nodetemplate.
I want to achieve two goals :
1. When user check (uncheck) the native checkbox the remaining three are checked (unchecked) goal achieved

2. When user check/uncheck one of the three template checkboxes nothing should happen..problem

I use the nodecheck event handler to get first goal (in code behind)
This event fires not just for the native checkbox but even for the remaining three!
How can I distinguish the element in order to prevent the nodecheck event  for the template checkboxes and let it fire for the single 
one ?
I've tried in code behind inside the event routine but the e.node is referred to the whole nodetemplate and I can't get the single elements in.
Here's my code:

 Private Sub rtv_NodeCheck(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles rtv.NodeCheck


        Dim chk1 As CheckBox = DirectCast(e.Node.FindControl("primo_operatore"), CheckBox)
        Dim chk2 As CheckBox = DirectCast(e.Node.FindControl("secondo_operatore"), CheckBox)
        Dim chk3 As CheckBox = DirectCast(e.Node.FindControl("terzo_operatore"), CheckBox)

'Code to prevent the event if sender is one of three checkbox NodeCheck 
' (??????????????????????????????????)

        If e.Node.Level <> 1 Then Exit Sub 'event just for level 1 nodes


        'parent nodes loop
        For Each nd As RadTreeNode In rtv.Nodes


            'When parent node is checked then start looping through all parent nodes looking for same nodetext
'If same node text is found then its checkbox is checked
           
            If e.Node.Checked = True Then


                'Enable node-template checkboxes
                DirectCast(e.Node.FindControl("primo_operatore"), CheckBox).Checked = True
                DirectCast(e.Node.FindControl("secondo_operatore"), CheckBox).Checked = True
                DirectCast(e.Node.FindControl("terzo_operatore"), CheckBox).Checked = True

'Child nodes loop
                For Each sub_nd As RadTreeNode In nd.Nodes
                    If sub_nd.Checked = False Then
                        Dim txt As String = sub_nd.Text 
                        If txt = e.Node.Text Then 'Node text comparison
                            sub_nd.Checked = True
                            sub_nd.ParentNode.Expanded = True

'For each parent node checked the checkboxes inside template-childnode are checked
                            DirectCast(sub_nd.FindControl("primo_operatore"), CheckBox).Checked = True
                            DirectCast(sub_nd.FindControl("secondo_operatore"), CheckBox).Checked = True
                            DirectCast(sub_nd.FindControl("terzo_operatore"), CheckBox).Checked = True


                        End If
                    End If
                Next


            Else
                'When parent node is unchecked then start looping through all parent nodes looking for same nodetext
'If same node text is found then its checkbox is unchecked


                'Disable node-template checkboxes
                DirectCast(e.Node.FindControl("primo_operatore"), CheckBox).Checked = False
                DirectCast(e.Node.FindControl("secondo_operatore"), CheckBox).Checked = False
                DirectCast(e.Node.FindControl("terzo_operatore"), CheckBox).Checked = False

'Child nodes loop
                For Each sub_nd As RadTreeNode In nd.Nodes
                    If sub_nd.Checked = True Then
                        Dim txt As String = sub_nd.Text
                        If txt = e.Node.Text Then
                            sub_nd.Checked = False
                            sub_nd.ParentNode.Expanded = False

'For each parent node unchecked the checkboxes inside template-childnode are unchecked
                            DirectCast(sub_nd.FindControl("primo_operatore"), CheckBox).Checked = False
                            DirectCast(sub_nd.FindControl("secondo_operatore"), CheckBox).Checked = False
                            DirectCast(sub_nd.FindControl("terzo_operatore"), CheckBox).Checked = False
                        End If
                    End If
                Next
            End If
        Next

    End Sub

English is not my language, hope I was understandable.
Thanks in advance

GZ
Gabriele
Top achievements
Rank 1
 answered on 10 Feb 2012
2 answers
80 views
aspx code:
<telerik:RadScheduler ID="rsATSch" runat="server" StartInsertingInAdvancedForm="True"
    Skin="Office2007" DataDescriptionField="atsDesc" DataEndField="atsEnd" DataKeyField="atsID"
    DataStartField="atsStart" DataSubjectField="atsSubj" SelectedView="WeekView"
    StartEditingInAdvancedForm="True" AdvancedForm-EnableCustomAttributeEditing="True"
    CustomAttributeNames="Member,Email,Action Ticket" Height="450px" Style="z-index: 100000;">
    <TimelineView UserSelectable="False" />
    <AdvancedForm EnableCustomAttributeEditing="True" Modal="True" />
    <AppointmentTemplate>
        <div style="font-family: Arial; font-size: 10px; border-bottom: solid 1px black">
            <%#Eval("Subject")%>
        </div>
        <div>
            <%#Eval("Member").ToString%>
        </div>
        <%#Eval("Description").ToString.Replace(vbCrLf, "<br>")%>
    </AppointmentTemplate>
</telerik:RadScheduler>

vb code:
Protected Sub rsATSch_FormCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerFormCreatedEventArgs) Handles rsATSch.FormCreated
    Dim txtSubject As Telerik.Web.UI.RadTextBox = DirectCast(e.Container.FindControl("Subject"), Telerik.Web.UI.RadTextBox)
    Dim txtDesc As Telerik.Web.UI.RadTextBox = DirectCast(e.Container.FindControl("Description"), Telerik.Web.UI.RadTextBox)
    Dim cbMembers As Telerik.Web.UI.RadComboBox = DirectCast(e.Container.FindControl("ResMembers"), Telerik.Web.UI.RadComboBox)
    Dim txtUserName As Telerik.Web.UI.RadTextBox = DirectCast(e.Container.FindControl("AttrMember"), Telerik.Web.UI.RadTextBox)
    Dim txtEmail As Telerik.Web.UI.RadTextBox = DirectCast(e.Container.FindControl("AttrEmail"), Telerik.Web.UI.RadTextBox)
    Dim rdpStart As Telerik.Web.UI.RadDatePicker = DirectCast(e.Container.FindControl("StartDate"), Telerik.Web.UI.RadDatePicker)
    Dim rtpStart As Telerik.Web.UI.RadTimePicker = DirectCast(e.Container.FindControl("StartTime"), Telerik.Web.UI.RadTimePicker)
    Dim rdpEnd As Telerik.Web.UI.RadDatePicker = DirectCast(e.Container.FindControl("EndDate"), Telerik.Web.UI.RadDatePicker)
    Dim rtpEnd As Telerik.Web.UI.RadTimePicker = DirectCast(e.Container.FindControl("EndTime"), Telerik.Web.UI.RadTimePicker)
    Dim txtActTickID As Telerik.Web.UI.RadTextBox = DirectCast(e.Container.FindControl("AttrAction Ticket"), Telerik.Web.UI.RadTextBox)
 
     
    If e.Container.Mode = SchedulerFormMode.AdvancedInsert Then
        txtSubject.Text = "#" & txtTicketNum.Text.ToString & ": " & ddlActCode.SelectedItem.Text.ToString
        txtDesc.Text = txtAcctName.Text.ToString & " (" & txtAcctType.Text.ToString & ")" & vbCrLf
        txtDesc.Text += txtAddr1.Text.ToString & vbCrLf
        txtDesc.Text += txtCity.Text.ToString & ", " & txtState.Text.ToString & ", " & txtZipCode.Text.ToString
        cbMembers.SelectedIndex = ddlMemberB.SelectedIndex
    End If
 
    txtSubject.ReadOnly = True
    txtSubject.BackColor = Drawing.Color.LightGray
 
    txtUserName.Visible = False
    txtEmail.Visible = False
    txtActTickID.Visible = False
 
    cbMembers.ZIndex = 300000
    rdpStart.ZIndex = 300000
    rtpStart.ZIndex = 300000
    rdpEnd.ZIndex = 300000
    rtpEnd.ZIndex = 300000
 
End Sub

the attached happens...any suggestions?
SSirica
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 10 Feb 2012
2 answers
282 views
Hi

I have a requirement
My RadScheduler is for fixing appointments for doctors.

1.I have given available time of doctors using a RadScheduler.
I need to show the available timeslots of doctors in another page for scheduling appointments for patients.

2.The available timeslots of doctors should be in a particular colour and these time slots should be enabled and can have click event

3.The timeslots that the doctors are not available should be in another colour and should be disabled.No click event should be there for the time slot.

Please help.
Very urgent
Plamen
Telerik team
 answered on 10 Feb 2012
3 answers
117 views
I have a hierarchical Radgrid
Batch...
        Adjustments...
                         Comments
I have the functionality of export to excel on the 'Adjustments' grid. How can I prevent the export of the 'Comments' grid if the user clicks Export when Comments are expanded?

protected void ConfigureExport(object source, GridCommandEventArgs e)
 {
     e.Item.OwnerTableView.GetColumn("PolicyEditRecord").Visible = false;
     e.Item.OwnerTableView.GetColumn("DeleteTransaction").Visible = false;
     e.Item.OwnerTableView.GetColumn("ManualAdjustmentBatchID").Visible = false;
     e.Item.OwnerTableView.GetColumn("ManualAdjustmentID").Visible = false;
     ((RadGrid)source).ExportSettings.ExportOnlyData = true;
     ((RadGrid)source).ExportSettings.IgnorePaging = true;
     ((RadGrid)source).ExportSettings.OpenInNewWindow = false;
     ((RadGrid)source).ExportSettings.HideStructureColumns = true;
     ((RadGrid)source).MasterTableView.HierarchyDefaultExpanded = false;
     ((RadGrid)source).MasterTableView.ExportToExcel();
 }








Mira
Telerik team
 answered on 10 Feb 2012
1 answer
74 views
Hi,

I've a MasterPage with the RadScriptManager on it.

A default.aspx opens a RadWindow which is in a User Control, in this Control is a RadButton which opens a RadTooltip (using RadToolTipManager) with another control. In this Control is a RadListView

Somehow the the RadScriptmanager does not include the Telerik JS File in the WebRessource for the RadListView, althougth it's rendered. See the attached picture.

Is there any Command where to tell the RadScriptmanager to include certain JS Files?
(In my case Telerik.Web.UI.ListBox.RadListBoxScripts.js ) for RadControls used in dynamic loaded Controls.
I was unable to find out why the RadScriptmanager isn't able attach the Scripts. 
The only work-around was to put a the RadListBox Control on the page where the Tooltip is loaded
like this 
<div style="displaynone;">
    <telerik:RadListBox runat="server" ID="listBox">
    </telerik:RadListBox>
</div>
to get the script loaded into the WebRessource.
But this is not very clean. 

 Kind regards.
Vasil
Telerik team
 answered on 10 Feb 2012
1 answer
77 views
Hi,
  Ok I have two grids, a parents Customer Grid and a child Orders grid, the child grid is in the edit form of the parent Customer Grid.
In the Orders Grid I have two Item Template columns. and have validators in these columns. I am trying to find these in the edit row in client side code but having a really hard time?!? Can someone from the Telerik team show me by a code example how can I achieve this??  Your helps really appreciated and please give an example by code. thanks!! **Please see my comments below above the Javascript code

Here are the item templates in the OrdersGrid

<telerik:GridTemplateColumn DataField="Order" HeaderText="OrderName" SortExpression="owner" UniqueName="OrderName" AutoPostBackOnFilter="true"
                                              HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" >                        
                                                   <ItemTemplate>
                                                       <asp:Label runat="server" ID="lblOrderName" Text='<%# Eval("OrderName") %>' ToolTip="Owner/Private Car Mark"></asp:Label>
                                                   </ItemTemplate>
                                                   <EditItemTemplate>
                                                       <span><asp:TextBox runat="server" ID="txtOrderName" Text='<%# Bind("OrderName") %>' ></asp:TextBox><span
                                                       style="color: Red">
                                                           
<asp:RequiredFieldValidator ID="RequiredOrderName" ControlToValidate="txtOrderName"
                                                       ErrorMessage="Order Name is required" runat="server">
                                                           </asp:RequiredFieldValidator>
                                                           </span>
                                                   </EditItemTemplate>
                                               </telerik:GridTemplateColumn>
 
 
                                                <telerik:GridTemplateColumn DataField="OrderAdd" HeaderText="Order Address"  UniqueName="OrderAdd" AutoPostBackOnFilter="true"
                                               HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"  >
                                                   <ItemTemplate>
                                                     
                                                       <asp:Label runat="server" ID="lblOrderAdd" Text='<%# Eval("OrderAdd") %>'></asp:Label>
                                                   </ItemTemplate>
                                                   <EditItemTemplate>
                                                       <span><asp:TextBox runat="server" ID="txtOrderAdd" Text='<%# Bind("OrderAdd") %>' ></asp:TextBox><span
                                                       style="color: Red">
                                                        <asp:RequiredFieldValidator ID="RequiredOrderAdd" ControlToValidate="txtOrderAdd"
                                                       ErrorMessage="Order Address is required" runat="server">
                                                           </asp:RequiredFieldValidator>
                                                           
                                                           
                                                           </span>
                                                   </EditItemTemplate>
                                               </telerik:GridTemplateColumn>

Here is what I have on the client side for checking the edit row in the orders grid, please let me know how can I access validators "RequiredOrderName" and "RequiredOrderAdd" ??  The grid has only single row edit allowed so should be only one row in edit mode at a time. I am trying to attach the Jquery validation plugin to the validator. http://plugins.jquery.com/project/updnValidatorCallout

function pageLoad(source, eventArgs) {
      //debugger;
 
      var grid = $telerik.$('[id$=CustomersGrid]');
      if (grid != null) {
          var gridObj = $find(grid.attr("id"));
          var masterTable = gridObj.get_masterTableView();
 
          var isInEditMode = false;
 
          if (gridObj.get_editItems().length > 0) {
              isInEditMode = true;
          }
 
          if (masterTable.get_isItemInserted() == true || isInEditMode == true) {
              var Ordergrid = $telerik.$('[id$=OrdersGrid]');
              if (Ordergrid != null) {
                  var orderGridObj = $find(Ordergrid.attr("id"));
                  var ordermasterTable = orderGridObj.get_masterTableView();
                  
                  if (AARgridObj.get_editItems().length > 0) {
                      // var editedItem = ordermasterTable.editItem(ordermasterTable.get_dataItems()[0].get_element());
                      var editedItems = orderGridObj.get_editItems()
                          for (var i = 0; i < editedItems.length; i++) {
 
                               
                         // How to get the validators here?? I want to get the validators from the edit row and
                         // attach the $updnValidatorCallout to them?                               
 
                          //    var item = editedItems[0];
                                
                          //    var RequiredOrderName = item._element.cells[1].children[0];
                          //    var RequiredOrderAdd = item._element.cells[2].children[0];
 
                          //    $(ownerValidator).updnValidatorCallout();
                          //    $(carValidator).updnValidatorCallout();
                          }
                  }
                  else {
                      $.updnValidatorCallout.attachAll();
                  }
              }
 
          }
          
 
      }
  }


 
Tsvetina
Telerik team
 answered on 10 Feb 2012
1 answer
85 views
When I go to upload an excel file that I have open on my desktop, it errors somewhere in the javascript with a generic error. I have some .Net code to test if the file is open. However, I do not know where to call it. I tried OnClientFileSelected with no luck.
Bozhidar
Telerik team
 answered on 10 Feb 2012
3 answers
239 views
I am trying to create a large combo box, however when I increase the font size, the control does not render correctly.  I don't see any other properties that allow me to adjust the control accordingly. It doesn't matter what skin I choose.  See the image example I attached.

Princy
Top achievements
Rank 2
 answered on 10 Feb 2012
1 answer
104 views
Hi,

i have a problem, i want to float two menu item on the right, but only the last one would float to the right.

I set it in the css file.

Can anyone help me?

Sorry for my english.

Thanks

Andrea
Shinu
Top achievements
Rank 2
 answered on 10 Feb 2012
1 answer
60 views
Hi,
I have a problem with ImageEditor in the pages that have a MasterPageFile.
when I use ImageEditor in a seperated WebForm (without MasterPage) it works properly,
but when I use a MasterPage and put ImageEditor in the <asp:Content> tag, the tools dialogs don't load completely,
the tools dialogs only contain a title bar.
Thank you
Pero
Telerik team
 answered on 10 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?