Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
232 views

Hello

i just added a Confirmation Dialog to my Radgrid using the radgrid.radconfirm. This works perfectly, but after that the Radgrid is not updated, like it still shows the deleted entry. Refreshing the page obv helps. I already tested the following:

Use advanced binding instead of simple binding.

Change to type BindingList instead of List as Datasourcetype

RadAjaxManager instead of RadAjaxPanel is not possible, because the panel is need as part of the whole concept of the webpage and to ensure that each user is only able to see what he is allowed to see.

Here is the code: ASPX

<%@ Page Title="News - Administration" Language="C#" MasterPageFile="~/AppMaster.master" AutoEventWireup="true" Inherits="News" CodeBehind="News.aspx.cs" %>
 
<%@ Register Src="NewsDetails.ascx" TagName="NewsDetails" TagPrefix="uc" %>
<asp:Content ID="Content" ContentPlaceHolderID="PlaceHolderContent" runat="Server">
  <asp:Label ID="LabelRead" runat="server" Text="<%$Resources:Labels, NoReadRight %>" Visible="false" CssClass="Labels" />
    <asp:Label ID="LabelConfirm" runat="server" Text="<%$Resources:Labels, NoReadRight %>" Visible="false" CssClass="Labels" />
     
    <telerik:RadWindowManager RenderMode="Lightweight" ID="confirmWindow" runat="server" EnableShadow="true">
        </telerik:RadWindowManager>
    <%--RadAjaxPanel--%>
    <telerik:RadAjaxPanel ID="PanelRead" runat="server" LoadingPanelID="RadAjaxLoadingPanel" Visible="false">
        <telerik:RadGrid ID="RadGrid" runat="server" AutoGenerateColumns="False" GridLines="None"
            AllowPaging="true" PageSize="20" Width="950px"
            OnItemCommand="RadGrid_ItemCommand" OnInsertCommand="RadGrid_InsertCommand" OnDeleteCommand="RadGrid_DeleteCommand"
            OnUpdateCommand="RadGrid_UpdateCommand">
            <MasterTableView Datasource="ObjectDataSourceNewsEntries" DataKeyNames="NewsEntryID"
                CommandItemDisplay="Top">
                <CommandItemSettings ShowRefreshButton="false" ShowAddNewRecordButton="true" AddNewRecordText="Neuer News-Eintrag" />
                <Columns>
                    <%--TimestampString --%>
                    <telerik:GridBoundColumn DataField="TimestampString" HeaderText='<%$Resources:Labels, NewsEntryTimestamp %>'
                        UniqueName="TimestampString" DataFormatString="{0}" DataType="System.String"
                        Display="true" Groupable="false">
                        <HeaderStyle Width="50px" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                        <ItemStyle Wrap="false" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                    </telerik:GridBoundColumn>
                    <%--HeaderText --%>
                    <telerik:GridBoundColumn DataField="HeaderText" HeaderText='<%$Resources:Labels, HeaderText %>'
                        UniqueName="HeaderText" DataFormatString="{0}" DataType="System.String" Display="true"
                        Groupable="false">
                        <HeaderStyle Width="330px" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                        <ItemStyle Wrap="false" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                    </telerik:GridBoundColumn>
                    <%--IsActive --%>
                    <telerik:GridBoundColumn DataField="IsActive" HeaderText='<%$Resources:Labels, IsActive %>'
                        UniqueName="IsActive" DataFormatString="" DataType="System.Boolean" Display="true"
                        Groupable="false">
                        <HeaderStyle Width="50px" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                        <ItemStyle Wrap="false" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                    </telerik:GridBoundColumn>
                    <%--ErstellerUserNameVorname --%>
                    <telerik:GridBoundColumn DataField="ErstellerUserNameVorname" HeaderText='<%$Resources:Labels, ErstellerUserNameVorname %>'
                        UniqueName="ErstellerUserNameVorname" DataFormatString="{0}" DataType="System.String"
                        Display="true" Groupable="false">
                        <HeaderStyle Width="170px" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                        <ItemStyle Wrap="false" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                    </telerik:GridBoundColumn>
                    <%--AenderungsUserNameVorname --%>
                    <telerik:GridBoundColumn DataField="AenderungsUserNameVorname" HeaderText='<%$Resources:Labels, AenderungsUserNameVorname %>'
                        UniqueName="AenderungsUserNameVorname" DataFormatString="{0}" DataType="System.String"
                        Display="true" Groupable="false">
                        <HeaderStyle Width="170px" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                        <ItemStyle Wrap="false" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                    </telerik:GridBoundColumn>
                    <%--Aenderungsdatum --%>
                    <telerik:GridBoundColumn DataField="Aenderungsdatum" HeaderText='<%$Resources:Labels, Aenderungsdatum %>'
                        UniqueName="Aenderungsdatum" DataFormatString="{0}" DataType="System.String"
                        Display="true" Groupable="false">
                        <HeaderStyle Width="80px" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                        <ItemStyle Wrap="false" HorizontalAlign="Left" VerticalAlign="Top" Font-Bold="false" />
                    </telerik:GridBoundColumn>
                    <%--LinkButtonEditCommand--%>
                    <telerik:GridTemplateColumn UniqueName="ColumnEditCommand">
                        <HeaderStyle Width="25px" />
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButtonEditCommand" runat="server" CommandName="Edit" ToolTip="<%$Resources:Labels, Edit %>">
                                <asp:Image ID="ImageEditCommand" runat="server" ImageUrl="~/App_Themes/Controlling/EditIcon.gif" />
                            </asp:LinkButton>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <%--LinkButtonDeleteCommand--%>
                    <telerik:GridTemplateColumn UniqueName="ColumnDeleteCommand">
                        <HeaderStyle Width="25px" />
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButtonDeleteCommand" runat="server" CommandName="Delete"
                                ToolTip="<%$Resources:Labels, DeleteToolTip %>">
                                <asp:Image ID="ImageDeleteCommand" runat="server" ImageUrl="~/App_Themes/Controlling/DeleteIcon.png" />
                            </asp:LinkButton>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                <NestedViewTemplate>
                    <uc:NewsDetails ID="NewsDetails" runat="server" />
                </NestedViewTemplate>
                <EditFormSettings UserControlName="NewsCreateUpdate.ascx" EditFormType="WebUserControl">
                    <EditColumn UniqueName="NewsCreateUpdateColumn"></EditColumn>
                </EditFormSettings>
            </MasterTableView>
        </telerik:RadGrid>
    </telerik:RadAjaxPanel>
    <%--DataSources--%>
    <asp:ObjectDataSource ID="ObjectDataSourceNewsEntries" runat="server" SelectMethod="GetNewsEntries" TypeName="PortalDataServiceWrapper" />
</asp:Content>

 

C#

using System;
using System.Web.Services;
using Telekom.Platon.PortalModel;
using Telekom.Platon.Web.Code.Base;
using Telekom.PORTAL.Web;
using Telerik.Web.UI;
 
 
public partial class News : AppBasePage
{
    protected override ModulEnum ModulId => ModulEnum.AdminNews;
    protected static Guid GridID = Guid.Empty;
    protected static News n;
    protected static RadGrid RGrid;
 
 
    protected void Page_Load(object sender, EventArgs e)
    {
        PanelRead.Visible = MayRead;
        LabelRead.Visible = !MayRead;
 
        RadScriptManager.RegisterClientScriptInclude(Page.Master, Page.Master.GetType(), "ConfirmRadWindow", ResolveClientUrl("~/Scripts/app/ConfirmRadWindow.js"));
 
 
        if (!Page.IsPostBack)
            DataBind();
    }
 
    protected void RadGrid_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == Telerik.Web.UI.RadGrid.ExpandCollapseCommandName)
        {
            //
            // Expand
            //
            GridDataItem gridDataItem = e.Item as GridDataItem;
 
            string newsEntryIDString = gridDataItem.GetDataKeyValue("NewsEntryID").ToString();
            Guid newsEntryID = new Guid(newsEntryIDString);
 
            NewsEntry dataItem = PortalDataService.GetNewsEntry(newsEntryID);
 
 
            if (!e.Item.Expanded)
            {
                NewsDetails control = (NewsDetails)gridDataItem.ChildItem.FindControl("NewsDetails");
 
                if (control != null &&
                        dataItem != null)
                {
                    control.State.FormattedContent = dataItem.FormattedContent;
                    control.DataBind();
                }
            }
        }
    }
 
    protected void RadGrid_InsertCommand(object sender, GridCommandEventArgs e)
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        NewsCreateUpdate userControl = (NewsCreateUpdate)editedItem.FindControl(GridEditFormItem.EditFormUserControlID);
 
        if (userControl.Timestamp.HasValue) Create(userControl.Timestamp.Value, userControl.HeaderText, userControl.IsActive, userControl.FormattedContent);
    }
 
    protected void RadGrid_UpdateCommand(object sender, GridCommandEventArgs e)
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        NewsCreateUpdate userControl = (NewsCreateUpdate)editedItem.FindControl(GridEditFormItem.EditFormUserControlID);
        Guid newsEntryID = GridUtil.GetValue<Guid>("NewsEntryID", e);
 
        if (userControl.Timestamp.HasValue) Update(newsEntryID, userControl.Timestamp.Value, userControl.HeaderText, userControl.IsActive, userControl.FormattedContent);
    }
 
    protected void RadGrid_DeleteCommand(object sender, GridCommandEventArgs e)
    {
        GridID = GridUtil.GetValue<Guid>("NewsEntryID", e);
        RGrid = this.RadGrid;
        n = this;
 
        if (Page.IsValid)
        {
            confirmWindow.RadConfirm("Sind Sie sicher das diese News gelöscht werden soll?", "confirmCallBackFn", 330, 180, null, "Newsmeldung löschen?");
        }
 
    }
 
    private void Create(DateTime timestamp, string headerText, bool isActive, string formattedContent)
    {
        if (Page.IsValid)
        {
            string userID = SecurityService.GetUserID();
 
            NewsEntry newsEntry = NewsEntry.Create(timestamp, headerText, isActive, userID);
 
            if (newsEntry != null)
            {
                newsEntry.FormattedContent = formattedContent;
 
                string message = string.Empty;
                PortalDataService.CreateNewsEntry(newsEntry, out message);
 
                RadGrid.DataBind();
                RadGrid.CurrentPageIndex = 0;
            }
        }
    }
 
    private void Update(Guid newsEntryID, DateTime timestamp, string headerText, bool isActive, string formattedContent)
    {
        if (Page.IsValid)
        {
            string userID = SecurityService.GetUserID();
            NewsEntry newsEntry = PortalDataService.GetNewsEntry(newsEntryID);
 
            if (newsEntry != null)
            {
                newsEntry.Timestamp = timestamp;
                newsEntry.HeaderText = headerText;
                newsEntry.FormattedContent = formattedContent;
                newsEntry.IsActive = isActive;
                newsEntry.Aenderungsdatum = DateTime.Now;
                newsEntry.AenderungsUserID = userID;
 
                PortalDataService.UpdateNewsEntry(newsEntry);
 
                RadGrid.DataBind();
            }
        }
    }
 
    [WebMethod]
    public static void Delete(bool? UserReponse)
    {
        if (GridID != Guid.Empty && UserReponse.Equals(true))
        {
            PortalDataService.DeleteNewsEntry(GridID);
            RGrid.DataBind();
 
 
 
        }
    }
}

 

Any Ideas what i can do?

Regards Michael

Peter Milchev
Telerik team
 answered on 28 Apr 2020
3 answers
180 views
Is it possible to set the PageSizeText through code when using the RadDataPager for a RadListView?
Doncho
Telerik team
 answered on 28 Apr 2020
1 answer
589 views

     I've been working on resolving a Telerik vulnerability in our site that is using version 2015.3.1111.45 of Telerik.Web.UI (see https://www.telerik.com/support/kb/aspnet-ajax/details/cryptographic-weakness).  I've applied the patched dll to the site, so now when our tester tries the exploit, she gets an error page that says "Cannot deserialize dialog parameters. Please refresh the editor page.
Error Message:The hash is not valid!"  Our security group is not happy with that error page and wants to see something more generic and less revealing to the would-be hacker.  Our ASP.NET MVC application is configured in the web.config to have "customErrorsMode" set to "On" so that any unhandled errors will automatically redirect the user to a very generic and static html error page.  Unfortunately even with this set in our production environment, we are still getting the "Cannot deserialize dialog parameters....." error... presumably being generated by Telerik somehow.

Can you provide a solution on how to customize this error message or get around it so that it will fall though to the .NET error handling of the web application itself?

Rumen
Telerik team
 answered on 27 Apr 2020
1 answer
155 views

I created a simple xlsx file with 2 worksheets - Sheet1, and Sheet2.

Create a Named Range called NR1 that References Sheet2:B5

On Sheet1 create a formula "=NR1"

This looks great in excel.

Open it in RadSpreadsheet and it comes up as #NAME?

Is this a shortcoming in RadSpreadsheet, or am I missing something VERY fundamental?

 

Peter Milchev
Telerik team
 answered on 27 Apr 2020
5 answers
149 views

Hi,

In Radeditor when we delete some content the <del> tag is generated letter by letter. So I want to generate <del> tag word by word. How this can I do. Please guide me asap. Thanks

Rumen
Telerik team
 answered on 24 Apr 2020
2 answers
99 views

Hi all,

I started to use Radscheduler to show all holidays during year. So I use it in simple way and show only Yearview to user. I found that Radscheduler ignore culture in Yearview for ColumnHeaderDate. If it is set to default value 'ddd' then it always show English translation. If I switch to monthly view it is correct and translated.

Can you help me how to fix this problem? Is there a way how to override this?

Thank you,

Petr

Petr
Top achievements
Rank 1
Iron
Iron
 answered on 24 Apr 2020
7 answers
105 views

I attached the pic showing the issue.

Here is the code:

  var exportManager = $find("<%= RadClientExportManager1.ClientID %>");
  var charts = $telerik.$(".RadHtmlChart");

   exportManager.exportImage($(charts[3]));

Any suggestions?

Thank you

Vessy
Telerik team
 answered on 24 Apr 2020
1 answer
315 views

How do I remove the indent/padding from an expanded context menu?  

 

See attached image.  The only thing that should be visible is the black box with gold border.  

 

How do I remove the padding without effecting other menus elsewhere on the page?  

 

I created a custom skin called Black1 via the theme builder  but I do not see any entries to explain the indent.  

 

 

 

Doncho
Telerik team
 answered on 23 Apr 2020
5 answers
281 views

Hi, is it possible to have an offline version of the whole (new) documentation for ASP.NET AJAX?

In CHM or similar format?

Thanks, Tom

Vessy
Telerik team
 answered on 23 Apr 2020
1 answer
666 views

Hi there,

Our organization is using the FileExplorer control in one of our web applications for our end users to manage files.

There is a continuous request for being able to download all files from any given folder instead of downloading them one by one.

Does the latest version of FileExplorer support this feature? If not, is this on your roadmap for future releases?

Thanks,
Roger

Vessy
Telerik team
 answered on 23 Apr 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?