RadBinary image Displays the Orginal Image Size.

20 posts, 0 answers
  1. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 02 Nov 2011 Link to this post

    Hi

                   I have a RadAsyncUpload to upload the image. Using  another button named "UpLoad" generate the postback to upload the image.  Save the image in sql Server database in binary format. Retrieve the binary data from the database and set it to the datavalue property of the RadBinary image control. The radbinary image displays the image in it's original size.  I have set the width and height of the radbinary image as 200px but the the image is displayed in its original size.
     If i will generate a postback again then the image is set in 200px height and width. Please give the solution for this problem.
    protected void Page_Load(object sender, EventArgs e)
            {
     
                binaryimage1.Height = Unit.Pixel(200);
                binaryimage1.Width = Unit.Pixel(200);
           
                b1.Click += new EventHandler(b1_Click);
     
            }
    void b1_Click(object sender, EventArgs e)
            {
     
                foreach (Telerik.Web.UI.UploadedFile file in uploader.UploadedFiles)
                {
                    byte[] bytes = new byte[file.ContentLength];
                    string fname = file.FileName.ToString();
                    int length = bytes.Length;
     
                    file.InputStream.Read(bytes, 0, file.ContentLength);
     
                    SqlConnection dbconn = new SqlConnection(strconn);
     
                    try
                    {
                        string Query = "INSERT INTO RadBinaryImageDemo (ImageData,ImageName) VALUES " + " (@imgdata,@imgname)";
                        SqlCommand cmd = new SqlCommand(Query, dbconn);
     
                        SqlParameter[] param = new SqlParameter[2];
     
                        cmd.Parameters.AddWithValue("@imgdata",bytes);
                        cmd.Parameters.AddWithValue("@imgname", file.FileName);
                        dbconn.Open();
                        cmd.ExecuteNonQuery();
                       
                        DataTable d1 = new DataTable();
                        string Query1 = "select ImageData from   RadBinaryImageDemo where ImageName='" + fname + "'";
                        SqlDataAdapter sqldadap = new SqlDataAdapter(Query1, dbconn);
                        sqldadap.Fill(d1);
     
                        byte[] imgdata = ((byte[])d1.Rows[0]["ImageData"]);
     
                        binaryimage1.DataValue = imgdata;
                         
                    }
                    finally
                    {
                         
                            dbconn.Close();
                         
                    }
                }
     
                 
            }
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 02 Nov 2011 Link to this post

    Hi Velkumar,

    Can you try setting the width and height properties in the button click event handler, just after setting the DataValue property and see if it makes any difference? You can also try altering the RadBinaryImage ResizeMode to Fit or Crop.
    If the issue persists, try downloading the latest internal build and let me know how it goes.

    Greetings,
    Iana Tsolova
    the Telerik team
    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 their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 02 Nov 2011 Link to this post

    Hi,
                     

                   Now i m using ResizeMode as fit . If the ResizeMode is Fit then the image displayed not in the given size(200 x 200). If a click the button for uploading then the image displayed not in the given dimension. If i generate the postback again then the image will be set in the given dimension (200 x 200). I attached both the screen shots. See the difference. If the width and height is set after setting datavalue no difference will occur.
    Give the solution for this problem.

    By
    Er.Velkumar B.E  
  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 02 Nov 2011 Link to this post

    Hello Velkumar,

    Could you please open a formal support ticket and send us a sample illustrating the issue? I will forward it to our developers for further investigation.

    Kind regards,
    Iana Tsolova
    the Telerik team
    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 their blog feed now
  6. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 03 Nov 2011 Link to this post

    Hi

                      Give the solution for this problem through this forum.
  7. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 03 Nov 2011 Link to this post

    Hi Velkumar,

    To solve the issue, we will need to replicate it. Can you send us a runnable project for the purpose?

    Kind regards,
    Iana Tsolova
    the Telerik team
    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 their blog feed now
  8. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 03 Nov 2011 Link to this post

    Hi

        I posted the c# code already.
       Now post the aspx code below.
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="BinaryImage1.aspx.cs" Inherits="BinaryImage1_Default" %>
     
    <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
             
            <asp:Label ID="heading" Text="Using Binary Image" runat="server"></asp:Label>
         
         
            <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
            </telerik:RadScriptManager>
         
         
        <table>
        <tr>
            <td>
                <telerik:RadAsyncUpload ID="uploader"   runat="server" ></telerik:RadAsyncUpload>
            </td>
        </tr>
            <tr>
                <td>
                    <telerik:RadBinaryImage ID="binaryimage1"  runat="server" />
                </td>
            </tr>
            <tr>
            <td>
                <asp:Button id="b1" Text="PostBack" runat="server" />
            </td>
            </tr>
            <tr>
                <td>
                    <asp:Image ID="imagedisp" runat="server" />
                </td>
            </tr>
     
            <tr>
                <td>
                <asp:Button ID="b2" Text="Again PostBack" runat="server" />
                </td>
            </tr>
             
        </table>
        </div>
        </form>
    </body>
    </html>

  9. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 03 Nov 2011 Link to this post

    Hi
         How can i upload  my project.
  10. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 03 Nov 2011 Link to this post

    Hi Velkumar,

    You can add the project to a zip file and attach it to your posts in the Support thread.

    All the best,
    Iana Tsolova
    the Telerik team
    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 their blog feed now
  11. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 03 Nov 2011 Link to this post

    Hi
                Please give the link to upload my project in Zip.
               
                Just copy the above asp.net and C# codes and develop a new project to illustrate the issue.

    Thanks,
    Er.Velkumar
  12. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 04 Nov 2011 Link to this post

    Hi Velkumar,

    You have already open a formal Support Ticket for the same issue, right? Then post reply to the ticket and attach the runnable sample in a zip file there.
    Using the code you provided to build up a sample is not enough, the referred database is necessary as well.

    All the best,
    Iana Tsolova
    the Telerik team
    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 their blog feed now
  13. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 04 Nov 2011 Link to this post

    Hi

                  I attached my project in the support ticket. Please give the solution for this problem.

    Thanks,
    Er. Velkumar
  14. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 04 Nov 2011 Link to this post

    Hello Velkumar,


    Thank you for the cooperation. We will check it out and let you know of our progress in the support thread shortly.

    Regards,
    Iana Tsolova
    the Telerik team
    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 their blog feed now
  15. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 04 Nov 2011 Link to this post

    Hi

               Thank You So much.

    Thanks,
    Velkumar
  16. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 15 Nov 2011 Link to this post

    Hello

                    I will check the steps provided in support ticket and send the feed back to you.


    Thanks
    Velkumar
  17. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 17 Nov 2011 Link to this post

    Hello,

       Now Image not resized on postback but some images displayed in different width and height. I am providing 300x300 but the size will vary for some images.


    Thanks,
    Velkumar.
  18. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 18 Nov 2011 Link to this post

    Hi Velkumar,

    Can you specify what is the original size for such an image and what is its size afterwards? Sending such an image for tests, would be great.


    Greetings,
    Iana Tsolova
    the Telerik team
    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 their blog feed now
  19. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 18 Nov 2011 Link to this post

    Hi

           I attached the folder which contains the images in my Support ticket. Please check by using all the images in the folder.


    Looking forward your reply,
    Thanks,
    Velkumar.
  20. Velkumar
    Velkumar avatar
    85 posts
    Member since:
    Apr 2011

    Posted 22 Nov 2011 Link to this post

    Hi

            Please give the solution for this problem.

    Thanks,
    Velkumar
  21. danny lankar
    danny lankar avatar
    1 posts
    Member since:
    Nov 2009

    Posted 23 Mar 2012 Link to this post

    I need the answer to this question too please. did this get resomved?
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017