Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
59 views

We are using latest version of licensed DLL 2016.1.225.35.

Editor Dialogues(Image uploader, link manager, document manager) does not close in all IE versions onclick of Cancel and insert button. whereas this works fine in other browsers.

We are enforcing to load edge version and there are no script errors on pageload?

Should we include any JS files or did we miss any reference files.

  <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <telerik:RadSkinManager runat="server" RenderMode="Lightweight" ID="RadSkinManager1" ShowChooser="true" Skin="Outlook" EnableEmbeddedSkins="true" Visible="false"></telerik:RadSkinManager>  
            <telerik:RadEditor RenderMode="Lightweight" ID="editor1" runat="server" EnableResize="false" EditModes="Design,HTML"
                    AllowThumbGeneration=true
                    UseEmbeddedScripts=false
                    EnableTab="false" width="630px" height="570"
                    Editable="True"
                    RadControlsDir="~/login/sites/editor/telerik/RadControls/"
                    ConfigFile="~/Login/sites/Editor/telerik/RadControls/Editor/ConfigFile.xml"
                    ToolsFile="~/Login/sites/Editor/telerik/RadControls/Editor/ToolsFile.xml"
                    ExternalDialogsPath="~/login/sites/editor/telerik/RadControls/Editor/EditorDialogs"                        
                    OnClientLoad="onClientLoad" EnableEmbeddedSkins ="true">

            </telerik:RadEditor>

 

 

Misho
Telerik team
 answered on 30 Mar 2016
2 answers
104 views
I'm trying to achive this scenario.

 

I have a RadDropDownTree using persistence framework to retain the selected combo value. My code is below.

When a user visits my page, the persistence framework correctly pulls the correct RadDropDownTree1.SelectedValue from the cookie and restores the RadDropDownTree as I expect. The issue is when I try to read RadDropDownTree1.SelectedValue after calling loadState in my code below (highlighted in bold) the value is always empty "". I presume this is due to a timing issue? What would be the correct way to do this?
 
 
private static readonly string CookieName = "TestCookie";
 
protected void Page_Init(object sender, EventArgs e)
{
    RadPersistenceManager1.StorageProviderKey = CookieName;
    RadPersistenceManager1.StorageProvider = new CookieStorageProvider(CookieName);
}
 
 
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
 
 
        if (Request.Cookies[CookieName] != null)
        {
            RadDropDownTree1.DataBind();
            RadPersistenceManager1.LoadState();
            Label1.Text = RadDropDownTree1.SelectedValue;
        }
    }
     
}
 
protected void RadDropDownTree1_EntriesAdded(object sender, DropDownTreeEntriesEventArgs e)
{
    //save selections
    RadPersistenceManager1.SaveState();
}
Lee
Top achievements
Rank 1
 answered on 29 Mar 2016
3 answers
73 views

I have a report viewer in a radgrid and the MetroTouch skin messes up the style of the report viewer and makes it look terrible.

How do I get the report viewer to display properly inside a MetroTouch skinned grid?
Maria Ilieva
Telerik team
 answered on 29 Mar 2016
3 answers
205 views

I am implementing a RadGrid that lists admin information messages.  Each row has a row delete X and I have a Remove All button.  The single row deletes work fine but the Remove All gives after the delete.

[ArgumentOutOfRangeException: capacity was less than the current size.
Parameter name: value]
   System.Collections.ArrayList.set_Capacity(Int32 value) +11392869
   Telerik.Web.UI.GridTableView.GetEnumerator(Boolean useDataSource, GridEnumerableBase resolvedDataSource, ArrayList dataKeysArray, Boolean shouldClearDataKeys) +450
   Telerik.Web.UI.GridTableView.GetJsonData(Int32 startRowIndex, Int32 maxRowsCount) +1013
   Telerik.Web.UI.RadGrid.InitializeDesktopGridTableViewData(GridTableView tableView, Dictionary`2 data) +2181
   Telerik.Web.UI.RadGrid.InitializeGridTableViewData(GridTableView tableView) +105
   Telerik.Web.UI.RadGrid.InitializeGridTableViewsRecursive(GridTableView tableView) +95
   Telerik.Web.UI.RadGrid.DescribeProperties(IScriptDescriptor descriptor) +4419
   Telerik.Web.UI.RadGrid.DescribeComponent(IScriptDescriptor descriptor) +49
   Telerik.Web.UI.RadCompositeDataBoundControl.Telerik.Web.IControl.DescribeComponent(IScriptDescriptor descriptor) +42
   Telerik.Web.UI.ScriptRegistrar.GetScriptDescriptors(Control control) +210
   Telerik.Web.UI.ScriptRegistrar.GetScriptDescriptors(WebControl control) +36
   Telerik.Web.UI.RadCompositeDataBoundControl.GetScriptDescriptors() +35
   Telerik.Web.UI.RadCompositeDataBoundControl.System.Web.UI.IScriptControl.GetScriptDescriptors() +51
   System.Web.UI.ScriptControlManager.RegisterScriptDescriptors(IScriptControl scriptControl) +490
   System.Web.UI.ScriptManager.RegisterScriptDescriptors(IScriptControl scriptControl) +55
   Telerik.Web.UI.RadCompositeDataBoundControl.RegisterScriptDescriptors() +83
   Telerik.Web.UI.RadCompositeDataBoundControl.RenderContents(HtmlTextWriter writer) +67
   Telerik.Web.UI.RadGrid.RenderContents(HtmlTextWriter writer) +102
   Telerik.Web.UI.GridBaseDataList.Render(HtmlTextWriter writer) +132
   Telerik.Web.UI.RadGrid.Render(HtmlTextWriter writer) +217
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66  ... lots more ...

I am creating my grid completely from C# code with a very minimal grid definition in the . The remove all looks like this.

protected void RemoveAll_Click(object sender, EventArgs e)
{
    HomeGrid.DataSource = null;
    DataService.Factory().RemoveAllMessages(user.orgId);   
    HomeGrid.Rebind();
}

This is my grid definition without the columns

RadGrid adminGrid = HomeGrid;
adminGrid.NeedDataSource += new GridNeedDataSourceEventHandler(AdminGrid_NeedDataSource);
adminGrid.Skin = "Default";
adminGrid.AutoGenerateColumns = false;
adminGrid.EnableViewState = false;
adminGrid.GroupingEnabled = false;
adminGrid.AllowPaging = true;
adminGrid.PageSize = 500;
adminGrid.Height = Unit.Percentage(100);
adminGrid.EnableHeaderContextMenu = true;
adminGrid.AllowSorting = true;
adminGrid.AllowFilteringByColumn = true;
adminGrid.AllowMultiRowSelection = false;
adminGrid.AllowAutomaticDeletes = true;
adminGrid.ClientSettings.EnableRowHoverStyle = true;
adminGrid.ClientSettings.Selecting.AllowRowSelect = true;
adminGrid.ClientSettings.Selecting.EnableDragToSelectRows = true;
adminGrid.ClientSettings.ReorderColumnsOnClient = true;
adminGrid.ClientSettings.AllowColumnsReorder = true;
adminGrid.ClientSettings.ColumnsReorderMethod = GridClientSettings.GridColumnsReorderMethod.Reorder;
adminGrid.ClientSettings.Virtualization.EnableVirtualization = true;
adminGrid.ClientSettings.Virtualization.InitiallyCachedItemsCount = 2000;
adminGrid.ClientSettings.Scrolling.AllowScroll = true;
adminGrid.ClientSettings.Scrolling.UseStaticHeaders = true;
adminGrid.ClientSettings.Scrolling.ScrollHeight = Unit.Percentage(100);
adminGrid.ClientSettings.Resizing.AllowColumnResize = true;
adminGrid.PagerStyle.Mode = GridPagerMode.NextPrevNumericAndAdvanced;
adminGrid.GroupingSettings.CaseSensitive = false;

and this my  RadGrid definition

<asp:panel runat="server" ID="HomeGridPanel"  CssClass="windowPercent" >
            <telerik:RadGrid runat="server" ID="HomeGrid"  OnItemCommand="HomeGrid_ItemCommand"></telerik:RadGrid>
</asp:panel>

I looked at other posts and could not figure out anything to do about this.   I added AllowAutomaticDeletes based on searches which did not help.

How can I get rid of the ArrayList ArgumentOutOfRangeException when the Grid goes from having data to no data on a Rebind()?

On removing single rows going from 1 to zero works fine but Remove All gives the error one row.  I think the difference is the single row remove is done from an OnItemCommand RadGrid call while the Remove All is done from a server button click method.

George

 

Maria Ilieva
Telerik team
 answered on 29 Mar 2016
1 answer
230 views
I have a Radgrid which is binded in codebehind and containined in modalextender .Onload , grid show this error , UserNameTitleIndexChanged not defined ,it is defined in radcombobox but still not working
<telerik:RadGrid ID="GridConsultancy" runat="server" FilterMenu-CausesValidation="false" AllowFilteringByColumn="true" AllowPaging="false" AutoGenerateColumns="false" OnNeedDataSource="GridConsultancy_NeedDataSource"  EnableLinqExpressions="false">
                                       <GroupingSettings CaseSensitive="false" />
                                       <ClientSettings>
                                           <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
                                       </ClientSettings>
                                       <MasterTableView AllowFilteringByColumn="true" NoDetailRecordsText="No Data Present" AllowSorting="true" TableLayout="Fixed">
                                           <HeaderStyle Width="120" />
                                           <Columns>
                                               <telerik:GridTemplateColumn HeaderText="Sr No." HeaderStyle-Width="70" AllowFiltering="False" AutoPostBackOnFilter="true">
                                                   <ItemTemplate>
                                                       <asp:Label ID="lb_s" runat="server" Text="<%# Container.DataSetIndex+1 %>"></asp:Label>
                                                   </ItemTemplate>
                                               </telerik:GridTemplateColumn>
                                               <telerik:GridDateTimeColumn DataField="EntryDate" UniqueName="EntryDate" HeaderText="Entry Date" HeaderStyle-Width="110" FilterControlWidth="100px" DataType="System.DateTime"
                                                   SortExpression="EntryDate" EnableTimeIndependentFiltering="true" AutoPostBackOnFilter="true"
                                                   DataFormatString="{0:dd MMM yyyy}" CurrentFilterFunction="GreaterThanOrEqualTo">
                                               </telerik:GridDateTimeColumn>
                                                 <telerik:GridBoundColumn DataField="UserName" HeaderText="UserName" UniqueName="UserName"
                           FilterControlWidth="110" HeaderStyle-Width="120" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                           ShowFilterIcon="false">
                           <FilterTemplate>
                               <telerik:RadComboBox ID="UserNameRadComboBoxTitle5" Width="110" Style="z-index: 10000001"
                                   runat="server" DataTextField="UserName" DataValueField="UserName"
                                   OnClientSelectedIndexChanged="UserNameTitleIndexChanged" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("UserName").CurrentFilterValue %>'>
                                   <Items>
                                       <telerik:RadComboBoxItem Text="Select" />
                                       <telerik:RadComboBoxItem Text="All" Value="" />
                                       <telerik:RadComboBoxItem Text="Tim" Value="Tim" />
                                       <telerik:RadComboBoxItem Text="Jeorge" Value="Jeorge" />
                                    
                                   </Items>
                               </telerik:RadComboBox>
                               <telerik:RadScriptBlock ID="UserNameRadScriptBlock" runat="server">
                                   <script type="text/javascript">
                                       function UserNameTitleIndexChanged(sender, args) {
                                           var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                                                   tableView.filter("UserName", args.get_item().get_value(), "Contains");
                                                               }
                                   </script>
                               </telerik:RadScriptBlock>
                           </FilterTemplate>
                       </telerik:GridBoundColumn>
                                           </Columns>
                                       </MasterTableView>
                                   </telerik:RadGrid>
Viktor Tachev
Telerik team
 answered on 29 Mar 2016
3 answers
84 views

Hi,

We are using ribbon-button and in which we are shorting its name after curtain length e.g xyz... . We see Tooltip by hovering over there , in that also we same text with Ellipsis but there we want full text. So can you please suggest  or tell us how we can achieve that .

Attached Snap shot.

Magdalena
Telerik team
 answered on 29 Mar 2016
0 answers
173 views

I am trying to Implement IBindableTemplate for creating custom Edit Template in Batch Edit Mode. Not able to implement the ExtractValues method of IBindableTemplate interface correctly. When I assign the Control.ID in InstantiateIn() method then i am getting the following error. Without  this control ID how to get the values in ExtractValues() method.

System.Web.HttpException: Multiple controls with the same ID 'DepartmenCode' were found. FindControl requires that controls have unique IDs.   
 at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)    
 at System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls)    
 at System.Web.UI.Control.FindControl(String id, Int32 pathOffset)    
 at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)    
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

protected override void OnInit(EventArgs e)
        {
RadGrid theGrid = new RadGrid();
                    theGrid.ID = this.ID + "Grid";
                    theGrid.AutoGenerateColumns = false;
theGrid.NeedDataSource += new GridNeedDataSourceEventHandler(theGrid_NeedDataSource);
                    theGrid.DetailTableDataBind += new GridDetailTableDataBindEventHandler(theGrid_DetailTableDataBind);
                    theGrid.SortCommand += new GridSortCommandEventHandler(theGrid_SortCommand);
                    theGrid.ItemDataBound += new GridItemEventHandler(theGrid_ItemDataBound);
                    theGrid.DataBound += new EventHandler(theGrid_DataBound);
                    theGrid.PreRender += new EventHandler(theGrid_PreRender);
                    theGrid.PageIndexChanged += new GridPageChangedEventHandler(theGrid_PageIndexChanged);
                    //Batch Edit Mode Start 
                    theGrid.BatchEditCommand += new GridBatchEditEventHandler(theGrid_BatchEditCommand);
                    
                    theGrid.MasterTableView.EditMode = GridEditMode.Batch;
                    theGrid.MasterTableView.BatchEditingSettings.EditType = GridBatchEditingType.Row;
                    theGrid.MasterTableView.BatchEditingSettings.OpenEditingEvent = GridBatchEditingEventType.DblClick;
                    theGrid.MasterTableView.BatchEditingSettings.SaveAllHierarchyLevels = true;
                    theGrid.MasterTableView.CommandItemSettings.ShowSaveChangesButton = true;
                    theGrid.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = false;
                    theGrid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.TopAndBottom;
                    theGrid.ShowHeader = true;
                    theGrid.MasterTableView.CommandItemSettings.ShowCancelChangesButton = true;
                    //Batch Edit Mode End 

SetupGridColumns();
}

private void SetupGridColumns(){
 
foreach (XmlElement displayField in DisplayFields)
            {
SetupGridColumn(displayField)
}

}


 private void SetupGridColumn(fieldName){
GridTemplateColumn col=new GridTemplateColumn();
                
                SPField field = TopList.Fields[fieldName];
                col.ItemTemplate = new DataGridEditTemplate(ListItemType.Item, fieldName, fieldInternalName, field, theGrid, listView.Utility);
                col.EditItemTemplate = new DataGridEditTemplate(ListItemType.EditItem, fieldName,fieldInternalName, field, theGrid, listView.Utility);
                col.DataField = fieldInternalName;
GridTableView.Columns.Add(col);
}

 private void theGrid_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
        {
            foreach (GridBatchEditingCommand command in e.Commands)
            {
                if ((command.Type == GridBatchEditingCommandType.Update))
                {
                    Hashtable newValues = command.NewValues;
                    Hashtable oldValues = command.OldValues;
                    string ID = newValues["ID"].ToString();
                    //string Name = newValues["Name"].ToString();

                    try
                    {
                        SPList list = SPContext.Current.Web.Lists.TryGetList("Department");
                        SPListItem item = list.GetItemById(Convert.ToInt32(ID));
                        foreach (DictionaryEntry entry in newValues)
                        {
                            if ((string)entry.Key != "ID")
                            {
                                item[(string)entry.Key] = entry.Value;
                            }
                        }
                        item.Update();

                    }
                    catch (Exception exc)
                    {

                        Logger.Log(TraceSeverity.High, this.PageUrl, this.Title, this.CurrentUserName, exc.Message, exc.StackTrace);
#if DEBUG
                        ErrorMessage = Utility.GetMessage(WADataViewerConstant.ResourceNamespace, "ERROR_OCCURED", exc.ToString());
#else
                ErrorMessage = Utility.GetMessage(WADataViewerConstant.ResourceNamespace, "ERROR_OCCURED", exc.Message);
#endif
                        e.Canceled = true;
                    }
                }
            }
        }

public class DataGridEditTemplate : IBindableTemplate
    {
        ListItemType _templateType; 
        string columnName;
        SPField _spField;
        RadGrid _theGrid;
        bool isAutoPostBack;
        string _fieldInternalName;
        WAUtility _Utility;
        public DataGridEditTemplate(ListItemType templateType, string colname, string fieldInternalName, SPField field, RadGrid grid, WAUtility Utility)
        {
            _templateType = templateType;
            columnName = colname;
            _fieldInternalName = fieldInternalName;
            _spField = field;
            _theGrid = grid;
            _Utility = Utility;
        }

        public void InstantiateIn(System.Web.UI.Control container)
        {
            Label lc = new Label();
            switch (_templateType)
            {
              
                case ListItemType.Item:
                   // lc.Text = "Item " + _fieldInternalName;
                    lc.DataBinding += new EventHandler(lControl_DataBinding);
                    //lc.ID =_fieldInternalName;
                    container.Controls.Add(lc);
                    break;
                case ListItemType.EditItem:
                  
                    container.Controls.Add(GetControlByFieldType(_spField, null));
                    break;
                  
            }
        }
        public void lControl_DataBinding(object sender, EventArgs e)
        {
            Label l = (Label)sender;
            GridDataItem container = (GridDataItem)l.NamingContainer;
            l.Text = ((DataRowView)container.DataItem)[_fieldInternalName].ToString();
        }

private Control GetControlByFieldType(SPField field)
        {
            Control fieldControl = null;
            BaseFormControl basefc = null;

            string validationGroup = field.Id + "ValidationGroup";
            string mask = null;
            string promptCharacter = null;

            bool editable = !field.ReadOnlyField; 
            //bool autoPostBack = IsAutoPostbackField(fieldNode);

            switch (field.Type)
            {
                case SPFieldType.Text:
                    #region -------------Text---------------------- 
                    SPFieldText fieldText = (SPFieldText)field;

                    TextFieldControl tfc = new TextFieldControl();
                    basefc = tfc;
                    tfc.ID = _fieldInternalName;
                    tfc.ContainerID = validationGroup;
                    tfc.Mask = mask;
                    tfc.PromptCharacter = promptCharacter;
                    tfc.FieldMaxLength = fieldText.MaxLength;
                    tfc.FieldDisplaySize = fieldText.DisplaySize;
                    tfc.FieldIMEMode = fieldText.IMEMode;
                    tfc.Editable=editable;
                    fieldControl = tfc;

                    break;
                    #endregion -------------Text---------------------- 
}
}

  public System.Collections.Specialized.IOrderedDictionary ExtractValues(System.Web.UI.Control container)
        {
            System.Collections.Specialized.OrderedDictionary od = null;
            //od.Add("OrderID", ((DropDownList)(((GridEditFormItem)(container)).FindControl("dropdownlist1"))).DataValueField);
            //if (container is GridDataItem)
            //{
            //    GridDataItem dataItem = container as GridDataItem;
            //}
            //if (container is GridEditFormItem)
            {
                od = new System.Collections.Specialized.OrderedDictionary();
                //od.Add(_fieldInternalName, ((DropDownList)(((GridEditFormItem)(container)).FindControl("_fieldInternalName"))).DataValueField);
                //Control ctrl = ((container)).FindControl("_fieldInternalName");

                foreach (Control ctrl in container.Controls)
                {
                    if (ctrl.Controls.Count > 0)
                    {
                        Type ctrlType = ctrl.Controls[0].GetType();
                        if (ctrlType == typeof(DropDownList))
                        {
                            od.Add(ctrl.Controls[0].UniqueID, ((DropDownList)(ctrl.Controls[0])).DataValueField);
                        }
                        if (ctrlType == typeof(TextBox))
                        {
                            od.Add(ctrl.Controls[0].UniqueID, ((TextBox)(ctrl.Controls[0])).Text);
                        }
                        if (ctrlType == typeof(Label))
                        {
                            od.Add(ctrl.Controls[0].UniqueID, ((Label)(ctrl.Controls[0])).Text);
                        }
                    }
                }
            }
            
            
            return od;
        }
    }
Abhishek
Top achievements
Rank 1
 asked on 29 Mar 2016
2 answers
452 views

Hello,

I've been trying to implement some logic using RadButton, RadComboBox and RadTextBox altogether in order to set a RadLabel text.
Everything is part of an Edit Form of a RadGrid component using EditFormType="WebUserControl"

Below is my ASPX code :

01.<telerik:RadButton ID="RadButton1" runat="server" ToggleType="Radio"
02.  ButtonType="StandardButton" AutoPostBack="false" ReadOnly="true" ClientIDMode="Static"
03.  UseSubmitBehavior="false" RenderMode="Lightweight" GroupName="GroupTest"
04.  Checked="true">
05.  <ToggleStates>
06.    <telerik:RadButtonToggleState Text="TTC" PrimaryIconCssClass="rbToggleRadioChecked" />
07.    <telerik:RadButtonToggleState Text="TTC" PrimaryIconCssClass="rbToggleRadio" />
08.  </ToggleStates>
09.</telerik:RadButton>
10.<telerik:RadButton ID="RadButton2" runat="server" ToggleType="Radio"
11.  ButtonType="StandardButton" AutoPostBack="false" ReadOnly="true" ClientIDMode="Static"
12.  UseSubmitBehavior="false" RenderMode="Lightweight" GroupName="GroupTest" >
13.  <ToggleStates>
14.    <telerik:RadButtonToggleState Text="HT" PrimaryIconCssClass="rbToggleRadioChecked" />
15.    <telerik:RadButtonToggleState Text="HT" PrimaryIconCssClass="rbToggleRadio" />
16.  </ToggleStates>
17.</telerik:RadButton> 
18.<telerik:RadTextBox ID="RadTextBox1" runat="server"
19.  Text='<%# DataBinder.Eval(Container, "DataItem.Field1") %>' RenderMode="Lightweight"  
20.  onkeyup="myJsFunction1(event, 'RadTextBox1');"
21.  Width="110px" ClientIDMode="Static"></telerik:RadTextBox> 
22.<telerik:RadComboBox ID="RadComboBox1" runat="server" RenderMode="Lightweight"
23.  SelectedValue='<%# DataBinder.Eval(Container, "DataItem.Field2") %>'
24.  DataTextField="value" DataValueField="value" Width="80px" ClientIDMode="Static"></telerik:RadComboBox> 
25.<telerik:RadLabel ID="RadLabel1" runat="server" RenderMode="Lightweight"
26.  ClientIDMode="Static"></telerik:RadLabel>

 

So my issue is that everytime I try to use some built in Telerik ClientEvent for RadComboBox, RadTextBox or RadButton I'm facing two problems :

  1. My JavaScript function supposed to be called is never called e.g. OnClientCheckedChanged="myJsFunction" is never fired
  2. As soon as one component has an OnClient event declared (whether it's the RadButton, the RadTextBox or the RadCombobox) the RadButton rendering is totally messed up (see the screenshot_1.png attached to good display and screenshot_2.png attached for messed up display))

In place of the RadTextBox's onkeyup if I use the ClientEvents-OnKeyPress event I get exactly the same problem.

I also tried to implement some client side logic to the same RadButton shown up there outside of any RadGrid but I'm still facing this issue.

I am really facing a dead end with this. Of course I could use some ASP basic controls to implement the behavior but I'd like to keep some coherence for the rendering of my web page.

Regards,

Benjamin Bourgeois.

Benjamin
Top achievements
Rank 1
 answered on 29 Mar 2016
4 answers
861 views
Hi,

I have an issue using 2 RadWindowManager in the same page: the javascript OnClientClose method of a RadWindow managed by the second RadWindowManager is never invoked, when closing this window.

To describe more precisely my scenario: the page contains 2 usercontrols where each defines their RadWindowManager and their RadWindow (used as dialog boxes). When closing a RadWindow, their OnClientClose method is getting back some arguments, and pass them into a hidden input control of each user control (TopicId in Control1, ContactId in Control2), and finally invoke a hidden button (btnHidden in each userControl) in order to execute some treatment server-side.

It works fine for the RadWindows in Control 1. The OnImageUploader() javascript function is invoked properly. But is does not work for the RadWindow in Control 2, the OnClientClose() is never invoked.

Here is a simplified version of these 2 controls.

Control 1:

    <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
    <script type="text/javascript">
        //<![CDATA[
        function openImageUploader() {
            var oWnd = radopen("ImageUploader.aspx", "RadWindow2");
        }
  
        function openImageCatalog() {
            var oWnd = radopen("ImageCatalog.aspx", "RadWindow3");
        }
  
        function OnImageUploaderClose(oWnd, args) {
  
            //get the transferred arguments
            var arg = args.get_argument();
            if (arg) {
                var contactInput = document.getElementById("<%= TopicId.ClientID %>");
                if ( contactInput ) contactInput.value = arg.topicId;
  
                var btn = document.getElementById("<%= btnHidden.ClientID %>");
                if (btn) btn.click();
            }
        }
          
        //]]>    
        </script>
    </telerik:RadScriptBlock>
  
    <telerik:RadWindowManager ID="RadWindowManager2" ShowContentDuringLoad="false" VisibleStatusbar="false"
        ReloadOnShow="true" runat="server" Skin="Web20">
        <Windows>
            <telerik:RadWindow runat="server" ID="RadWindow2" 
                Modal="true"
                Behaviors="Move,Close" 
                OnClientClose="OnImageUploaderClose" 
                NavigateUrl="~/Customer/ImageUploader.aspx" 
                Width="460px" Height="300px"  
                >
            </telerik:RadWindow>
            <telerik:RadWindow runat="server" ID="RadWindow3" 
                Modal="true"
                Behaviors="Move,Close" 
                OnClientClose="OnImageUploaderClose" 
                NavigateUrl="~/Customer/ImageCatalog.aspx" 
                Width="420px" Height="480px" 
                >
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
  
    <asp:HiddenField ID="TopicId" runat="server" />
  
    <div style="float:left; margin-left:5px;" >
  
    </div>
  
<asp:Button 
    ID="btnHidden" 
    runat="server" 
    Text="_hiddenrefresh" 
    style="display:none;" 
    CausesValidation="true" 
    UseSubmitBehavior="true" 
    OnClick="btnHidden_Click" 
    Width="32px" />

Control 2:

 

<telerik:RadScriptBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
    //<![CDATA[
    function openAddressBook()
    {
        var oWnd = radopen("AddressBook.aspx", "RadWindow1");
    }
      
    function OnClientClose(oWnd,args)
    {
        //get the transferred arguments
        var arg = args.get_argument();
        if(arg)
        {
            var contactInput = document.getElementById("<%= ContactId.ClientID %>");
            contactInput.value = arg.contactId;
  
            var btn = document.getElementById("<%= btnHidden.ClientID %>");
            if (btn) btn.click();
        }
    }
    //]]>
</script>
</telerik:RadScriptBlock>
  
<telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false"
    ReloadOnShow="true" runat="server" Skin="Web20">
    <Windows>
        <telerik:RadWindow runat="server" ID="RadWindow1" 
            Modal="true"
            Behaviors="Move,Close" OnClientClose="OnClientClose" 
            NavigateUrl="~/Customer/AddressBook.aspx" Width="280px" Height="540px" >
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
  
<div style="margin-bottom:10px;">            
  
    <asp:HiddenField ID="ContactId" runat="server" />
      
</div>
  
<asp:Button 
    ID="btnHidden" 
    runat="server" 
    Text="_hiddenrefresh" 
    style="display:none;" 
    CausesValidation="true" 
    UseSubmitBehavior="true" 
    OnClick="btnHidden_Click" 
    Width="32px" />

 

 


After several tests, it appears that the RadWindowManager in control 1 is receiving the close event.
So I imagine that I need to use and define only one RadWindowManager somewhere, but then how can I pass my dialog box results to the correct control ? ( my knowledge with JavaScript in very poor )

Many thanks for any help
Emmanuel

 

Sandhya
Top achievements
Rank 1
 answered on 29 Mar 2016
1 answer
61 views

I have a grid in which I am creating and populating a nested detail view using a private class (DetailTemplate) which inherits from ITemplate. The detail view is populated with controls in the InstantiiateIn method of the DetailTemplate class.

In Page_Init, I create a new instance of DetailTemplate and assign it to master.MasterTableView.NestedViewTemplate where master is the main grid and parent of the nested detail view.

The first time the page is browsed, the page renders as expected with an Expand/Collapse column in the master grid and expanding/collapsing any of the master grid's rows works as expected.

After postbacks which result in the master grid being rebound, the Expand/Collapse column of the master grid disappears. I'm guessing I'm missing assigning a new instance of DetailTemplate to master.MasterTableView.NestedViewTemplate somewhere when the master grid gets rebound. What am I missing?

Kostadin
Telerik team
 answered on 29 Mar 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?