locked
how to create andload the label from the httphandler in the web page RRS feed

  • Question

  • User96253324 posted

     Hi,

     

    I am using the http handlers to fetch and display the image , now I need to display the timestamp also, for that I need to create a label control and update with the current time.

     

    Any ideas of how to create the label in the httphandler

    thanks,

    Renuga P

    Wednesday, April 29, 2009 4:19 AM

All replies

  • User541108374 posted

    Hi,

    I think you're looking for watermarking your image with the httphandler instead. Take a look here on how to accomplish this: http://www.google.be/search?hl=nl&q=httphandler+image+watermark&meta=&aq=f&oq=.

    Grz, Kris.

    Wednesday, April 29, 2009 4:41 AM
  • User96253324 posted

     Hi,

    It is not watermark.

    I have a usercontrol with the Label and Image control prsent inside it, from the User control image i am calling the http handler and displaying the image for every 1 sec, now the requirement is to display the time in the label value.

     

    Thanks,

     

    Monday, May 4, 2009 2:16 AM
  • User541108374 posted

    Hi,

    displaying the image for every 1 sec, now the requirement is to display the time in the label value.
     

    So the place where you display the time is not on the image itself right? Got that apparently wrong from your original question. So I assume that you use javascript to change the src attribute right? If so you can set the innerHTML or innerText of a span element with the time everytime you set the src attribute of the image.

    Grz, Kris.

    Monday, May 4, 2009 3:54 AM
  • User96253324 posted

     Hi,

     

    Sorry for the late response,

    yes as you said I am using the  javascript to change the src attribute of image control, in the src I am calling the httphandler and getting the response image using the context.response.outputstream. Is it possible to give the timestamp from  the httphandler and display in the label present above the image control.

    Any ideas..

    Thanks,

     

     

     

    Friday, May 8, 2009 3:58 AM
  • User541108374 posted

    Hi,

    Is it possible to give the timestamp from  the httphandler and display in the label present above the image control.

    Err, I don't really understand your question here. You can provide the timestamp by using ajax at the same time to get the timestamp of the server if needed.

    Grz, Kris.

    Friday, May 8, 2009 4:37 AM
  • User96253324 posted

    Hi,

    Thanks for the response.

    I am using the following lines inside the script for calling the handler.

    var url="../UserControl/ImageHandler.ashx?Name=" + CameraName+ "&lq=" + Math.random();

    document.getElementById('CamImage').src = url;

     In the httphandler, Process request I am calling the server method to fetcht the image and the timestamp from the server

    bFlag = oCameraServer.GetCameraData(strCameraName, out obyte, out dtimestamp, out strStatus);

    and displaying the image using this statement

    bmpImage.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

    now I need to pass this dTimestamp value from the handler into the User control which has the label control to display this value.

    the user control aspx contains

    <table border="0" cellpadding="0" cellspacing="0" style=" height:100%; width:100%;border:Gray 1px Solid" >

    <tr> <td id="TitlePanel" style="width:50%;height:22px;" align="left">

    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>

    </td> </tr> <tr>

    <td style="width:100%;border-top:Gray 1px Solid;" >

    <img id="CamImage" />

    </td> </tr> </table>

    Can you please guide me how this can be done.

     

     

    Friday, May 8, 2009 5:17 AM
  • User541108374 posted

    Hi,

    I don't think you can pass it that way and need to use ajax to explicitely grab it from the server when needed. The outputstream gets written to the browser but doesn't contain the timestamp you're after.

    Grz, Kris.

    Friday, May 15, 2009 8:53 AM
  • User-627724879 posted

    You are not going to be able to set the label from the httpHandler. You will need to make two request, assuming you did not download the image label when you created the page in the first place. But this is a class AJAX scenario. So make an AJAX request to get the image information, set that accordingly and when you change the img src to the httpHandler your image will load correctly and everything should be updated the way you want.

    Friday, May 15, 2009 9:00 AM