Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
180 views
I have a RadWindow that is used as a dialog. The page in it has a couple of RadColorPickers in it.

When displayed, the colour pickers are always displayed relative to the picker button which causes scrollbars to appear in the dialog, regardless of the size of the window (See this Jing video for an example).

My mark-up looks something like this ...
<telerik:RadColorPicker id="ColBackColour" runat="server" ShowIcon="true" KeepInScreenBounds="true" ShowEmptyColor="false" AutoPostBack="false" PreviewColor="false" Columns="35">
  <telerik:ColorPickerItem title="Light Pink" value="#FFB6C1"/>
  <!-- blah -->
</telerik:RadColorPicker >

I note that whatever I do there is always item level CSS injected to set the top and left of the colour picker. I need to be able to override this to set the position relative to the dialog bounds.

-- 
Stuart


Stuart Hemming
Top achievements
Rank 2
 answered on 17 May 2011
3 answers
204 views
Hi,

How can I create a my own ImageManager? I find som information about the FileManager (Custom Dialog in the LinkManager).
but I will like to do that with the ImageManager.

I'st anyone out there that have a good advice or some examples to share?

Best regards

Rune



Rumen
Telerik team
 answered on 17 May 2011
1 answer
148 views
When will this product be available for purchase?
Sebastian
Telerik team
 answered on 17 May 2011
1 answer
121 views
Hi,
We have an issue in some code for a user control where we are dynamically building up the controls on the page including the AjaxLoadingPanel and AjaxSettings via the AjaxManager.
We have follow the instructions as per http://www.telerik.com/help/aspnet-ajax/ajax-ajax-manager-programmatic-creation.html and http://www.telerik.com/help/aspnet-ajax/ajax-add-ajaxsettings-programmatically.html and placed the code in the relevant event handlers but the loading panel is not displayed. Also the ClientEvents OnRequestStart/End events don't seem to fire.
We don't have any issues in pages where we have declared the controls in markup.
We are using web parts heavily in our application (a CMS), could this have a bearing on the problem?


Tsvetoslav
Telerik team
 answered on 17 May 2011
4 answers
896 views
Hi,

I have a hierarichal grid and I'm trying to change the parent row cell color. The below code is working fine for changing the background color of a cell. But when I click on the expand arrow it is not expanding the detail table. If I comment out this code, it expands fine.

What am I doing wrong? Suggessions please....


protected void RadGridResults_ItemDataBound(object sender, GridItemEventArgs e)
        {
if (e.Item is GridDataItem)
                    {
                        GridDataItem dataItem = (GridDataItem)e.Item;
                        if (dataItem["rpd_cott_ind"].Text == "COTT")
                        {
                            dataItem["rpd_cott_ind"].BackColor = System.Drawing.Color.Brown;
                            dataItem["rpd_cott_ind"].Font.Bold = true;
                        }
                    }
}

Thanks,
PJ.
Tsvetina
Telerik team
 answered on 17 May 2011
3 answers
186 views
We are trying to move our new application up to the server and we are getting this message when we hit the Login.aspx page.  I'm pretty sure it has to do with access to the Telerik Resources, but we can't figure this out.  We've added these lines to our web.config, but it didn't help:

<location path="WebResource.axd">    
<BR><system.web>      
<BR><authorization>        
<BR><allow users="*" />      
<BR></authorization>    <BR></system.web>  
<BR></location>  <BR><location 
path="ScriptResource.axd">    
<BR><system.web>      
<BR><authorization>        
<BR><allow users="*" />      
<BR></authorization>    <BR></system.web>  
<BR></location>  <BR><location 
path="Telerik.Web.UI.WebResource.axd">    
<BR><system.web>      
<BR><authorization>        
<BR><allow users="*" />      
<BR></authorization>    <BR></system.web>  
<BR></location

The server is windows 2003.  We are using ASP.NET 4.0.  Latest version of the Telerik Ajax Controls(Q1, 2001)... 

We have configured it as a Website, not a Virtual Directory.  We are using a hybrid authentication(Windows Auth + Forms Authentication)...don't ask me why...wasn't my call...

I ran Fiddler and I am getting 404 errors when it tries to access the resource files.  I'm pretty sure it's tied to security, but I'm not sure what the fix is.

Help?

Thanks

mark


Tsvetina
Telerik team
 answered on 17 May 2011
1 answer
117 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
171 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
617 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
103 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?