Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
80 views
Hello,
I initiate a postback with __doPostback function and pass some data which should help to set a VERY custom filter on dataset. But when page is reloaded, I can see that grid client object was not refreshed and all data and AJAX cell controls was the same as before. Grid is in ASP.NET panel which is under RadAjaxManager control. Is there a way to fully reload grid client object on postback?
Thank you.

UPD. Almost forgot - grid is created programmatically in Page_Init method.
Maria Ilieva
Telerik team
 answered on 02 Dec 2011
4 answers
157 views
image Captura: the scenario
I have a Grid, and a button named Full Edit. When click in Full edit, open a Radwindow.
In Radwindow I have 3 buttons, Ones is Delete.

When User Click in delete, appear a RadWindow.Confirm (Deelete this User?)
If user click on Yes, remove user, close de windows and rebin the Grid.
this problem is RadAjaxManager1_AjaxRequest does not exececute Close and Rebien of JS

In save button, the user apply change, save and close (with intermidate windows) )this button wiorks.


This is my code:
.ASPX:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserForm.aspx.cs" Inherits="WebSearch.UI.Admin.UserForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>User</title>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <link href="../Style/Admin.css" rel="stylesheet" type="text/css" />
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">

        function confirmCallBackFn(arg) {
            debugger;
            var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
            if (arg == true)
            { ajaxManager.ajaxRequest("Remove"); }

        }

        function CloseAndRebind(args) {
            debugger;
            GetRadWindow().BrowserWindow.refreshGrid(args);
            GetRadWindow().close();
        }

        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)

            return oWindow;
        }

        function CancelEdit() {
            GetRadWindow().close();
        }


        function filterCreated(sender, args) {
            sender.get_contextMenu().add_showing(
            function (sender, args) {
                sender.findItemByValue("IsNull").set_visible(false);
                sender.findItemByValue("NotIsNull").set_visible(false);
                sender.findItemByValue("GreaterThan").set_visible(false);
                sender.findItemByValue("GreaterThanOrEqualTo").set_visible(false);
                sender.findItemByValue("LessThan").set_visible(false);
                sender.findItemByValue("LessThanOrEqualTo").set_visible(false);
                sender.findItemByValue("NotBetween").set_visible(false);
                sender.findItemByValue("Between").set_visible(false);
            }
        );
        }

                   
    </script>
    </telerik:RadCodeBlock>
</head>

<body>

 
     <form id="form1" runat="server">
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"  />
                <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <div class="TabContainer">
        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="Vista" MultiPageID="RadMultiPage1"
            SelectedIndex="0" CssClass="tabStrip" Width="698px">
            <Tabs>
                <telerik:RadTab value="Information">
                </telerik:RadTab>
                <telerik:RadTab  Value="Mandatory">
                </telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" CssClass="multiPage">
            <telerik:RadPageView ID="RadPageViewInformation" runat="server" Width="100%">
            <div class="TabTitle">
                <asp:Label ID="lblTitleTab2" runat="server"></asp:Label>
            </div>
                <asp:Table ID="Table3" CssClass="EditFormTable" runat="server">
                    <asp:TableRow>
                        <asp:TableCell CssClass="CellLabelLTW">
                            <asp:Label runat="server" ID="lblFirstName" CssClass="fontLabel" /></asp:TableCell><asp:TableCell
                                CssClass="CellTextBoxL">
                                <asp:TextBox ID="txtFirstName" MaxLength="250" CssClass="TextBoxPopUp" Text='<%# Bind("FirstName") %>'
                                    runat="server">
                                </asp:TextBox><asp:RequiredFieldValidator ID="rfFirstName" runat="server" ErrorMessage="*"
                                    ControlToValidate="txtFirstName" CssClass="validator" ></asp:RequiredFieldValidator>
                            </asp:TableCell><asp:TableCell CssClass="CellLabelRTW">
                                <asp:Label runat="server" CssClass="fontLabel" ID="lblLastName" /></asp:TableCell><asp:TableCell
                                    CssClass="CellTextBoxR">
                                    <asp:TextBox ID="txtLastName" MaxLength="250" CssClass="TextBoxPopUp" Text='<%# Bind("LastName") %>'
                                        runat="server">
                                    </asp:TextBox><asp:RequiredFieldValidator ID="rvfLastName" runat="server" ErrorMessage="*"
                                        ControlToValidate="txtLastName" CssClass="validator"  ></asp:RequiredFieldValidator></asp:TableCell></asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell CssClass="CellLabelLTW">
                            <asp:Label runat="server" ID="lblMiddleName" CssClass="fontLabel" />
                        </asp:TableCell><asp:TableCell CssClass="CellTextBoxR" >
                            <asp:TextBox ID="txtMiddleName" MaxLength="250" CssClass="TextBoxPopUp" Text='<%# Bind("MiddleName") %>'
                                runat="server">
                            </asp:TextBox>
                        </asp:TableCell>
                        <asp:TableCell ColumnSpan="2"></asp:TableCell></asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell CssClass="CellLabelL">
                            <asp:Label runat="server" ID="lblLoginId" CssClass="fontLabel" /></asp:TableCell><asp:TableCell
                                CssClass="CellTextBoxL">
                                <asp:TextBox CausesValidation="true" ID="txtLoginId" MaxLength="250" CssClass="TextBoxPopUp"
                                    Text='<%# Bind("LoginId") %>' runat="server">
                                </asp:TextBox><asp:RequiredFieldValidator ID="rfvLoginId" runat="server" ErrorMessage="*"
                                    ControlToValidate="txtLoginId" CssClass="validator"></asp:RequiredFieldValidator>
                                <asp:CustomValidator ID="cvLoginId" runat="server" ControlToValidate="txtLoginId" ValidationGroup="Information"
                                    CssClass="validator" ValidateEmptyText="True" Display="Dynamic" OnServerValidate="cvLoginId_ServerValidate"></asp:CustomValidator>
                            </asp:TableCell><asp:TableCell CssClass="CellLabelRTW">
                                <asp:Label runat="server" ID="lblExternalId" CssClass="fontLabel" /></asp:TableCell><asp:TableCell
                                    CssClass="CellTextBoxR">
                                    <asp:TextBox ID="txtExternalId" MaxLength="250" CssClass="TextBoxPopUp" Text='<%# Bind("ExternalId") %>'
                                        runat="server">
                                    </asp:TextBox></asp:TableCell></asp:TableRow>
                    <asp:TableRow ID="AddressRow">
                        <asp:TableCell CssClass="CellLabelLTW">
                            <asp:Label runat="server" ID="lblEmail" CssClass="fontLabel" /></asp:TableCell><asp:TableCell
                                CssClass="CellTextBoxL">
                                <asp:TextBox ID="txtEmail" MaxLength="250" CssClass="TextBoxPopUp" Text='<%# Bind("Email") %>'
                                    runat="server">
                                </asp:TextBox><br />
                                <asp:RequiredFieldValidator ID="rfvEmail" runat="server" ErrorMessage="*"
                                    ControlToValidate="txtEmail" CssClass="validator"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="revEmail" ControlToValidate="txtEmail"
                                    ValidationExpression="^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$" CssClass="validator"
                                    runat="server" Display="Dynamic"></asp:RegularExpressionValidator>
                                <asp:CustomValidator ValidationGroup="Information" ID="cvEmail" ControlToValidate="txtEmail" CssClass="validator"
                                    runat="server" OnServerValidate="cvEmail_ServerValidate" Display="Dynamic"></asp:CustomValidator>
                            </asp:TableCell><asp:TableCell CssClass="CellLabelRTW">
                                <asp:Label runat="server" ID="lblAddress" CssClass="fontLabel" /></asp:TableCell><asp:TableCell
                                    CssClass="CellTextBoxR">
                                    <asp:TextBox ID="txtAddress" MaxLength="250" CssClass="TextBoxPopUp" Text='<%# Bind("Address") %>'
                                        runat="server"></asp:TextBox></asp:TableCell></asp:TableRow>
                    <asp:TableRow ID="PhoneRow" runat="server">
                        <asp:TableCell CssClass="CellLabelLTW">
                            <asp:Label runat="server" ID="lblPhone" CssClass="fontLabel" /></asp:TableCell><asp:TableCell
                                CssClass="CellTextBoxL">
                                <telerik:RadMaskedTextBox ID="txtPhone" runat="server" MaxLength="250" CssClass="TextBoxPopUp"
                                    Text='<%# Bind("Phone") %>' Mask="(###) ###-####-####" DisplayMask="(###) ###-####-####">
                                </telerik:RadMaskedTextBox>
                            </asp:TableCell><asp:TableCell CssClass="CellLabelRTW">
                                <asp:Label runat="server" ID="lblCellPhone" CssClass="fontLabel" /></asp:TableCell>
                                <asp:TableCell
                                    CssClass="CellTextBoxR">
                                    <telerik:RadMaskedTextBox ID="txtCellPhone" runat="server" MaxLength="250" CssClass="TextBoxPopUp"
                                        Text='<%# Bind("CellPhone") %>' Mask="(###) ###-####-####" DisplayMask="(###) ###-####-####">
                                    </telerik:RadMaskedTextBox>
                                </asp:TableCell></asp:TableRow>

                        <asp:TableRow ID="TableRow1" runat="server">
                        <asp:TableCell CssClass="CellLabelLTW">
                            <asp:Label runat="server" ID="lblIsSuper" CssClass="fontLabel" /></asp:TableCell><asp:TableCell
                                CssClass="CellTextBoxL">
                                <asp:CheckBox ID="chkIsSuper" runat="server" />
                            </asp:TableCell>
                             
                              <asp:TableCell  CssClass="CellLabelRTW">
                                 <asp:Label runat="server" ID="lblSecurityLevel" CssClass="fontLabel" /></asp:TableCell>
                                <asp:TableCell
                                    CssClass="CellTextBoxR">
                                   <telerik:RadComboBox  ID="cbSecurityLevel" Skin="Vista" runat="server" CausesValidation="true" ></telerik:RadComboBox>
                                
                                    <asp:RequiredFieldValidator ControlToValidate="cbSecurityLevel" runat="server" ID="Securitycv" CssClass="validator"  Display="Dynamic"  ErrorMessage="*"></asp:RequiredFieldValidator>
                                </asp:TableCell></asp:TableRow>
                    <asp:TableRow>
                        <asp:TableCell ColumnSpan="4">
                            <asp:Label ID="lblValidationText" CssClass="validator" runat="server" Font-Italic="true"></asp:Label>
                        </asp:TableCell></asp:TableRow>
                </asp:Table>
            </telerik:RadPageView>
            <telerik:RadPageView ID="RadPageViewUser" runat="server"  Width="100%">
             <div class="TabTitle">
                <asp:Label ID="lblTitleTab1" runat="server"></asp:Label>
            </div>
                <asp:Table ID="Table2" CssClass="EditFormTable" runat="server">
                    <asp:TableRow ID="MandatorySearchRow" runat="server">
                        <asp:TableCell Width="100%">
                            <div style="width: 98%">
                                <div style="width: 100%; border-color: #B8E3FB; border-style: solid; border-width: 1px;">
                                    <center>
                                        <asp:Label ID="lblDefineMandatorySearch" CssClass="titleMandatory" runat="server"></asp:Label></center>
                                    <telerik:RadFilter ID="radMandatorySearch" runat="server" ShowApplyButton="true"
                                        ExpressionPreviewPosition="Bottom">
                                        <ClientSettings> <ClientEvents  OnFilterCreated="filterCreated"/></ClientSettings>
                                        
                                    </telerik:RadFilter>
                                </div>
                                <br />
                                <div style="width: 100%;">
                                    <center>
                                        <asp:Label ID="lblDefinedMandatorySearch" CssClass="titleMandatory" runat="server"></asp:Label>
                                        <asp:ImageButton ImageUrl="~/UI/Images/cross.png" ID="btnRemove"  runat="server"
                                            OnClick="btnRemove_Click" /></center>
                                    <br />
                                    <center>
                                        <asp:Label ID="txtMandatorySearch" CssClass="fontLabel"  
                                            runat="server"></asp:Label></center>
                                </div>
                            </div>
                        </asp:TableCell></asp:TableRow>
                </asp:Table>
            </telerik:RadPageView>
        </telerik:RadMultiPage></div>
    <div class="footerSave" runat="server">
        <asp:Table runat="server" Width="100%" HorizontalAlign="Right">
            <asp:TableRow>
                <asp:TableCell HorizontalAlign="center">
                    <telerik:RadButton ID="btnSave" runat="server" Skin="Vista" Width="100px" OnClick="btnSave_OnClick" />
                    <telerik:RadButton ID="btnCancel" runat="server" Skin="Vista" Width="100px" CausesValidation="False"
                        ToolTip="Cancel" OnClientClicked="CancelEdit" />
                         <telerik:RadButton ID="btnDelete" runat="server" Skin="Vista" Width="100px" CausesValidation="False"
                        ToolTip="Remove current User"   OnClick="btnDelete_OnClick" />
                  
                </asp:TableCell></asp:TableRow>
        </asp:Table>
    </div>
    
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
            <Windows>
                <telerik:RadWindow ID="UserListDialog" runat="server" Height="600px" Width="900px"
                    Left="15%" ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true" VisibleStatusbar="True"
                    Behaviors="Close" />
            </Windows>
        </telerik:RadWindowManager>
    </form>
</body>
</html>



And .cs:
using System;
using System.Globalization;
using System.Resources;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using WebSearch.Components;
using WebSearch.SecurityModel;

namespace WebSearch.UI.Admin
{
    public partial class UserForm : Page
    {

        #region Properties&Variables

        private smOrganization _organization = new smOrganization();
        private string _culture;
        private ResourceManager _resources;
     

        #endregion

        #region Events
        
        protected void Page_Load(object sender, EventArgs e)
        {

            if (Page.IsPostBack) return;

            LoadSettings();
            FillComboBox();

            if (Request.QueryString["ID"] != null)
            {
                Session["ID"] = Request.QueryString["ID"];
                LoadUser();
            }
            else
            {
                btnDelete.Visible = false;
                Page.Title = _resources.GetString("AddFull", new CultureInfo(_culture));
            }
        }

        protected void btnDelete_OnClick(object sender, EventArgs e)
        {
            try
            {
                if (_organization.IsSuperUser(Convert.ToInt16(GetId())))
                {
                    if (_organization.IsUniqueSuper())
                    {
                        RadWindowManager1.RadAlert(_resources.GetString("ErrorDelete", new CultureInfo(_culture)), 330, 100, _resources.GetString("ErrorTitleDelete", new CultureInfo(_culture)), "");

                    }
                }

                else
                {
                    RadWindowManager1.RadConfirm(_resources.GetString("confirmText", new CultureInfo(_culture)), "confirmCallBackFn", 330, 100, null, _resources.GetString("confirmTitle", new CultureInfo(_culture)));
                }

               
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
           
            
        }


        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (e.Argument == "Remove") //delete users
            {
                //    _organization.RemoveUser(Convert.ToInt16(Session["ID"]));

                ClientScript.RegisterStartupScript(Page.GetType(), "mykey2", "CloseAndRebind();", true);
            }

          
        }



        protected void Page_Init(object sender, EventArgs e)
        {
            GetInfo();
           
            radMandatorySearch.Culture = new CultureInfo(_culture);
            radMandatorySearch.PreRender += NewFilterPreRender;
            radMandatorySearch.ApplyExpressions += NewFilterApplyExpressions;

            CommonFunctions.CreateFieldSearch(radMandatorySearch, _culture, SecurityModel.smDocumentType.DocType.Email);
            radMandatorySearch.ApplyButtonText = _resources.GetString("ApplyButton", new CultureInfo(_culture));
        }

        protected void btnRemove_Click(object sender, ImageClickEventArgs e)
        {
            txtMandatorySearch.Text = null;
        }
        
        protected void cvLoginId_ServerValidate(object sender, ServerValidateEventArgs e)
        {
            e.IsValid = !_organization.ExistLogin(e.Value.ToString(), GetId());
        }

       

        protected void cvEmail_ServerValidate(object sender, ServerValidateEventArgs e)
        {
           e.IsValid = !_organization.ExistEmail(e.Value.ToString(), GetId());
        }
        
        protected void btnSave_OnClick(object sender, EventArgs e)
        {
            Page.Validate("Information");
            if (!Page.IsValid)
            {
                RadTabStrip1.Tabs.FindTabByValue("Information").Selected = true;
                RadPageViewInformation.Selected = true;
                return;
            }


            _organization.User = new smUser
                                     {
                                         FirstName = txtFirstName.Text,
                                         MiddleName = txtMiddleName.Text,
                                         LastName = txtLastName.Text,
                                         Email = txtEmail.Text,
                                         Loginid = txtLoginId.Text,
                                         Phone = txtPhone.Text,
                                         CellPhone = txtCellPhone.Text,
                                         Address = txtAddress.Text,
                                         ExternalId = txtExternalId.Text,
                                         MandatorySearch = txtMandatorySearch.Text,
                                         IsSuper = chkIsSuper.Checked,
                                         SecurityLevelId = Convert.ToInt16(cbSecurityLevel.SelectedValue)
                                     };
            
            try
            {
                _organization.Quick = true;

                if (Session["ID"] == null)
                {
                    _organization.CreateUser();
                   
                }
                else
                {
                    _organization.User.Id = Convert.ToInt32(Session["ID"]);
                    _organization.UpdateUser();
                    Session["ID"] = null;
                }
            }
            catch(Exception ex)
            {
                throw  new Exception(ex.ToString());
            }
            finally
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);
            }
         }
     
        #endregion

        #region Methods

        private int GetId()
        {
            if (Request.QueryString["ID"] != null)
            {
                Session["ID"] = Request.QueryString["ID"];
            }
            return Convert.ToInt16(Session["ID"] ?? 0);
        }

        private void FillComboBox()
        {
            cbSecurityLevel.DataSource = _organization.GetSecurityLevels();
            cbSecurityLevel.DataTextField = "Name";
            cbSecurityLevel.DataValueField = "Id";
            cbSecurityLevel.DataBind();
        }

        private void LoadUser()
        {
            _organization = new smOrganization();

            smUser currentUser = _organization.GetUser(GetId());

            txtPhone.Text = currentUser.Phone;
            txtMiddleName.Text = currentUser.MiddleName;
            txtMandatorySearch.Text = currentUser.MandatorySearch;
            txtLoginId.Text = currentUser.Loginid;
            txtLastName.Text = currentUser.LastName;
            txtFirstName.Text = currentUser.FirstName;
            txtExternalId.Text = currentUser.ExternalId;
            txtEmail.Text = currentUser.Email;
            txtCellPhone.Text = currentUser.CellPhone;
            txtAddress.Text = currentUser.Address;
            chkIsSuper.Checked = currentUser.IsSuper;
            cbSecurityLevel.SelectedValue = currentUser.SecurityLevelId.ToString();
            
            Page.Title = _resources.GetString("EditFull", new CultureInfo(_culture)) + " " +currentUser.FirstName + "," + currentUser.LastName;

          
        }

        private void GetInfo()
        {
            _culture = App.CurrentCulture();
            _resources = _resources = App.GetAdminResources("UserManagement");
        }

        private void LoadSettings()
        {
            RadTabStrip1.Tabs.FindTabByValue("Information").Text = _resources.GetString("Information", new CultureInfo(_culture));
            RadTabStrip1.Tabs.FindTabByValue("Mandatory").Text = _resources.GetString("Mandatory", new CultureInfo(_culture));
    
            lblFirstName.Text = _resources.GetString(lblFirstName.ID, new CultureInfo(_culture));
            lblMiddleName.Text = _resources.GetString(lblMiddleName.ID, new CultureInfo(_culture));
            lblLastName.Text = _resources.GetString(lblLastName.ID, new CultureInfo(_culture));
            lblCellPhone.Text = _resources.GetString(lblCellPhone.ID, new CultureInfo(_culture));
            lblPhone.Text = _resources.GetString(lblPhone.ID, new CultureInfo(_culture));
            lblAddress.Text = _resources.GetString(lblAddress.ID, new CultureInfo(_culture));
            lblEmail.Text = _resources.GetString(lblEmail.ID, new CultureInfo(_culture));
            lblExternalId.Text = _resources.GetString(lblExternalId.ID, new CultureInfo(_culture));
            lblLoginId.Text = _resources.GetString(lblLoginId.ID, new CultureInfo(_culture));
            lblIsSuper.Text = _resources.GetString(lblIsSuper.ID, new CultureInfo(_culture));

            lblValidationText.Text = _resources.GetString(lblValidationText.ID, new CultureInfo(_culture));
            cvLoginId.ErrorMessage = _resources.GetString(cvLoginId.ID, new CultureInfo(_culture));
            revEmail.ErrorMessage = _resources.GetString(revEmail.ID, new CultureInfo(_culture));
            cvEmail.ErrorMessage = _resources.GetString(cvEmail.ID, new CultureInfo(_culture));
            lblDefineMandatorySearch.Text = _resources.GetString(lblDefineMandatorySearch.ID, new CultureInfo(_culture));
            lblDefinedMandatorySearch.Text = _resources.GetString(lblDefinedMandatorySearch.ID, new CultureInfo(_culture));

            btnSave.Text = _resources.GetString(btnSave.ID, new CultureInfo(_culture));
            btnCancel.Text = _resources.GetString(btnCancel.ID, new CultureInfo(_culture));

            lblTitleTab2.Text = _resources.GetString(lblTitleTab2.ID, new CultureInfo(_culture));
            lblTitleTab1.Text = _resources.GetString(lblTitleTab1.ID, new CultureInfo(_culture));

            chkIsSuper.Visible = App.CurrentUserIsSuper();
            cbSecurityLevel.EmptyMessage = _resources.GetString(cbSecurityLevel.ID, new CultureInfo(_culture));
            lblSecurityLevel.Text = _resources.GetString(lblSecurityLevel.ID, new CultureInfo(_culture));
            //cvSecurityLevel.ErrorMessage = _resources.GetString(cvSecurityLevel.ID, new CultureInfo(_culture));
            btnDelete.Text = _resources.GetString(btnDelete.ID, new CultureInfo(_culture));
        }

        private void NewFilterApplyExpressions(object sender, RadFilterApplyExpressionsEventArgs e)
        {
            RadFilterSqlQueryProvider provider = new RadFilterSqlQueryProvider();
            provider.ProcessGroup(e.ExpressionRoot);

            txtMandatorySearch.Text = txtMandatorySearch.Text + provider.Result;

            radMandatorySearch.RecreateControl();
        }

        protected void NewFilterPreRender(object sender, EventArgs e)
        {

            if (radMandatorySearch.RootGroupItem.Controls[0].Controls[2].Controls.Count > 0)
            {
                radMandatorySearch.RootGroupItem.Controls[0].Controls[2].Controls[1].Visible = false; // remove group option    
            }
        }



        #endregion

       
    }
}
July
Top achievements
Rank 2
 answered on 02 Dec 2011
1 answer
54 views
I've been trying to figure out for quite some time now how to download a document from a gridtableview that is inside of a RadAjaxPanel.  The only way I can get it to work is if I remove the RadAjaxPanel.  Also note that the download fuctionality resided within a detail table of the master grid.  Any help would be appreciated.

Thanks
Maria Ilieva
Telerik team
 answered on 02 Dec 2011
2 answers
99 views
Hi,

I want to add new commands to the RibbonBar inside the RibbonBar's ButtonClick event handler. Unfortunately, this doesn't seem to work as they are server-side added, but aren't visible on the client.

How I can I achieve this?

Thanks!

Edit: The ribbon bar is used in an AjaxManager:
AjaxSetting ajaxSetting1 = new AjaxSetting(m_ribbonBar.ID);
ajaxSetting1.UpdatedControls.Add(new AjaxUpdatedControl(m_contentPanel.ID, loadingPanel.ID) { UpdatePanelHeight = new Unit("100%") });
RadAjaxManager1.AjaxSettings.Add(ajaxSetting1);

In the ButtonClick event (in the same case where it is necessary that the ribbon bar changes), the m_contentPanel (it is just a div) is cleared and another control is added to the content panel.
When I try to add commands to the RibbonBar, the LoadingPanel also never disappears in the m_contentPanel. If I just add the new control without changed the RibbonBar, the LoadingPanel disappears and the control is displayed correctly.
Bozhidar
Telerik team
 answered on 02 Dec 2011
0 answers
48 views
Hi!
We are currently using the Upload control on some custom modules (old RadUpload v. 2.4.7.0) with no problems. The DotNetNuke installation version is 05.06.02 with Italian as default site language; the english (US) language is also installed and currently disabled. We encountered the following very strange issue: if we enable the english language RadUpload stop working; only very small files (tried with sizes smaller that 1kb) are uploaded but larger files not anymore. No errors visualized or recorded anywhere cause the code do something only if UploadedFileCount is greater than 0 but it returns 0 (it returns the correct file count only with very small files).
Any idea?
Thank you.
Robin
Top achievements
Rank 1
 asked on 02 Dec 2011
1 answer
82 views
Our grid is currently set to use inline editing. As such, it has an EditCommandColumn with an image button that, when clicked, turns the BoundColumns into text boxes for editing and the EditCommandColumn into two image buttons to update or cancel. This is pretty standard. What we'd like to do is this: When the edit image is clicked, our javascript lightbox (specifically jQuery Colorbox) pops up containing the text boxes for the columns that can be edited, along with the update and cancel buttons.

I'm not sure of the best way to structure the grid in order to do this. I've been searching around for a while and have just been going in circles. Any help would be much appreciated.
Antonio Stoilkov
Telerik team
 answered on 02 Dec 2011
9 answers
224 views
I've spent days trying to solve what shoud be a very simple thing - getting a bit frustrated now as could acheive this with "regualr" ajax and asp.net, but totally lost with Telerik! Hopefully just ignorance on my part...

I have  tree view control which will be the navigation. It sits in a rad splitter on the left side. On the right side is the area that will be affected by clicks on my tree view. For example, a tree view click will load one of various screens in the right side pane depending upon which node is clicked - be that a form for entering a survey question or a form for reordering survey sections....

It all works well - a tree view node click leaves the tree view on screen, while the form in the right side pane loads, a cool little loading panel displaying as I wait. But here's the problem...

One operation I want to perform is drag and drop reordering of nodes on the client side - this requires a post back  / server event  so I can refesh the tree view. In this case the tree view will need to do a full post back and completely refresh itself. The problem is that I cannot filter events and therefore when I attempt this my node clicks also beging to do full post backs causing y tree view to dissapear!

The event filter on radajaxmanager does not work, despite (seemingly) conflicting posts I've seen in this forum. And using ajaxManager.ajaxRequestWithTarget and/or ajaxManager.ajaxRequest seems to provide no resolution (mostly errors, limitations and frustration at how little documentation there is on this)

Any help at all would be appreciated ...





Iana Tsolova
Telerik team
 answered on 02 Dec 2011
2 answers
205 views
I have a radtreeview inside an UpdatePanel in the bottom there are 3 LinkButton each one inside an UpdatePanel. Each time you uncheck a node the radtreeview do a postback and refreshes the entire page. What I want to achieve is that when you uncheck a node does not refresh the entire page. So I want the buttons are not refresh and if it is possible not to refresh the radtreeview when do the postback. This is the code I use to do that but not working because it refreshes the whole page.

function OnClientNodeChecking(sender, args) {  
        
        if (!args.get_node().get_checked())
        {
            var treeView = $find("<%=trTaxonomy.ClientID%>");  
            treeView.trackChanges();
            args.get_node().set_checked(true);  
            args.set_cancel(true);  
            treeView.commitChanges();
            alert(args.get_node().get_checked());
                        
         }
         if (args.get_node().get_checked())         
         {
            args.set_cancel(true);
         }
      }  
      
      function onNodeChecked(sender, e) {      
        var node = e.get_node();        
        if (node.get_checked()) {
            sender._postBackOnCheck = false;
        }
        
        setTimeout(function() { sender._postBackOnCheck = true; }, 100);
    }             
</
script>
    <asp:ScriptManager ID="ManageLinesScriptManager" runat="server">
    </asp:ScriptManager>
     
     
    <table style="height: 100%; Width:100%;">
        <tr style="Width:100%; height:90%;">
            <td>
                <div style="overflow:auto; height:100%; width:100%;">
                    <asp:UpdatePanel ID="UpdatePanel4" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="True">
                        <ContentTemplate>
                            <telerik:RadTreeView CheckBoxes="true"
                                AllowNodeEditing="true"
                                ID="trTaxonomy"
                                runat="server"                       
                                OnNodeExpand="trTaxonomy_NodeExpand"
                                OnClientContextMenuShowing="menuShowing"
                                OnClientContextMenuItemClicked="itemClicked"
                                OnNodeEdit="trTaxonomy_NodeEdit"
                                OnClientNodeEditStart="EditNode"
                                OnNodeCheck="trTaxonomy_NodeCheck"
                                OnClientNodeChecked="onNodeChecked" style="overflow:visible">
                                <ContextMenus>
                                    <telerik:RadTreeViewContextMenu ID="RadTreeViewContextMenuAdd" runat="server"
                                        EnableEmbeddedScripts="true">
                                        <Items>
                                            <telerik:RadMenuItem Text="Add" Value="1" />
                                        </Items>
                                    </telerik:RadTreeViewContextMenu>
                                    <telerik:RadTreeViewContextMenu ID="RadTreeViewContextMenuDelete" runat="server"
                                        EnableEmbeddedScripts="true">
                                        <Items>
                                            <telerik:RadMenuItem Text="Delete" Value="2" />
                                        </Items>
                                    </telerik:RadTreeViewContextMenu>
                                </ContextMenus>
                            </telerik:RadTreeView>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                     
                </div>
            </td>
        </tr>
        <tr style="Width:100%; height:10%; vertical-align:middle" align="center">
            <td valign="middle">
                    <table align="center" style="vertical-align:middle;" >
                        <tr valign="middle">
                            <td valign="middle">
                                <div class="Content">
                                    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="True">
                                        <ContentTemplate>
                                            <asp:LinkButton ID="btnOk" runat="server" CssClass="InlineButton" Text="Save"  OnClick="btnOK_Click" Height="10px" />
                                        </ContentTemplate>   
                                    </asp:UpdatePanel>   
                                </div>
                            </td>
                            <td valign="middle">
                                <div class="Content">
                                    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="True">
                                        <ContentTemplate>
                                            <asp:LinkButton ID="btnSaveClose" runat="server" CssClass="InlineButton" Text="Save & Close"  Width="90px" OnClick="btnSaveClose_Click" Height="10px" />
                                        </ContentTemplate>   
                                    </asp:UpdatePanel>    
                                </div>
                            </td>
                            <td valign="middle">
                                <div class="Content">
                                    <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="True">
                                        <ContentTemplate>
                                            <asp:LinkButton ID="btnCancel" runat="server" CssClass="InlineButton" Text="Cancel" OnClientClick="ShowWarning(); return false;" Height="10px"/>                       
                                        </ContentTemplate>   
                                    </asp:UpdatePanel>   
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
Andres
Top achievements
Rank 1
 answered on 02 Dec 2011
3 answers
216 views
Hi

I am trying to write some code which will loop through a RadGrid and find any RadNumericTextBox in the dit template.

The code below works for the first row in the grid but no any others. Any ideas?
Thanks in advance

function ConvertToDegreeMinutesSeconds_Grid(Longitude, Latitude) {
var rgrdRouteWayPoints = $find("<%=rgrdRouteWayPoints.ClientID %>");
 if (rgrdRouteWayPoints) {
                        var MasterTable = rgrdRouteWayPoints.get_masterTableView();
                        var Rows = MasterTable.get_dataItems();
                        for (var i = 0; i < Rows.length; i++) {
                            var row = Rows[i];
         
                            var rtxtLongDegree_Grid = row.findControl("rtxtLongDegree_Grid");
                                                        
                            var rtxtLongMin_Grid = row.findControl("rtxtLongMin_Grid");
                            var rtxtLongSec_Grid = row.findControl("rtxtLongSec_Grid");

                            var rtxtLatDegree_Grid = row.findControl("rtxtLatDegree_Grid");
                            var rtxtLatMin_Grid = row.findControl("rtxtLatMin_Grid");
                            var rtxtLatSec_Grid = row.findControl("rtxtLatSec_Grid");

                            rtxtLongDegree_Grid.set_value(Longitude_Deg);
                            rtxtLongMin_Grid.set_value(Longitude_Min);
                            rtxtLongSec_Grid.set_value(Longitude_Sec);

                            rtxtLatDegree_Grid.set_value(Latitude_Deg);
                            rtxtLatMin_Grid.set_value(Latitude_Min);
                            rtxtLatSec_Grid.set_value(Latitude_Sec);
 
                        }
                    }

                }

                function rcbPortList_Grid_Changed(sender, args) {
                    //copy port long/lat to input boxes
                    var item = args.get_item();
                    var Longitude = item.get_attributes().getAttribute("Longitude");
                    var Latitude = item.get_attributes().getAttribute("Latitude");

                    ConvertToDegreeMinutesSeconds_Grid(Longitude, Latitude);

                }
Ajay
Top achievements
Rank 1
 answered on 02 Dec 2011
2 answers
88 views
Hi,
I have searched through the API, the demos and the forum, but I have found no
way at all to let a RibbonBarMenu object show it's current selected item (like a
standard DropDownList would do). I'm using a menu like this in the
QuickAccess menu and need to show the current selected item (at least the
text) either on the menu itself or on a label. Is there any way to
accomplish this?

I guess that the following thread is almost the same, except that it's about the ribbonbartogglelist:

Thanks!
Bozhidar
Telerik team
 answered on 02 Dec 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?