Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
276 views
Hi,

I have a RadTreeView which has a context menu defined in the aspx page.  The nodes are loaded from an xml file.

Is there any way I can enable/disable context menu items dependant on the attributes of each individual treenode?  I.E. some of the nodes will be marked as uneditable so I would like to disable that item in that node's context menu.

XML Source:
<Tree> 
  <Node Text="Front Page" Value="" ContextMenuID="rtvcmFrontPage"/> 
  <Node Text="Section One" Value="1" ContextMenuID="rtvcmSection" /> 
  <Node Text="Section Two" Value="2" ContextMenuID="rtvcmSection" CanDelete="False" CanEdit="False" /> 
  <Node Text="Section Three" Value="3" ContextMenuID="rtvcmSection" /> 
  <Node Text="Section Four" Value="4" ContextMenuID="rtvcmSection" CanDelete="False" /> 
  <Node Text="Section Five" Value="5" ContextMenuID="rtvcmSection" /> 
</Tree> 

TreeeView declaration:
<telerik:RadTreeView ID="rtvSections" runat="server"  
                        OnClientNodeClicked="ClientNodeClicked" 
                        OnClientContextMenuItemClicking="ClientContextMenuItemClicking"
  <ExpandAnimation Duration="200" /> 
  <CollapseAnimation Duration="200" Type="OutQuint" /> 
  <ContextMenus> 
    <telerik:RadTreeViewContextMenu ID="rtvcmSection" runat="server"
      <Items> 
        <telerik:RadMenuItem Text="Insert Section"
          <Items> 
            <telerik:RadMenuItem Text="Before" Value="InsertSectionBefore" /> 
            <telerik:RadMenuItem Text="After" Value="InsertSectionAfter" /> 
          </Items> 
        </telerik:RadMenuItem> 
        <telerik:RadMenuItem Text="Edit Section" Value="EditSection" /> 
        <telerik:RadMenuItem Text="Delete Section" Value="DeleteSection" /> 
        <telerik:RadMenuItem IsSeparator="true" /> 
        <telerik:RadMenuItem Text="New Item" Value="NewItem" /> 
      </Items> 
    </telerik:RadTreeViewContextMenu> 
  </ContextMenus> 
</telerik:RadTreeView> 

Is there anyway I can do this or am I going to have to dynamically create a context menu for every node that requires a non-standard menu?

Cheers,
Nick
Nick
Top achievements
Rank 1
 answered on 17 Oct 2008
3 answers
103 views
I use EditForm template in the RadGrid.
In the 

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)  
{   
 
}  
 
I can use the following codes to refer a control in Insert Form: 
 
GridEditableItem insertItem = e.Item.OwnerTableView.GetInsertItem();   
 
ListBox ListBoxA = (ListBox)insertItem.FindControl("ListBox1");  
 
 

How can I do the same thing for the Edit Form?

"GridEditableItem insertItem = e.Item.OwnerTableView.GetInsertItem(); " doesn't work for the  Edit Form.  I got the error message "Insert item is available only when grid is in insert mode."

Please help.
Iana Tsolova
Telerik team
 answered on 17 Oct 2008
3 answers
150 views

I use RadUpload in the EditForm template in the RadGrid.
My question is: How to disable AJAX when the user clicks "Insert" or "Update" button?

The Javascript codes I used doesn't work:

 
var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$","ig");  
 
if (sender.EventTarget.match(theRegexp))  
{  
  sender.EnableAjax = false;  

Please look at the codes for RadUpload and buttons in EditForm at below

<EditFormSettings EditFormType="Template">  
<FormTemplate> 
<table> 
  <tr> 
    <td>File:</td> 
    <td> 
      <telerik:RadUpload ID="RadUpload1" Skin="Vista" runat="server" InitialFileInputsCount="1" MaxFileInputsCount="1" ControlObjectsVisibility="None" MaxFileSize="1000000" AllowedFileExtensions=".pdf" TargetPhysicalFolder="<%$ appSettings:UploadPath %>" /> 
    </td> 
  </tr> 
  <tr> 
    <td> 
      <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button> 
      <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button> 
    </td> 
    <td></td>  
  </tr> 
</table> 
</FormTemplate> 
</EditFormSettings> 
 
 

Thanks,Jason

Jason M
Top achievements
Rank 2
 answered on 17 Oct 2008
3 answers
125 views
Hi,

I am using a RadTreeView control in RadCombobox. All the combobox are being generated at runtime and nodes are also added at runtime. I have checkboxes enabled in my treeview and depth of treeview is of 1 level. I am changing the RadCombobox text at OnClientNodeChecked event.
My problem is when there is no check box is selected and if I click on some node, combobox text is automatical updated with the concatenated string containing the text of all nodes. When I check or uncheck a check box, proper event is firing and my custom code is being called. But in case of node click or some times even on treeview click combobox text is being updated.

How can I resolve this.

Thanks,
Pankaj
Yana
Telerik team
 answered on 17 Oct 2008
4 answers
212 views
I have a menu with a sub menu, that has an item with another sub menu.

The last sub menu won't show.  Any help would be appreciated.  Here is the aspx and css code:
<telerik:RadMenuItem NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" CssClass="menuSpeedOrdering"
                        <Items> 
                            <telerik:RadMenuItem Text="TEST" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" GroupSettings-ExpandDirection="Up" GroupSettings-OffsetX="100" GroupSettings-Width="200"
                                <Items> 
                                    <telerik:RadMenuItem Text="TEST2" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                                    <telerik:RadMenuItem Text="TEST2" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                                    <telerik:RadMenuItem Text="TEST2" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                                    <telerik:RadMenuItem Text="TEST2" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                                    <telerik:RadMenuItem Text="TEST2" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                                    <telerik:RadMenuItem Text="TEST2" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                                    <telerik:RadMenuItem Text="TEST2" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                                    <telerik:RadMenuItem Text="TEST2" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem> 
                                </Items> 
                            </telerik:RadMenuItem>     
                            <telerik:RadMenuItem Text="TEST" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                            <telerik:RadMenuItem Text="TEST" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                            <telerik:RadMenuItem Text="TEST" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                            <telerik:RadMenuItem Text="TEST" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                            <telerik:RadMenuItem Text="TEST" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                            <telerik:RadMenuItem Text="TEST" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem>     
                            <telerik:RadMenuItem Text="TEST" NavigateUrl="~/orders/speedorder.aspx" ToolTip="Employee" ></telerik:RadMenuItem> 
                        </Items> 
                    </telerik:RadMenuItem>  

/* RadMenu Telerik Skin */ 
/* Text color size and style of whole menu*/ 
 
 
/*Entire menu*/ 
div.RadMenu_Shade ul.rmHorizontal 
    border0px solid #262626
    floatleft
    padding: 0; 
    width795px
    height40px
    margin-leftauto
    margin-rightauto
    /*background: transparent url('../images/menu/light.gif');*/ 
/* Normal Item */ 
.rmHorizontal .rmItem 
    width112px
    height37px
    /*background: transparent url('../images/menu/light.gif');*/ 
 
.rmHorizontal .rmItem .menuSpeedOrdering 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu1.gif'no-repeat 0 0; 
.rmHorizontal .menuSpeedOrdering:hover, .rmHorizontal .menuSpeedOrdering:active 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu1a.gif'no-repeat 0 0; 
 
.rmHorizontal .rmItem .menuCatalogBrowse 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu2.gif'no-repeat 0 0; 
.rmHorizontal .menuCatalogBrowse:hover, .rmHorizontal .menuCatalogBrowse:active 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu2a.gif'no-repeat 0 0; 
 
.rmHorizontal .rmItem .menuProductFinder 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu3.gif'no-repeat 0 0; 
.rmHorizontal .menuProductFinder:hover, .rmHorizontal .menuProductFinder:active 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu3a.gif'no-repeat 0 0; 
.rmHorizontal .rmItem .menuTrackOrders 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu4.gif'no-repeat 0 0; 
.rmHorizontal .menuTrackOrders:hover, .rmHorizontal .menuTrackOrders:active 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu4a.gif'no-repeat 0 0; 
 
.rmHorizontal .rmItem .menuAdminUsers 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu5.gif'no-repeat 0 0; 
.rmHorizontal .menuAdminUsers:hover, .rmHorizontal .menuAdminUsers:active 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu5a.gif'no-repeat 0 0; 
 
.rmHorizontal .rmItem .menuCompanyInfo 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu6.gif'no-repeat 0 0; 
.rmHorizontal .menuCompanyInfo:hover, .rmHorizontal .menuCompanyInfo:active 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu6a.gif'no-repeat 0 0; 
 
.rmHorizontal .rmItem .menuCustService 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu7.gif'no-repeat 0 0; 
.rmHorizontal .menuCustService:hover, .rmHorizontal .rmItem .menuCustService  .menuCustService:active 
    width112px
    height37px
    backgroundtransparent url('../images/menu/btn_menu7a.gif'no-repeat 0 0; 
 
.rmHorizontal .rmLink:hover, 
.rmHorizontal .rmFocused, 
.rmHorizontal .rmExpanded 
    width112px
    height37px
 
.rmHorizontal .rmText 
    padding8px 24px 8px 14px
 
ul.rmVertical 
    border1px solid #808080
    floatleft
    backgroundurl('../images/menu/dropdowndot.gif'repeat
 
.rmVertical .rmItem 
       height20px
       overflow:hidden
       padding-bottom4px
.rmVertical .rmLink 
   height20px
       overflow:hidden
       padding-bottom4px
 
.rmVertical .rmText 
    height20px
       overflow:hidden
    padding-bottom4px
 
.rmVertical .rmExpandRight 
 
.rmVertical .rmLink:hover, 
.rmVertical .rmFocused, 
.rmVertical .rmExpanded 
    colorwhite
    backgroundurl('../images/menu/dropdowndotdark.gif'repeat
    height20px
       overflow:hidden
 
.rmVertical .rmLink:hover .rmText, 
.rmVertical .rmFocused .rmText, 
.rmVertical .rmExpanded .rmText 
   height20px
       overflow:hidden
 
.rmVertical .rmLink:hover .rmExpandRight, 
.rmVertical .rmFocused .rmExpandRight, 
.rmVertical .rmExpanded .rmExpandRight 
   height20px
       overflow:hidden
 
.rmVertical .rmGroup 
   height20px
       overflow:hidden
 
.rmVertical .rmGroup .rmLink 
   height20px
       overflow:hidden
 
.rmVertical .rmGroup .rmText 
   height20px
       overflow:hidden
 
.rmVertical .rmGroup .rmLink:hover, 
.rmVertical .rmGroup .rmFocused, 
.rmVertical .rmGroup .rmExpanded 
   height20px
       overflow:hidden
 
 .rmVertical .rmGroup .rmLink:hover .rmText, 
 .rmVertical .rmGroup .rmFocused .rmText, 
 .rmVertical .rmGroup .rmExpanded .rmText 
   height20px
       overflow:hidden
 
 .rmVertical .rmGroup .rmLink:hover .rmExpandRight, 
 .rmVertical .rmGroup .rmFocused .rmExpandRight, 
 .rmVertical .rmGroup .rmExpanded .rmExpandRight 
   height20px
       overflow:hidden
 
 .rmSeparator 
 
 .rmSeparator .rmText 
 
 .rmTopArrowDisabled, 
 .rmBottomArrowDisabled, 
 .rmLeftArrowDisabled, 
 .rmRightArrowDisabled 
    displaynone
 
 .rmTopArrow, 
 .rmBottomArrow, 
 .rmLeftArrow, 
 .rmRightArrow 
    font-size: 0; 
    color#fff
    line-height: 0; 
 
 .rmTopArrow, 
 .rmBottomArrow 
    height10px
    width: 100%; 
 
 .rmBottomArrow 
    background-positioncenter -18px
 
 .rmLeftArrow, 
 .rmRightArrow 
    width10px
    height: 100%; 
 
 .rmRightArrow 
    background-position: -18px center

Clarence
Top achievements
Rank 1
 answered on 17 Oct 2008
1 answer
37 views
Dear forum,
I need suggestion for how to display progress indicator in grid column,
either with TemplateColumn or user control.
I have requirement for it with colored background, which is red, orange, or green. for 0-30%, 31-60%, 61-100%. Maybe someone has sample code.
Thanks all
Iana Tsolova
Telerik team
 answered on 17 Oct 2008
10 answers
422 views
Hi All,

I'm trying to display a grid and use the frozencolumns property to freeze the first column ('Shop'). However this isn't working in IE7. Here's my code for the grid:

<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" Skin="Vista" runat="server" 
            AllowPaging="True" AllowSorting="True" GridLines="None" PageSize="50"
            <MasterTableView TableLayout="Auto" AutoGenerateColumns="false" Width="500px"
            <Columns> 
                <telerik:GridHyperLinkColumn DataNavigateUrlFields="CampaignName,BranchName"DataNavigateUrlFormatString="BranchReport.aspx?CampaignName={0}&amp;BranchName={1}" DataTextField="BranchName" HeaderText="Shop" SortExpression="BranchName"></telerik:GridHyperLinkColumn> 
                <telerik:GridBoundColumn DataField="GrossToday" HeaderText="Gross Today" SortExpression="GrossToday"></telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="GrossTW" HeaderText="Gross This Week" SortExpression="GrossTW"></telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="GrossTP" HeaderText="Gross This Period" SortExpression="GrossTP"></telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="GrossTY" HeaderText="Gross This Year" SortExpression="GrossTY"></telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="PaxToday" HeaderText="Pax Today" SortExpression="PaxToday"></telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="PaxTW" HeaderText="Pax This Week" SortExpression="PaxTW"></telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="PaxTP" HeaderText="Pax This Period" SortExpression="PaxTP"></telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="PaxTY" HeaderText="Pax This Year" SortExpression="PaxTY"></telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="TargetTW" HeaderText="Target This Week" SortExpression="TargetTW"></telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="TargetTP" HeaderText="Target This Period" SortExpression="TargetTP"></telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="TargetTY" HeaderText="Target This Year" SortExpression="TargetTY"></telerik:GridBoundColumn> 
            </Columns> 
            </MasterTableView> 
            <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true"
                <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" 
                    AllowColumnResize="True"></Resizing> 
                <Selecting AllowRowSelect="True"></Selecting> 
                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="1"
                </Scrolling> 
            </ClientSettings> 
            <HeaderStyle Width="120px" /> 
            <PagerStyle Mode="NextPrevAndNumeric" /> 
        </telerik:RadGrid> 

Also, the Hyperlink column doesn't generate a Hyperlink, just the text in bold. Am I doing anything basic wrong?

Thanks.

Pavel
Telerik team
 answered on 17 Oct 2008
1 answer
144 views

Well if I put raddock control into some div which can be resized and raddock mode is docked I can't change its width via java script.

Can you write a sample of resizing the raddock via undocking and docking (java script).

Sample: User Comtrol inside the raddock. User Control has a button. when I make click on the button I want the raddock to be resize to 300X300 let's say.

Thanks. It is very important and I think not only for me.


P.S of course the raddock is docked and I don't want the user tp see it undocked. It should be done in java script all the logic of undocking and docking back.
Obi-Wan Kenobi
Top achievements
Rank 1
 answered on 17 Oct 2008
3 answers
251 views
Hi,

I have a form that has a number of RadComboBox'es, and selectively add a javascript client event to some comboboxes.

To put it simple..:
C#:
{
    var cb = RadComboBox1;
    if (some_condition == true
        cb.OnClientSelectedIndexChanged = "OnClientSelectedIndexChanged"

ASPX:
<telerik:RadComboBox ID="RadComboBox1" runat="server" Width="200px" 
    MarkFirstMatch="true" HighlightTemplatedItems="true" 
    DataTextField="Text" DataValueField="ID" ItemRequestTimeout="500" 
    Skin="Vista"
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</telerik:RadComboBox> 


javascript:
function OnClientSelectedIndexChanged(item) 
    var combo = item.ComboBox; 
    alert(combo.GetText() + ' ' + combo.GetValue() + ' - ' + combo.ClientID); 
 


However when I do some selection change to the combobox in the browser, the item.ComboBox returns 'undefined'.

What else do I need to do?


Veselin Vasilev
Telerik team
 answered on 17 Oct 2008
3 answers
271 views
Is there any client-side event that will fire after the detail table is expanded or collapsed? 

I'm trying to solve this problem: I have a CommandItemTemplate with a LinkButton which should only be enabled when the number of selected rows > 0.  The JS works fine, when linked to ClientEvents-OnRow{Selected|Deselected}.  The problem comes when the row expands, and the ItemCommand is fired in conjunction with the BindDetailTable.  After this event, the LinkButton is never again seen.

I have tried ItemCommand code-behind to set the Style["visibility"] = "none" (or "inline", if SelectedItems.Count>0), and I have tried a plethora of the ClientEvents-On* but nothing seems to work.

Here is the JS function which works as long as the detail table is not expanded:

function ConditionallyEnableClearButton(sender, eventArgs) { 
    var masterTableView = sender.get_masterTableView(); 
    var selectedItems = masterTableView.get_selectedItems(); 
    var visibility = selectedItems.length > 0 ? "inline" : "none"
 
    var button = document.getElementById('<%= AlertGrid.MasterTableView.GetItems(GridItemType.CommandItem)[0].FindControl("ClearButton").ClientID %>'); 
    if (button) { 
        button.style.display = visibility; 
    } 
 

And here is the ItemCommand code-behind:

LinkButton clearButton = 
                grid.MasterTableView.GetItems(GridItemType.CommandItem)[0].FindControl(CLEAR_BUTTON) as LinkButton; 
var oldValue = clearAlertsButton.Style["display"]; 
clearAlertsButton.Style["display"] = grid.SelectedItems.Count > 0 ? "inline" : "none"
 

I think a pure JS solution would work, if I could hook up the JS function to the end of the expand or collapse event, client-side.

Thanks,
Tim

Tim
Top achievements
Rank 1
 answered on 17 Oct 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?