Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
433 views
Hi expert,

          I follow Radwindow Demo. After that i want to remove Pin, Min, Max button of 2nd Window. How should i remove it? My code is excetly same with Demo.


Best Regards,
ALEX
Top achievements
Rank 1
 answered on 09 May 2011
9 answers
562 views
Hi,
I would to get the height of the window after the command of maximizing.

I use this client function:

function OnClientCommand(sender, eventArgs) {                
if (eventArgs._commandName == "Maximize") {
alert(GetRadWindow().getWindowBounds().height);
}

But the message shows the height of the first maximize... 

Thank.

Alessio.
            
Bader
Top achievements
Rank 1
 answered on 08 May 2011
4 answers
197 views
Hello,

I have a problem,
I have a radwindow control which displays a webpage that contains a label control.
I need to set the height of this radwindow in that label and use it within the c# code of the page.

i'm using rhe following javascript code:
function FocusOnRadWindow() {
window.setTimeout(function () {
GetRadWindow().GetContentFrame().contentWindow.focus();
var wndHeightValue = GetRadWindow().get_popupElement().style.height.toString().replace("px", "");
document.getElementById("TestLabel").innerHTML = wndHeightValue;
}, 100);
}

I call the above function like this:
<body onload="FocusOnRadWindow()">

The height is retrieved without problems, but the issue is I can't access that value in code behind. for example, If I use the following code, I recieve an error message (Attached):
int wndHeight = Convert.ToInt32(TestLabel.Text) - 130;

Please, Can you explain to me how can I solve this problem.
It is very apprecited to send me the modified code with an explaination regarding the above situation.

Regards,
Bader
Bader
Top achievements
Rank 1
 answered on 08 May 2011
1 answer
183 views
Hello,


I have a RadGrid that is using EditFormType="AutoGenerated".  I am using the InsertCommand handler to harvest the values from the controls and insert a "Video" record.  There are a couple of RadComboBox controls, numerous RadTextBox controls and a RadEditor.

The grid also has GridTemplateColumn definitions for a couple of the RadTextBoxes so that I can attach the Validator to validate an integer was entered.  The RadComboBoxes are also in a GridTemplateColumn.  

There are other grids in the project that use EditFormType="AutoGenerated"  and I am able to get the values looping through the RenderColumns.  This works..

foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
   {
          if (column is IGridEditableColumn)
                {
                    IGridEditableColumn editableCol = (column as IGridEditableColumn);
                    if (editableCol.IsEditable)
                    {
                        editor = editMan.GetColumnEditor(editableCol);
  
  
                        if (editor is GridTextColumnEditor)
                        {
                            editorText = (editor as GridTextColumnEditor).Text;
                            editorValue = (editor as GridTextColumnEditor).Text;
  
                            if (editableCol.Column.UniqueName == "AddressTypeStr")
                            {
                                newAddressType.AddressTypeStr = editorValue.ToString();
                            }
  
                            if (editableCol.Column.UniqueName == "TypeDescription")
                            {
                                newAddressType.TypeDescription = editorValue.ToString();
                            }
                        }
                    }
                }
            } // ForEach

If I use that same construct for the way this template is layed out I am not sure how to access the values in the GridBoundColumns because the cast below does not work.

if (editor is GridBoundColumn)
  {
editorText = (editor as GridBoundColumn).Text;
editorValue = (editor as GridBoundColumn).Text;
   }


So I am unsure how to get the values from this scenario.  Here is my markup for the RadGrid.

<telerik:RadGrid ID="ctrlRadGridVideos" runat="server"  Height="700"
                  AllowFilteringByColumn="True"  EnableAJAX="true"
               AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" GridLines="None"
               ShowGroupPanel="True" ShowStatusBar="True" Skin="Telerik">
               <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true" AllowColumnsReorder="true"
                   AllowDragToGroup="True">
                   <Selecting AllowRowSelect="True" />
                   <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                   <Resizing AllowColumnResize="True" />
               </ClientSettings>
               <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="PrimaryKey" EditItemStyle-ForeColor="#669999">
                   <RowIndicatorColumn>
                       <HeaderStyle Width="100px" />
                   </RowIndicatorColumn>
                   <ExpandCollapseColumn>
                       <HeaderStyle Width="100px" />
                   </ExpandCollapseColumn>
                   <Columns>
                       <telerik:GridEditCommandColumn HeaderStyle-Width="50" ItemStyle-ForeColor="Blue"
                                           UniqueName="Edit">
                                           <HeaderStyle Width="50px" />
                                           <ItemStyle ForeColor="Blue" />
                                       </telerik:GridEditCommandColumn>
                       <telerik:GridBoundColumn DataField="VideoTitle" HeaderText="Video Title" UniqueName="VideoTitle" EditFormColumnIndex="0"
                        ShowSortIcon="true">
                       </telerik:GridBoundColumn>                                        
                       <telerik:GridBoundColumn DataField="VideoSubTitle" HeaderText="Sub Title" UniqueName="VideoSubTitle" EditFormColumnIndex="0"
                        ShowSortIcon="true">
                       </telerik:GridBoundColumn>
                       <telerik:GridTemplateColumn HeaderText="Description" UniqueName="VideoDescription" EditFormColumnIndex="1" Visible="false"  
                           HeaderStyle-VerticalAlign="Top" HeaderStyle-Height="100%" ShowSortIcon="true">  
                           <EditItemTemplate>  
                               <telerik:RadEditor ID="ctrlVideoDescriptionRadEditor" runat="server" Content='<%# Bind("VideoDescription") %>'  
                                    Height="100%" Width="100%" Skin="Web20">
                                    <CssFiles>
                                      <telerik:EditorCssFile Value="~/Content/css/RadEditorContentArea.css" />
                                    </CssFiles>
                               </telerik:RadEditor>
                           </EditItemTemplate>  
                                 </telerik:GridTemplateColumn>  
                       <telerik:GridTemplateColumn HeaderText="Type" UniqueName="VideoType" EditFormColumnIndex="0" Visible="false">  
                           <EditItemTemplate>  
                               <telerik:RadComboBox ID="ctrlVideoTypeRadComboBox" runat="server"  
                                     Width="220px" Skin="Web20" />  
                           </EditItemTemplate>  
                           <ItemTemplate>  
                               <asp:Label ID="ctrlVideoTypeLabel" runat="server" Text="Video Type" />  
                           </ItemTemplate>  
                       </telerik:GridTemplateColumn>  
                       <telerik:GridTemplateColumn HeaderText="Category" UniqueName="VideoCategory" EditFormColumnIndex="0" Visible="false">  
                           <EditItemTemplate>  
                               <telerik:RadComboBox ID="ctrlVideoCategoryRadComboBox" runat="server"  
                                     Width="220px" Skin="Web20" />  
                           </EditItemTemplate>  
                           <ItemTemplate>  
                               <asp:Label ID="ctrlVideoCategoryLabel" runat="server" Text="Video Category" />  
                           </ItemTemplate>  
                       </telerik:GridTemplateColumn>  
                       <telerik:GridBoundColumn DataField="VideoHyperlink" HeaderText="URL Hyperlink" UniqueName="VideoHyperlink" 
                         EditFormColumnIndex="0" Visible="false">
                       </telerik:GridBoundColumn>
                         
                       <telerik:GridBoundColumn DataField="VideoSEOKeywords" HeaderText="SEO Keywords" UniqueName="SEOKeywords" 
                          EditFormColumnIndex="0" Visible="false">
                       </telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="VideoSEODescription" HeaderText="SEO Description" UniqueName="VideoSEODescription" 
                          EditFormColumnIndex="0" Visible="false">
                       </telerik:GridBoundColumn>
                       <telerik:GridTemplateColumn HeaderText="Rating" UniqueName="Rating" EditFormColumnIndex="0">
                           <EditItemTemplate>
                               <asp:TextBox ID="ctrlVideoRatingRadTextBox" runat="server" ValidationGroup="checkRating"
                                   Width="80px" />
                               <asp:RegularExpressionValidator ID="RegularExpressionValidatorRating" runat="server" ControlToValidate="ctrlVideoRatingRadTextBox"
                                   ErrorMessage="Please Enter Only Numbers" ValidationExpression="^\d+$" ValidationGroup="checkRating" ForeColor="Red">
                                </asp:RegularExpressionValidator>
                           </EditItemTemplate>
                           <ItemTemplate>
                               <asp:Label ID="ctrlVideoRatingLabel" runat="server" Text="" />
                           </ItemTemplate>
                       </telerik:GridTemplateColumn>
                       <telerik:GridTemplateColumn HeaderText="Height" UniqueName="Height" EditFormColumnIndex="0" Visible="false">
                           <EditItemTemplate>
                               <asp:TextBox ID="ctrlVideoHeightTextBox" runat="server" ValidationGroup="checkHeight"
                                   Width="80px" />
                               <asp:RegularExpressionValidator ID="RegularExpressionValidatorHeight" runat="server" ControlToValidate="ctrlVideoHeightTextBox"
                                   ErrorMessage="Please Enter Only Numbers" ValidationExpression="^\d+$" ValidationGroup="checkHeight" ForeColor="Red">
                                </asp:RegularExpressionValidator>
                           </EditItemTemplate>
                           <ItemTemplate>
                               <asp:Label ID="ctrlVideoHeightLabel" runat="server" Text="Height" />
                           </ItemTemplate>
                       </telerik:GridTemplateColumn>
                       <telerik:GridTemplateColumn HeaderText="Width" UniqueName="Width" EditFormColumnIndex="0" Visible="false">
                           <EditItemTemplate>
                               <asp:TextBox ID="ctrlVideoWidthTextBox" runat="server" ValidationGroup="checkWidth"
                                   Width="80px" />
                               <asp:RegularExpressionValidator ID="RegularExpressionValidatorWidth" runat="server" ControlToValidate="ctrlVideoWidthTextBox"
                                   ErrorMessage="Please Enter Only Numbers" ValidationExpression="^\d+$" ValidationGroup="checkWidth" ForeColor="Red">
                                </asp:RegularExpressionValidator>
                           </EditItemTemplate>
                           <ItemTemplate>
                               <asp:Label ID="ctrlVideoWidthLabel" runat="server" Text="Width" />
                           </ItemTemplate>
                       </telerik:GridTemplateColumn>
                       <%-- <telerik:GridTemplateColumn HeaderText="Hyperlink" UniqueName="VideoHyperlink" EditFormColumnIndex="0">  
                           <EditItemTemplate>  
                               <telerik:RadTextBox ID="ctrlVideoHyperlinkRadTextBox" runat="server"  
                                     Width="220px" Skin="Web20" />  
                           </EditItemTemplate>  
                           <ItemTemplate>  
                               <asp:Label ID="ctrlVideoHyperLinkLabel" runat="server" Text="Video Hyperlink" />  
                           </ItemTemplate>  
                       </telerik:GridTemplateColumn>  --%>
                       <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="Delete"
                                           HeaderStyle-Width="50" ConfirmText="Confirm: Delete Selected Video?" ConfirmTitle="Confirmation"
                                           ItemStyle-ForeColor="Blue">
                                           <HeaderStyle Width="50px" />
                                           <ItemStyle ForeColor="Blue" />
                                       </telerik:GridButtonColumn>
                   </Columns>
                   <EditItemStyle ForeColor="#669999" />
                   <PagerStyle AlwaysVisible="True" />
                   <EditFormSettings EditFormType="AutoGenerated" FormStyle-Height="500" FormStyle-Width="100%" ColumnNumber="3" >
                      <%-- <EditColumn UniqueName="EditColumn0" >
                       </EditColumn>--%>
                       <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                       <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                       <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" Width="100%" />
                       <FormTableStyle GridLines="Horizontal" CellSpacing="0" CellPadding="2" CssClass="module"    Height="110px" Width="100%" />
                       <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                 
                       
                       <FormStyle Height="700px" Width="100%" />
                        
                   </EditFormSettings>
               </MasterTableView>
           </telerik:RadGrid>

1) So I am unclear how to get the values from the GridBoundColumns or the nested controls in the GridTemplateColumns.

2) Also, this scenario is in INSERT.  Does it differ in the UpdateCommand handler?

Any suggestions would be appreciated.

Thanks,
Reid
Reid
Top achievements
Rank 2
 answered on 07 May 2011
4 answers
173 views

To give a little background, I have a RadSplitter set up with two panes - one for a RadTreeView and the other for "external content" (using URLs, but they are all internal to the site). The nodes in the tree are setup like this:

  • Root Node (database driven)
    • Static Node, ServerSideCallback expand method
      • X Nodes (database driven)
    • Static Node, ServerSide expand method (required for custom context menus)
      • X Nodes (database driven, custom context menus)

The entire TreeView object is setup as an AjaxUpdatedControl which, combined with the Javascript "node.showLoadingStatus()" method (in lieu of a LoadingPanel covering the entire tree), allows the nodes that are configured as ServerSide to appear to behave identically to the ServerSideCallback expanding nodes. This is setup as so:

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" EnableAJAX="true">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="trProjects">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="trProjects" />
                <telerik:AjaxUpdatedControl ControlID="hvNodeToSelect" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
    <ClientEvents OnResponseEnd="ajaxCallback" />
</telerik:RadAjaxManager>

When a certain action occurs on the main RadPane (where the "external" content is at - internal pages so XSS is not an issue) the loaded page calls a function called "selectNode" on the parent (which contains the RadSplitter, TreeView, etc.) which looks like this:

//called from child pages to select the associated node
function selectNode(parent, child) {
    var parentNode = treeView.findNodeByValue(parent);
    setNodeToSelect(child);
  
    if (!parentNode.get_expanded()) {
        if (!parentNode.get_parent().get_expanded())
            parentNode.get_parent().expand();
  
        parentNode.expand();              
  
    } else {
        if (parentNode.get_expandMode() != 1) { //Server-side (encapsulated by RadAJAX)
            var childNode = treeView.findNodeByValue(child);
            childNode.set_selected(true);            
            nodeToSelect = null; //page-level javascript variable
        }
    }
}

The first thing it does is check to see if the parent node is expanded (all the way through the top-level root node) and expands down. For the purposes of this issue this is the block being called and not the other half (the "else" clause). When I execute the action that fires this the bottom-level child node (one of the database-driven X nodes as referenced above, the parent being the one with the ServerSideCallback expand mode) gets selected which is exactly what I want.

What I've noticed though is once I've utilized the "parentNode.expand();" method on a node that is ServerSide (which the RadAjaxManager makes appear as if no postback occurs) this functionality stops working. To better explain this, inside the method above there is a small function called setNodeToSelect called right at the beginning which looks like this:

function setNodeToSelect(value) {
    nodeToSelect = value;
    hvNodeToSelect.value = nodeToSelect;
}

This sets the page-level variable "nodeToSelect" equal to the value of the node that needs to select. It also sets a hidden field's value equal to that same one, but that has no bearing on this. Since "parentNode.expand();" is trying to expand a ServerSideCallback node that should fire the client-side "NodePopulated" event. I have that configured to do the actual node selection and the signature looks like this:

function trProjects_NodePopulated(sender, args) {
    var node = args.get_node();
  
    if (nodeToSelect != null) {
        treeView.findNodeByValue(nodeToSelect).set_selected(true);
        nodeToSelect = null;
    }
}

This seems to occur fine up until I have expanded the node that is setup as ServerSide for retrieving items (which is required because of a custom context menu per item). Once I have done that (with the RadAjaxManager making it appear a postback didn't occur) I can no longer call the "parentNode.expand();" methods nor does the NodePopulated event get fired. What is even stranger is calling "parentNode.expand();" doesn't throw any errors, instead it just fails to expand the ServerSideCallback node being referenced. The strangest part of all is if I do something like "alert(parentNode.get_expanded());" it returns True even though the node is not actually expanded!

I was tinkering with how this whole process worked and was finally able to get a Javascript error that might help point someone in the right direction on this. If I have the Static Node (the one with ServerSideCallback as the expand mode) already expanded what should occur is any action executed should automatically select the node it is associated with inside that "else" block above that starts out with "if (parentNode.get_expandMode() != 1)" since the parent is already expanded. This functionality works great up until I do something with the ServerSide node and then it starts erroring out with this: "this.get_element() is undefined" on line 1241 of one of the Telerik embedded Javascript files (ScriptResource.axd).

The line that fails (1241) is:

this.get_element().value=d

The line where this fails is immediately above this entry:

_registerSelectedNode:function(d){this._insertSortedHierarchicalIndexInArray(d._getHierarchicalIndex(),this._clientState.selectedNodes);

Any thoughts on this? Are there known issues with mixing ServerSide and ServerSideCallback nodes with an AjaxManager intervening on behalf of ServerSide nodes? Keep in mind that this only fails once I have interacted with the ServerSide node. Up until I do that everything works exactly as expected.

Thanks in advance!

Edit: Added "this.get_element().value=d" for better reference. Also some slight formatting changes (whitespace) for easier reading.
digitall
Top achievements
Rank 1
 answered on 07 May 2011
5 answers
128 views
Hi,

I have created my own custom RadGrid column control by extending GridEditableColumn class. I have placed two label controls in the cells. I have used InPlace edit mode for the grid. I have used the labels for edit as well as non edit mode for the cell. These controls show up in the page for both edit as well as non edit modes. The problem I'm facing is , whenever I fire the insert or update commands, the GridDataItem(from e.Item) shows that the cell contains no controls. Could somebody please help me on how to maintain the controls when the Insert or Update commands are fired.

Also once this is done I would also like to know, which method to override or event to register to, so that when I call the ExtractValues method on the GridDataItem(from e.Item) object, I get the value from that specific control in the cell that I will decide.

Thanks
Dennis
Top achievements
Rank 1
 answered on 07 May 2011
2 answers
95 views
Is it possible to have mouse over text on a pie chart so you can get the Legend text for an area to show up? The number alone and color isn't enough information for users that are color blind.

Thanks!
MarkX
Top achievements
Rank 1
 answered on 06 May 2011
3 answers
117 views
I have a RadWindow with a RadGrid. How can I close this window after the OnItemCommand event??

AHIA,
Larry...

<Windows>
           <telerik:RadWindow ID="GLLookupWindow" runat="server" Behaviors="Close" Width="900" Height="700" OnClientClose="UnhideIframe_OnClientClose">
            <ContentTemplate>
 
               <asp:Panel runat="server" ID="pnlGLLookup" Visible="true" TabIndex="-1">
 
                   <telerik:RadGrid AutoGenerateColumns="False" ID="GLLookup" OnItemCommand ="GLLookup_ItemCommand" AllowFilteringByColumn="true" OnItemCreated="GLLookup_ItemCreated"
                   DataSourceID="SqlDataSourceGLLookupwindow" AllowSorting="true" runat="server" PagerStyle-AlwaysVisible="true" AllowPaging="true" PageSize ="20" >
                       <GroupingSettings CaseSensitive="false" />
                       <MasterTableView DataKeyNames="GCMGRP,GCACCT,GCSACT,GCDEPT,GCDESC" >
                        <PagerStyle Mode="NumericPages" PageButtonCount="5" />
                           <Columns>
                               <telerik:GridBoundColumn HeaderText="Major" DataField="GCMGRP" UniqueName="GCMGRP" AllowFiltering="true"
                                   SortExpression="GCMGRP" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                   HeaderStyle-VerticalAlign="Bottom" />
                               <telerik:GridBoundColumn HeaderText="Acct" DataField="GCACCT" UniqueName="GCACCT" AllowFiltering="true"
                                   SortExpression="GCACCT" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                   HeaderStyle-VerticalAlign="Bottom" />
                               <telerik:GridBoundColumn HeaderText="Sub" DataField="GCSACT" UniqueName="GCSACT" AllowFiltering="true"
                                   SortExpression="GCSACT" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                   HeaderStyle-VerticalAlign="Bottom" />
                                <telerik:GridBoundColumn HeaderText="Dept/Loc" DataField="GCDEPT" UniqueName="GCDEPT" AllowFiltering="true"
                                   SortExpression="GCDEPT" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                   HeaderStyle-VerticalAlign="Bottom" />
                                <telerik:GridBoundColumn HeaderText="Description" DataField="GCDESC" UniqueName="GCDESC" AllowFiltering="true"
                                   SortExpression="GCDESC" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                   HeaderStyle-VerticalAlign="Bottom" />
                           </Columns>
                           <ItemStyle Wrap="false" />
                              <PagerStyle Mode="NumericPages" AlwaysVisible="true"></PagerStyle>
                       </MasterTableView>
                       <ClientSettings EnablePostBackOnRowClick="true" >
                       </ClientSettings>
                   </telerik:RadGrid>
               </asp:Panel>
 
             
             
            </ContentTemplate>
           </telerik:RadWindow>
</Windows>
larry reames
Top achievements
Rank 1
 answered on 06 May 2011
1 answer
85 views
Respected Person,

I don't want show some label items in Bar chart.
Please see attachment for information.

Please reply me how can I make it visible false.
Gimmik
Top achievements
Rank 1
 answered on 06 May 2011
3 answers
99 views
In both IE and FF...I have 3 text boxes, all 3 with misspelled words. I am using a button to trigger the spell check...the spell check dialog pops up and suggests correct words...I hit 'change'...then it says 'The Spell Check is complete!'...when I click 'OK' the text in the textboxes has not changed. While the code shows the textboxes as enabled=false, they are enabled=true at the time of spellcheck.

<script type="text/javascript">
        function spellCheck() {
            var spell = $find('<%= splContractSpellCheck.ClientID %>');
            spell.startSpellCheck();
        }
</script>
  
<asp:Button ID="btnContractSpellCheck" runat="server" Text="Spell Check" CssClass="buttonStyle" CausesValidation="False" UseSubmitBehavior="False" OnClientClick="javascript: spellCheck()" />
  
<telerik:RadSpell ID="splContractSpellCheck" runat="server" ControlsToCheck="txtContractSummary,txtContractPurpose,txtContractComments"                                 ButtonType="None" />
  
<asp:TextBox ID="txtContractSummary" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="34px" Enabled="false" />
<asp:TextBox ID="txtContractPurpose" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="86px" Enabled="false" />
<asp:TextBox ID="txtContractComments" runat="server" TextMode="MultiLine" MaxLength="1000" Width="100%" Height="52px" Enabled="false" />
Adam
Top achievements
Rank 1
 answered on 06 May 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?