Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > BinaryImage > RadBinary image Displays the Orginal Image Size.

Not answered RadBinary image Displays the Orginal Image Size.

Feed from this thread
  • Posted on Nov 2, 2011 (permalink)

    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();
                         
                    }
                }
     
                 
            }

    Reply

  • Iana Tsolova Iana Tsolova admin's avatar

    Posted on Nov 2, 2011 (permalink)

    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

    Reply

  • Posted on Nov 2, 2011 (permalink)

    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  

    Reply

  • Iana Tsolova Iana Tsolova admin's avatar

    Posted on Nov 2, 2011 (permalink)

    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

    Reply

  • Posted on Nov 3, 2011 (permalink)

    Hi

                      Give the solution for this problem through this forum.

    Reply

  • Iana Tsolova Iana Tsolova admin's avatar

    Posted on Nov 3, 2011 (permalink)

    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

    Reply

  • Posted on Nov 3, 2011 (permalink)

    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>

    Reply

  • Posted on Nov 3, 2011 (permalink)

    Hi
         How can i upload  my project.

    Reply

  • Iana Tsolova Iana Tsolova admin's avatar

    Posted on Nov 3, 2011 (permalink)

    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

    Reply

  • Posted on Nov 3, 2011 (permalink)

    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

    Reply

  • Iana Tsolova Iana Tsolova admin's avatar

    Posted on Nov 4, 2011 (permalink)

    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

    Reply

  • Posted on Nov 4, 2011 (permalink)

    Hi

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

    Thanks,
    Er. Velkumar

    Reply

  • Iana Tsolova Iana Tsolova admin's avatar

    Posted on Nov 4, 2011 (permalink)

    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

    Reply

  • Posted on Nov 4, 2011 (permalink)

    Hi

               Thank You So much.

    Thanks,
    Velkumar

    Reply

  • Posted on Nov 15, 2011 (permalink)

    Hello

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


    Thanks
    Velkumar

    Reply

  • Posted on Nov 17, 2011 (permalink)

    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.

    Reply

  • Iana Tsolova Iana Tsolova admin's avatar

    Posted on Nov 18, 2011 (permalink)

    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

    Reply

  • Posted on Nov 18, 2011 (permalink)

    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.

    Reply

  • Posted on Nov 22, 2011 (permalink)

    Hi

            Please give the solution for this problem.

    Thanks,
    Velkumar

    Reply

  • danny lankar avatar

    Posted on Mar 23, 2012 (permalink)

    I need the answer to this question too please. did this get resomved?

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > BinaryImage > RadBinary image Displays the Orginal Image Size.