Error after rotate and reset changes

2 posts, 0 answers
  1. Nitin
    Nitin avatar
    3 posts
    Member since:
    May 2012

    Posted 10 Dec 2013 Link to this post

    Working Code: I have a Grid, and it has list of filename's with radio button. If I select a radio button, I can display image for the filename in the RadImageEditor. If I change the radio button or click another row, the image is updated properly. When image is displayed and If I click on zoom in zoom out, and then reset, the image is displayed in its original form the way it was loaded.
    1) The problem comes when I first rotate an image, then click on reset changes , the image does not come to its original form the way it was initially loaded.
    2) Continuing the step 1, if I now try to change radiobutton so try to load another image, an error is thrown.

    Let me know any better way or possible solution to this issue. The demo does not give proper information for this issue, so putting in this forum.
     Markup Code:
    <%@ Page Title="Home Page" Language="vb"   AutoEventWireup="false"   CodeBehind="Default.aspx.vb" Inherits="DocumentMgr._Default" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

    <html xmlns="">
    <head id="Head1"  >
         <script type="text/javascript">
             function OnClientCommandExecuting(sender, eventArgs) {

                 if (eventArgs.get_commandName() == "Reset") {                 
                     var imgEditor = $find("<%=rie.ClientID %>");
                 return false;
        <form id="form1" runat="server">
       <%--<asp:FileUpload ID="fup" runat="server" />
        <asp:Button ID="submit" runat="server"  Text="Submit" OnClick="Submit_Click" />--%>
         <asp:ScriptManager ID="sm" runat="server"  ></asp:ScriptManager>
        <asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional">
        <telerik:radgrid id="grTL" skin="Office2010Silver" allowfilteringbycolumn="false"  
            width="100%" height="150px" showstatusbar="true" runat="server" allowpaging="True"
            allowsorting="True" enableajax="True" allowcustompaging="false" pagesize="23"
            editformitem="false" autogeneratecolumns="false" enablecolumnsviewstate="false"
            autogenerateeditcolumn="false" enableariasupport="true" MasterTableView-DataKeyNames="ID"
            <MasterTableView HeaderStyle-Font-Bold="true" ShowFooter="False" AllowNaturalSort="false"
                                        EditMode="InPlace" CommandItemDisplay="None" Summary ="">
                    <telerik:GridTemplateColumn UniqueName="Select" HeaderText="" HeaderStyle-Width="40"
                        HeaderStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Center">
                            <asp:RadioButton ID="rbSelect" AutoPostBack="true" EnableTheming="true" Font-Bold="true"
                                runat="server" OnCheckedChanged="rbSelect_CheckedChanged" />
                     <telerik:GridTemplateColumn HeaderText="FileName" >
                            <asp:Label ID="lblFileName" runat="server" Width="200px" Text='<%# Eval("FileName") %>'></asp:Label>                        
                             <asp:Label ID="lblEFileName" runat="server" Width="200px" Text='<%# Eval("FileName") %>'></asp:Label>
                    <telerik:GridTemplateColumn HeaderText="Information" >
                            <asp:Label ID="lblInfo" runat="server" Width="200px" Text='<%# Eval("Information") %>'>
                            <telerik:RadTextBox ID="txtEditInfo" runat="server"  Width="200px" Text='<%# Bind("Information") %>' TabIndex="1" />                                                
            <ClientSettings AllowColumnsReorder="true">
                <Scrolling AllowScroll="true" UseStaticHeaders="true" FrozenColumnsCount="3" />
                <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false"
                    ClipCellContentOnResize="true" EnableRealTimeResize="false" />

    <telerik:RadImageEditor ID="rie" runat="server" EnableResize="true"    
      Width="100%" Height="500px" EnableEmbeddedScripts="true"   OnClientCommandExecuting="OnClientCommandExecuting"   
    ToolsFile="Basic.xml"  >

    Code Behind:
     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not Page.IsPostBack Then
            End If
        End Sub

        Private Sub BindData()
            grTL.DataSource = GetListOfImages()
        End Sub
        Private Function GetListOfImages() As List(Of FileData)
            Dim images = New List(Of String)()
            Dim arr As List(Of FileData) = New List(Of FileData)
            Dim files As Files = New Files
                arr = files.GetFileWoAttachment()
                ' Get a list of FileName with extension to be displayed in Grid.
            Catch ex As Exception
                'log exception

            End Try

            Return arr

        End Function
        Protected Sub rbSelect_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs)

            Dim bCAllToday As Boolean = False
            'Session("RowIndex") = 0

            Dim item As GridDataItem = DirectCast(TryCast(sender, RadioButton).NamingContainer, GridDataItem)
            Dim rdBtn As RadioButton = TryCast(sender, RadioButton)

            If rdBtn.Checked Then
                Session("RowIndex") = item.ItemIndex
                item.Selected = True
                rie.ImageUrl = "ShowImg.ashx?ID=" + CType(grTL.SelectedValues("ID"), String)
                Session("RowIndex") = CType(grTL.SelectedValues("ID"), String)

            End If

        End Sub


    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
            Dim my_Id As Int32
            If context.Request.QueryString("ID") IsNot Nothing Then
                my_Id = Convert.ToInt32(context.Request.QueryString("ID"))
                context.Response.ContentType = "image/png"
                context.Response.Buffer = True
                Dim strm As Stream = ShowEmpImage(my_Id)
                Dim bmp As Bitmap = New Bitmap(strm)
                bmp.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png)
            End If
        End Sub

        Public Function ShowEmpImage(ByVal my_Id As Integer) As Stream
            Dim fs As Files = New Files()
            Dim fdata As FileData = fs.GetFile(my_Id)
            'Attachment property defined in Class  As Byte()
            If (fdata.Attachment IsNot Nothing) Then
                Return New MemoryStream(DirectCast(fdata.Attachment, Byte()))
                Return Nothing
            End If

        End Function

  2. Vessy
    Vessy avatar
    2193 posts

    Posted 13 Dec 2013 Link to this post

    Hi Nitin,

    I am afraid that the provided information was not enough for me to reproduce the issue on my side, because of many missing references (like classes, database, etc.). With the current information I could only guess what might be causing the problem and propose the following solutions:
    • Try using RadAjaxManager instead an update panel. You can take a look at the approach used in this live demo, also loading the content from a data base: Using Custom Content Provider
    • Disable the page validation by setting the ValidateRequest property of the <%@ Page directive to "false"

    If non of the suggestions above helps in solving the case, I will need to replicate and examine the issue locally. You can see how to prepare a sample fully runnable project reproducing the problem in the following blog post: Isolating a problem in a sample project

    Kind regards,
    Veselina Raykova
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top