Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
102 views
Hi Telerik team,

I would like achieve sql like functionality in rad grid,im implemented virtual scrolling but i would like to populate each row in the grid and show the progress of rows affected.i need similar to sql execution.i have attached the image for your reference.
Veli
Telerik team
 answered on 17 May 2011
6 answers
151 views
I have an editor in the edit form of my radgrid which is ajaxified via an AjaxManager on the master page and an AjaxManagerProxy on the content page.  I am setting the content property of the editor on the ItemCreated event of the grid.  On ItemCommand of the grid I call a save method where I find the editor and get the content from the editor.  If I take the AjaxManagerProxy off the page this all works fine but with the proxy on the page the content property of the editor is always empty.  I am guessing with ajaxifying the grid the ItemCreated event is being called again overwriting the content property.  Any help anyone can provide me on how to "fix" this issue is appreciated.  I will post my aspx and .cs pages
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Projects.aspx.cs" Inherits="Projects" %> 
<%@ MasterType VirtualPath="~/MasterPage.master" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"
    <script type="text/javascript"
        function onRequestStart(sender, args) { 
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 || 
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 || 
                    args.get_eventTarget().indexOf("ExportToPdfButton") >= 0 || 
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) { 
 
                args.set_enableAjax(false); 
            } 
        } 
    </script> 
<telerik:RadAjaxManagerProxy ID="AjaxManagerProxyProjects" runat="server"
    <AjaxSettings>         
        <telerik:AjaxSetting AjaxControlID="RadGridProjects"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="RadGridProjects" LoadingPanelID="RadAjaxLoadingPanel1" />                
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManagerProxy> 
<telerik:RadAjaxLoadingPanel  ID="RadAjaxLoadingPanel1" runat="server" Skin="Black" /> 
<telerik:RadGrid  ID="RadGridProjects" AllowSorting="True" 
            AllowPaging="True" PageSize="50" runat="server" GridLines="None" 
            Width="100%" ShowStatusBar="true" AllowFilteringByColumn="true" 
            AutoGenerateColumns="false" AllowAutomaticInserts="false" 
            AllowAutomaticDeletes="false" AllowAutomaticUpdates="false" 
            GroupingSettings-CaseSensitive="false" 
            ShowGroupPanel="true" Skin="Black" 
            OnPreRender="RadGridProjects_PreRender" 
            OnItemCreated="RadGridProjects_ItemCreated" 
            OnNeedDataSource="RadGridProjects_NeedDataSource" 
            OnItemCommand="RadGridProjects_ItemCommand" 
            OnItemDataBound="RadGridProjects_ItemDataBound"
            <PagerStyle  Mode="NextPrevNumericAndAdvanced"></PagerStyle> 
            <ExportSettings OpenInNewWindow="true" ExportOnlyData="true" 
                    Pdf-AllowPrinting="true" Pdf-AllowAdd="true" Pdf-AllowCopy="true"  
                    Pdf-AllowModify="true" IgnorePaging="true" FileName="Projects" Pdf-PageTitle="Projects"  >             
            </ExportSettings> 
            <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="ProjectID" 
               EditMode="EditForms" AllowMultiColumnSorting="true" TableLayout="Auto" EnableHeaderContextMenu="true"
                <CommandItemSettings 
                    AddNewRecordText="Add Project" 
                    ShowExportToWordButton="true" 
                    ShowExportToExcelButton="true" 
                    ShowExportToCsvButton="true" 
                    ShowExportToPdfButton="true" 
                    /> 
                <Columns> 
                    <telerik:GridBoundColumn HeaderText="Photographer" UniqueName="Photographer"></telerik:GridBoundColumn> 
                    <telerik:GridDateTimeColumn  DataField="ProjectDate" HeaderText="Date" 
                                    UniqueName="ProjectDate" DataFormatString="{0:d}" PickerType="DatePicker" > 
                    </telerik:GridDateTimeColumn> 
                    <telerik:GridBoundColumn DataField="ProjectID" HeaderText="Project ID" UniqueName="ProjectID"></telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="LocationOrEventName" HeaderText="Location/Event Name" UniqueName="LocationEventName"></telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="Volume" HeaderText="Volume" UniqueName="Volume"></telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="SpecialInstructions" HeaderText="Special Instructions" UniqueName="SpecialInstructions"></telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="Notes" HeaderText="Notes" UniqueName="Notes"></telerik:GridBoundColumn> 
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"
                        <ItemStyle Width="45px" HorizontalAlign="Center" /> 
                        <HeaderStyle Width="45px" /> 
                    </telerik:GridEditCommandColumn> 
                    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete"  
                        ConfirmDialogType="RadWindow"  
                        ConfirmText="Are you sure you want to delete this Project?"  
                        ConfirmTitle="Product Delete" Text="Delete" UniqueName="DeleteCommandColumn"
                            <ItemStyle HorizontalAlign="Center" Width="45px" /> 
                            <HeaderStyle Width="45px" /> 
                    </telerik:GridButtonColumn> 
                </Columns> 
                <EditFormSettings ColumnNumber="2" EditFormType="Template" CaptionDataField="LocationOrEventName,ProjectID " CaptionFormatString="Edit {0} - {1}"
                    <FormTemplate> 
                        <table width="100%"
                            <tr> 
                                <td colspan="2"
                                    <asp:ValidationSummary ID="ValidationSummaryProject" runat="server" ValidationGroup="Product" CssClass="failureNotification" /> 
                                </td> 
                            </tr> 
                             <tr> 
                                <td colspan="2"
                                    <asp:Label ID="LabelProjectID" runat="server" Text='ProjectID: <%#Eval ("ProjectID") %>'></asp:Label> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td> 
                                    <span class="requiredFldInd">*</span>Photographer: 
                                </td> 
                                <td> 
                                    <telerik:RadComboBox ID="RadComboBoxPhotographer" runat="server" 
                                        DataTextField="FullName" DataValueField="PhotographerID" Skin="Black" OnDataBound="ComboBoxPhotographer_DataBound"
                                    </telerik:RadComboBox> 
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidatorPhotographer" runat="server" ControlToValidate="RadComboBoxPhotographer" 
                                        ErrorMessage="Photographer is required." ToolTip="Photographer is required." ValidationGroup="Project">*</asp:RequiredFieldValidator> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td><span class="requiredFldInd">*</span>Location/Event Name:</td> 
                                <td> 
                                    <asp:TextBox ID="TextBoxLocationEventName" runat="server" Text='<%#Eval("LocationOrEventName") %>'></asp:TextBox> 
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidatorName" runat="server" ControlToValidate="TextBoxLocationEventName" 
                                        ErrorMessage="Location/Event Name is required." ToolTip="Location/Event Name is required." ValidationGroup="Project">*</asp:RequiredFieldValidator> 
                                </td> 
                            </tr> 
                             <tr> 
                                <td><span class="requiredFldInd">*</span>Date:</td> 
                                <td> 
                                    <telerik:RadDatePicker ID="DatePickerProjectDate" runat="server" Skin="Black"  
                                        Culture="English (United States)" ShowPopupOnFocus="true" EnableScreenBoundaryDetection="true" 
                                        PopupDirection="BottomRight" ShowAnimation-Type="Fade" 
                                        SelectedDate='<%#(Eval("ProjectDate") is DBNull ?DateTime.Today:Eval("ProjectDate")) %>' MinDate="1/1/1900"
                                        <Calendar> 
                                            <SpecialDays> 
                                                <telerik:RadCalendarDay Repeatable="Today" ItemStyle-CssClass="rcToday" /> 
                                            </SpecialDays> 
                                        </Calendar> 
                                    </telerik:RadDatePicker>                                     
                                    <asp:RequiredFieldValidator ID="RequiredFieldProjectDate" runat="server"  
                                        ControlToValidate="DatePickerProjectDate" 
                                        ErrorMessage="Project Date is required"  
                                        ValidationGroup="Project">*</asp:RequiredFieldValidator>   
                                </td> 
                            </tr> 
                            <tr> 
                                <td>Volume:</td> 
                                <td> 
                                    <asp:TextBox ID="TextBoxVolume" runat="server" Text='<%#Eval("Volume") %>'></asp:TextBox> 
                                </td> 
                            </tr> 
                             <tr> 
                                <td valign="top">Special Instructions:</td> 
                                <td> 
                                    <telerik:RadEditor ID="RadEditorInstructions" runat="server" ToolsWidth="450px" Height="250px" Width="495px"  
                                    EditModes="Design" 
                                    ToolsFile="~/App_Data/Tools.xml" 
                                    ContentFilters="FixUlBoldItalic, MozEmStrong, ConvertFontToSpan, ConvertToXhtml, FixEnclosingP" 
                                    Skin="Black"
                                        <CssFiles> 
                                            <telerik:EditorCssFile Value="~/App_Themes/EditorContentAreaStyles.css" /> 
                                        </CssFiles> 
                                    </telerik:RadEditor> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td valign="top">Notes:</td> 
                                <td> 
                                    <telerik:RadEditor ID="RadEditorNotes" runat="server" ToolsWidth="450px" Height="250px" Width="495px"  
                                    EditModes="Design" ToolbarMode="ShowOnFocus"  
                                    ToolsFile="~/App_Data/Tools.xml" 
                                    ContentFilters="FixUlBoldItalic, MozEmStrong, ConvertFontToSpan, ConvertToXhtml, FixEnclosingP" 
                                    Skin="Black"
                                        <CssFiles> 
                                            <telerik:EditorCssFile Value="~/App_Themes/EditorContentAreaStyles.css" /> 
                                        </CssFiles> 
                                    </telerik:RadEditor> 
                                </td> 
                            </tr> 
                            <tr> 
                            <td align="right" colspan="2"
                                <asp:Button ID="ButtonProjectSave" runat="server" UseSubmitBehavior="false" 
                                        Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 
                                        CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' ValidationGroup="Project"
                                </asp:Button> 
                                    &nbsp; 
                                <asp:Button ID="ButtonProjectCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"
                                </asp:Button> 
                            </td> 
                        </tr> 
                        </table> 
                    </FormTemplate> 
                </EditFormSettings> 
            </MasterTableView> 
            <ClientSettings AllowDragToGroup="true" AllowAutoScrollOnDragDrop="true"  
                AllowColumnHide="true" AllowColumnsReorder="true" AllowExpandCollapse="true"  
                AllowGroupExpandCollapse="true" Resizing-AllowColumnResize="true">             
            </ClientSettings> 
        </telerik:RadGrid> 
</asp:Content> 

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.HtmlControls; 
using System.Configuration; 
 
using AgriGraphicsLibrary.Business; 
using AgriGraphicsLibrary.Entity; 
 
using Sundial.Core.BusinessDataEntities; 
 
using Telerik.Web.UI; 
 
public partial class Projects : SundialBasePage 
    bool isPDFExport = false
    private class PageSessionVariables 
    { 
        public const string ProjectList = "ITSProjects.ProjectList"
        public const string CurrentProject = "ITSProjects.CurrentProject"
        public const string UserPhotographer = "ITSProjects.UserPhotographer"
    } 
    #region Attributes 
    #endregion 
    #region Properties 
 
    private List<ProjectEntity> ProjectList 
    { 
        get 
        { 
            List<ProjectEntity> projects = new List<ProjectEntity>(); 
 
            if (Session[PageSessionVariables.ProjectList] != null
            { 
                projects = (List<ProjectEntity>)Session[PageSessionVariables.ProjectList]; 
            } 
            else 
            { 
                if (AGContext.IsUserPhotographer) 
                { 
                    projects = ProjectBL.GetByPhotographerID(this.UserPhotographer.PhotographerID); 
                } 
                else 
                { 
                    projects = ProjectBL.GetAll(ActiveFlagEnum.Active); 
                } 
                Session[PageSessionVariables.ProjectList] = projects; 
            } 
            return projects; 
        } 
        set 
        { 
            Session[PageSessionVariables.ProjectList] = value; 
        } 
    } 
 
    private PhotographerEntity UserPhotographer 
    { 
        get 
        { 
            PhotographerEntity photographer = new PhotographerEntity(); 
            if (Session[PageSessionVariables.UserPhotographer] != null
            { 
                photographer = (PhotographerEntity)Session[PageSessionVariables.UserPhotographer]; 
            } 
            return photographer; 
        } 
        set 
        { 
            Session[PageSessionVariables.UserPhotographer] = value; 
        } 
    } 
 
    private ProjectEntity CurrentProject 
    { 
        get 
        { 
            ProjectEntity project = new ProjectEntity(); 
 
            if (Session[PageSessionVariables.CurrentProject] != null
            { 
                project = (ProjectEntity)Session[PageSessionVariables.CurrentProject]; 
            } 
 
            return project; 
        } 
        set 
        { 
            Session[PageSessionVariables.CurrentProject] = value; 
        } 
    } 
    #endregion 
    #region Page Events 
 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        RadAjaxManager manager = RadAjaxManager.GetCurrent(Page); 
        manager.ClientEvents.OnRequestStart = "onRequestStart"
        SetPagePermissions(); 
 
        if (!IsPostBack) 
        { 
            ClearSessions(); 
        } 
    } 
 
    protected void RadGridProjects_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
    { 
        if (!e.IsFromDetailTable) 
        { 
            RadGridProjects.DataSource = this.ProjectList; 
        } 
    } 
 
    protected void RadGridProjects_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        GridEditableItem editedItem = e.Item as GridEditableItem; 
 
        switch (e.CommandName) 
        { 
            case RadGrid.EditCommandName: 
                { 
                    //get the id from the record we are editing 
                    //read the entity 
                    this.CurrentProject = ProjectBL.Read((Int64)editedItem.GetDataKeyValue("ProjectID")); 
                    break
                } 
            case RadGrid.InitInsertCommandName: 
                { 
                    //set to a new entity 
                    this.CurrentProject = new ProjectEntity(); 
                    break
                } 
            case RadGrid.UpdateCommandName: 
                { 
                    if (IsValid) 
                    { 
                        try 
                        { 
                            SaveProject(editedItem); 
                            //clear the session variable so it gets the new information 
                            Session[PageSessionVariables.ProjectList] = null
                        } 
                        catch (Exception ex) 
                        { 
                            throw ex; 
                        } 
                    } 
                    break
                } 
            case RadGrid.PerformInsertCommandName: 
                { 
                    if (IsValid) 
                    { 
                        try 
                        { 
                            SaveProject(editedItem); 
                            //clear the session variable so it gets the new information 
                            Session[PageSessionVariables.ProjectList] = null
                        } 
                        catch (Exception ex) 
                        { 
                            throw ex; 
                        } 
                    } 
                    break
                } 
            case RadGrid.RebindGridCommandName: 
                { 
                    //clear the session variable so it gets the new information 
                    Session[PageSessionVariables.ProjectList] = null
                    break
                } 
            case RadGrid.DeleteCommandName: 
                { 
                    //delete the project 
                    ProductBL.Delete((Int64)editedItem.GetDataKeyValue("ProductID"), AGContext.UserInfo.UserID.ToString()); 
                    //clear the session variable so it gets the new information 
                    Session[PageSessionVariables.ProjectList] = null
                    break
                } 
            case RadGrid.ExportToPdfCommandName: 
                { 
 
                    isPDFExport = true
                    //RadGridProducts.ExportSettings.Pdf.PageHeight = Unit.Parse("210mm"); 
                    //RadGridProducts.ExportSettings.Pdf.PageWidth = Unit.Parse("297mm"); 
                    RadGridProjects.ExportSettings.Pdf.PageLeftMargin = Unit.Parse("1mm"); 
                    RadGridProjects.ExportSettings.Pdf.PageRightMargin = Unit.Parse("1mm"); 
                    RadGridProjects.ExportSettings.Pdf.PageHeaderMargin = Unit.Parse("10mm"); 
                    RadGridProjects.ExportSettings.Pdf.PageFooterMargin = Unit.Parse("10mm"); 
                    //RadGridProducts.MasterTableView.GetColumn("Email").HeaderStyle.Width = Unit.Pixel(200); 
                    break
                } 
        } 
    } 
 
    protected void RadGridProjects_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) 
        { 
            GridDataItem item = e.Item as GridDataItem; 
 
            ProjectEntity entity = (ProjectEntity)e.Item.DataItem; 
 
            List<ImageEntity> images = ImageBL.GetByProjectID(entity.ProjectID); 
 
            PhotographerDisplayEntity pde = PhotographerDisplayBL.GetByPhotographerID(entity.PhotographerID); 
            item["Photographer"].Text = pde.FullName; 
 
            //if there are images associated with this project you can't delete it 
            if (images.Count > 0) 
            { 
                item["DeleteCommandColumn"].Controls[0].Visible = false
            } 
        } 
        
    } 
 
    protected void RadGridProjects_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridColumn col in RadGridProjects.MasterTableView.Columns) 
        { 
            if (col.UniqueName == "EditCommandColumn"
            { 
                col.Visible = ApplicationFeature.GetPermission(AGContext.UserInfo.PersonID, ApplicationFeature.Projects).CanUpdate; 
            } 
            if (col.UniqueName == "DeleteCommandColumn"
            { 
                col.Visible = ApplicationFeature.GetPermission(AGContext.UserInfo.PersonID, ApplicationFeature.Projects).CanDelete; 
            } 
        } 
    } 
 
    protected void RadGridProjects_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if (isPDFExport) 
            FormatItem(e.Item); 
        if (e.Item is GridCommandItem) 
        { 
            //get the add button/image 
            LinkButton addButton = (LinkButton)e.Item.FindControl("InitInsertButton"); 
            Button addImage = (Button)e.Item.FindControl("AddNewRecordButton"); 
            //hide the button/image if they don't have the feature 
            addButton.Visible = ApplicationFeature.GetPermission(AGContext.UserInfo.PersonID, ApplicationFeature.Projects).CanCreate; 
            addImage.Visible = ApplicationFeature.GetPermission(AGContext.UserInfo.PersonID, ApplicationFeature.Projects).CanCreate; 
        } 
        if ((e.Item is GridEditFormItem) && e.Item.IsInEditMode) 
        { 
            GridEditFormItem editItem = (GridEditFormItem)e.Item; 
            ProjectEntity pe = this.CurrentProject; 
            RadComboBox cb = (RadComboBox)editItem.FindControl("RadComboBoxPhotographer"); 
            RadEditor resi = (RadEditor)editItem.FindControl("RadEditorInstructions"); 
            RadEditor ren = (RadEditor)editItem.FindControl("RadEditorNotes"); 
            Label lb = (Label)editItem.FindControl("LabelProjectID"); 
            cb.DataSource = PhotographerDisplayBL.GetAll(ActiveFlagEnum.Active); 
            cb.DataBind(); 
             
                resi.Content = pe.SpecialInstructions; 
                ren.Content = pe.Notes; 
            if (AGContext.IsUserPhotographer) 
            { 
                cb.SelectedValue = this.UserPhotographer.PhotographerID.ToString(); 
                cb.Enabled = false
                if (editItem.OwnerTableView.IsItemInserted) 
                { 
                    lb.Visible = false
                } 
            } 
            else 
            { 
                if (!editItem.OwnerTableView.IsItemInserted) 
                { 
 
                    if (pe.ProjectID != ProjectEntity.ProjectIDDefault) 
                    { 
                        cb.SelectedValue = pe.PhotographerID.ToString(); 
                    } 
                    else 
                    { 
                        cb.SelectedValue = "-1"
                    } 
                } 
                else 
                { 
                    lb.Visible = false
                } 
            } 
        } 
    } 
 
    protected void ComboBoxPhotographer_DataBound(object sender, EventArgs e) 
    { 
        RadComboBox cb = (RadComboBox)sender; 
 
        cb.Items.Insert(0, new RadComboBoxItem("Select One....""-1")); 
    } 
    #endregion 
    #region Load Data 
    #endregion 
    #region Save Data 
 
    private void SaveProject(GridEditableItem editItem) 
    { 
        ProjectEntity entity = this.CurrentProject; 
        entity.LocationOrEventName = ((editItem.FindControl("TextBoxLocationEventName"as TextBox).Text); 
        RadEditor ren = editItem.FindControl("RadEditorNotes"as RadEditor; 
        entity.Notes = ren.Content; 
        entity.PhotographerID = Convert.ToInt64((editItem.FindControl("RadComboBoxPhotographer"as RadComboBox).SelectedValue); 
        entity.ProjectDate = (DateTime)(editItem.FindControl("DatePickerProjectDate"as RadDatePicker).SelectedDate; 
        entity.SpecialInstructions = (editItem.FindControl("RadEditorInstructions"as RadEditor).Content; 
        entity.Volume = ((editItem.FindControl("TextBoxVolume"as TextBox).Text); 
        entity.ModifiedBy = AGContext.UserInfo.UserID.ToString(); 
        ProjectBL.Update(entity); 
    } 
    #endregion 
    #region Custom Code 
 
    private void SetPagePermissions() 
    { 
        VerifyPageAccess(AGContext.UserInfo.PersonID, ApplicationFeature.Projects); 
    } 
 
    private void SetControlPermissions() 
    { 
 
    } 
 
    private void ClearSessions() 
    { 
        Session[PageSessionVariables.ProjectList] = null
        Session[PageSessionVariables.CurrentProject] = null
        Session[PageSessionVariables.UserPhotographer] = null
    } 
 
    private void RebindGrids() 
    { 
 
    } 
 
    private void FormatItem(GridItem gridItem) 
    { 
        foreach (TableCell cell in gridItem.Cells) 
        { 
            cell.Style["font-family"] = "Arial Narrow"
            cell.Style["font-size"] = "12pt"
            //cell.Width = Unit.Parse("300px"); 
        } 
        switch (gridItem.ItemType) 
        { 
            //case GridItemType.Item: gridItem.Style["background-color"] = "#9999ff"; break; 
            //case GridItemType.AlternatingItem: gridItem.Style["background-color"] = "#ccccff"; break; 
            //case GridItemType.Header: gridItem.Style["background-color"] = "#aaa"; break; 
        } 
    } 
    #endregion 
Rumen
Telerik team
 answered on 17 May 2011
4 answers
565 views
Hello

I want to redirect to anther page after clicking a button in a radwindow popup, but the redirected page is loaded in the radwindow popup, which is what I want to avoid. The code I use in java script to open the popup is this:
function CloseAndRebind(){
 GetRadWindow().close();return false;
}
 function GetRadWindow() {
 var oWindow = null;<br>               
 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();
}
........
<telerik:RadButton ID="GoProcessBtn" runat="server" Width="32px" Height="32px"
  OnClick="ProceedBtn_OnClick" AutoPostBack="true"
  OnClientClicked="CloseAndRebind" ToolTip="Proceed" 
Text="Proceed">
<Image ImageUrl="Images/1305562168_Next.png" /><br>                   
</
telerik:RadButton>
<telerik:RadButton ID="CancelBtn" runat="server" Width="32px" AutoPostBack="false" Height="32px"
ToolTip="Cancel" Text="Cancel" OnClientClicked="CancelEdit">
<Image ImageUrl="Images/1305540585_gtk-dialog-error-hover.png" />
</telerik:RadButton>

And in the code behind of the page of the popup, I have this code attached to the clik event of ProcessBtn:
protected void ProceedBtn_OnClick(object sender, EventArgs e)
 { 
//hammer
ChannelId = GoProcessBtn.CommandName;
if(string.IsNullOrEmpty(ChannelId))
return;
Response.Redirect("~/ProcessGridEditing.aspx?Channel=" +
ChannelId + "&Version=" + VersionsListBox.SelectedValue);
}

Can you plz tell me what I could do to avoid this problem?
What actually happens is that the popup closes and the redirect isn't happening at all!
I guess is because of the "return false;" i put in javascript CloseAndRebind function.
Thx a lot.
Alin
Top achievements
Rank 1
 answered on 17 May 2011
1 answer
81 views
I'm currently using the Telerik Controls for Ajax with SharePoint 2010 to create custom web parts and I'm having an issue with the RadGrid and posting back events.

I am dynamically creating the grid in the CreateChildControls method of the SharePoint Web Part and binding the grid on specific conditions.

Allow Sorting is true:
this.gvDocumentsGrid.AllowSorting = true;

With this event:
this.gvDocumentsGrid.SortCommand += new GridSortCommandEventHandler(gvDocumentsGrid_SortCommand);

I've also tried using the "NeedDataSource" event, but whenever I click on a column header to sort the grid the page does postback but the SortCommand event is never fired and I lose the binding. I also have the RadAjaxManager registered in my masterpage.

What am I do doing wrong? This is extremely frustrating.
Tsvetoslav
Telerik team
 answered on 17 May 2011
3 answers
286 views
Hi,

I'm trying to set up a rad filter from code.

This works as expected:
<telerik:RadFilter ID="RadFilter1" runat="server">  
   <FieldEditors> 
       <telerik:RadFilterTextFieldEditor DataType="System.String" FieldName="MyColumn" /> 
   </FieldEditors> 
</telerik:RadFilter> 
 

This doesn't:
<telerik:RadFilter ID="RadFilter1" runat="server">  
</telerik:RadFilter> 
 
protected void Page_Load(object sender, EventArgs e)  
{  
    RadFilterTextFieldEditor editor = new RadFilterTextFieldEditor();  
    editor.FieldName = "MyColumn";  
    editor.DataType = typeof(System.String);  
    RadFilter1.FieldEditors.Add(editor);  
}  
 

When configured programatically, I'm getting the following error as soon as I try to add an expresion (via the UI when the page is running):
Exception of type 'System.Web.HttpUnhandledException' was thrown. 
 
==> Parameter cannot be null or empty.  
Parameter name: fieldName    
Stack Traces  
Source: System.Web  
at System.Web.UI.Page.HandleError(Exception e)  
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  
at System.Web.UI.Page.ProcessRequest()  
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)  
at System.Web.UI.Page.ProcessRequest(HttpContext context)  
at ASP.junk_filters_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\bit9.console.web.ui\f02bb933\1bce73bb\App_Web_filters.aspx.83447962.uwhliv7r.0.cs:line 0  
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  
 
==> Source: Telerik.Web.UI  
at Telerik.Web.UI.RadFilterDataFieldEditorCollection.RetrieveEditorForFieldName(String fieldName)  
at Telerik.Web.UI.RadFilterSingleExpressionItem.SetupFunctionInterface(Control container)  
at Telerik.Web.UI.RadFilterExpressionItem.CreateFunctionalInterface()  
at Telerik.Web.UI.RadFilterExpressionItem.InitializeItem()  
at Telerik.Web.UI.RadFilter.CreateFilterItems()  
at Telerik.Web.UI.RadFilter.CreateControlHierarchy()  
at Telerik.Web.UI.RadFilter.CreateChildControls()  
at System.Web.UI.Control.EnsureChildControls()  
at Telerik.Web.UI.RadFilter.EnsureItemsCreated()  
at Telerik.Web.UI.RadFilter.RecreateControl()  
at Telerik.Web.UI.RadFilter.AddChildExpression(RadFilterGroupExpressionItem groupItem, Boolean isGroup)  
at Telerik.Web.UI.RadFilterCommandEventArgs.ExecuteCommand(Object source)  
at Telerik.Web.UI.RadFilter.OnBubbleEvent(Object source, EventArgs args)  
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)  
at Telerik.Web.UI.RadFilterExpressionItem.OnBubbleEvent(Object source, EventArgs args)  
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)  
at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)  
at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)  
at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)  
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)  
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)  
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)  

Any suggestions?  Doing this declaratively is not an option for me and I will not have a grid or other "FilterContainer" available.

-Al
João
Top achievements
Rank 1
 answered on 17 May 2011
4 answers
130 views

Hello,
I have a RadGrid which one of its columns is RadCombobox.
when i change item in one of the comboboxes, i want to know to which item (row) in the grid it belongs.
I mean, I want to know which of the rows was changed
How do i do that?
i thought to do it in the radCombobox 'OnClientSelectedIndexChanged' event,
but i dont know how to get to check which row i changed.

it's very important for me.
waiting for an answer,
yoni
Veli
Telerik team
 answered on 17 May 2011
3 answers
76 views
Hi,
We are having an old project which uses “r.a.d.menu v3.6” which is part of  r.a.d controls Q4 2005 installed on 32 bit server. Now the project is being moved to a new server having 64 bit architecure. For testing we ported the application on a test 64 bit server but the menu control does not work. There is an error "Master Page Undefined" in page from which menu is invoked.

Please let me know what are the steps needed to make this menu control work in 64 bit web server.

Thanks in advance,
-Kumar
Helen
Telerik team
 answered on 17 May 2011
1 answer
95 views
I need to test whether or not a RadWindow is in the Windows collection of a RadWindowManager.

"Easy" I thought, I'll add an extension method ...

public static RadWindow FindWindowByID(this RadWindowManager WindowManager, string ID)
{
    if (String.IsNullOrWhiteSpace(ID))
    {
        throw new InvalidOperationException("Searching for a blank ID is not supported)");
    }
    string id = ID.ToLower();
    if (WindowManager.Windows.Count == 0)
    {
        return null;
    }
    RadWindow result = null;
    foreach (RadWindow window in WindowManager.Windows)
    {
        if (window.ID.ToLower() == id)
        {
            result = window;
            break;
        }
    }
    return result;
}

However, when called it always throws an exception in the test if(window.ID.ToLower() == id) and reports the window.ID is null.

If I drill down through the object's structure all the way to WebControl I can see that, in fact, ID is set but it isn't my value (the one assigned in the markup), but, rather is an automagically assigned value like cl001.

OK, so you are managing the ID, but I can't find a property anywhere that has the value that I assigned and that I can test against.

What am I missing?

-- 
Stuart
Marin Bratanov
Telerik team
 answered on 17 May 2011
2 answers
103 views
I have a project that previously used asp dropdown lists.  I am switching these over to telerik controls for increased functionality.  However, I need to be able to dynamically reference and populate the controls in the page load event.  Here is how I used to accomplish this:

Dim dropDown As New DropDownList
dropDown = CType(Me.Master.FindControl("id_" & dynamic_code), DropDownList)
 
With dropDown
    .Enabled = True
    .DataSource = SqlDataReader
    .DataValueField = "code"
    .DataTextField = "desc"
    .DataBind()
End With


How do I replicate this behavior with a telerik control?  I've tried something like this:

Dim dropDown As RadComboBoxItem
Dim instance As RadComboBoxItem
 
dropDown = instance.FindControl("id_" & dynamic_code)
 
With dropDown
    .Enabled = True
    .DataSource = SqlDataReader
    .DataValueField = "code"
    .DataTextField = "desc"
    .DataBind()
End With

But the properties I'm trying to set are invalid and do not exist.  Suggestions or help appreciated.
Karl
Top achievements
Rank 1
 answered on 17 May 2011
1 answer
70 views
Hi,

The radeditor flickers a lot when using IE (only tested with IE9), when setting ContentMode to Div and using AutoResize to fit content height.

This is easy to demonstrate in your Demo:
http://demos.telerik.com/aspnet-ajax/editor/examples/contentareamodediv/defaultcs.aspx

1. Check the Auto resize button.
2. Make a lot of new lines at the end of the editor (large content).
3. Start typing and press enter, continue typing and pressing enter.

This makes the entire page to flicker a lot.

Regards
Caesar
Rumen
Telerik team
 answered on 17 May 2011
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?