.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Dynamically Get The Image in Javascript

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
Dear all,   I have a filePhoto control and Image control in my aspx page when I click on Filephoto control i am able to get the path in the control i need the image to be set to Image control .Thanks In advance

View Complete Post

More Related Resource Links

paste image from clipboard using javascript

Hi all, How do we paste an image from clipboard into a custom rich text editor using javascript? (ctrl+c and ctrl+v or a snapshot) Please do share your thoughts! Thanks!  

play storyboard with dynamically created image

this is my storyboard:   <Storyboard x:Key="expandStoryboard"> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="2" Duration="0:0:0.2" /> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="2" Duration="0:0:0.2" /> </Storyboard> <!-- This storyboard will make the image revert to its original size --> <Storyboard x:Key="shrinkStoryboard"> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="0:0:0.2" /> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="0:0:0.2" /> </Storyboard>   and i created image dynamically:   BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri("file:///" + arrstrFileNames[0].Replace("\\", "/")); bmp.EndInit(); Image img = new Image(); img.Source = bmp; RotateTransform rt = new RotateTransform(); img.LayoutTransform = rt; ScaleTransform st = new ScaleTransform(); st.ScaleX = 1; st.ScaleY = 1; img.LayoutTransform = st; if(first==true) img.ContextMenu = mnu; first = false; assignEv

adding an external image dynamically

hi Folks, i got a report with an image, the full qualified image is stored in an attribute like http://vmt-moss/Immo/NA23/NA23.jpg if I set the the property in SQL 2008 R1 RS to external and the value to imagepath (where the http link is stored) nothing doesn't been displayed. Additonally i am setting an Action to the image property, where also the imagepath value has been set, if click onto the image, image has been opened properly. Do I have to format the value to a Url Format ?   thx for your help

Dynamically display images based on a variable - JavaScript

I am trying to bring in a specific image based on a variable brought into the page with a querystring. I initially thought having an array with the image's URL in it would work, but I am having problems associating the array index with the variable. Any help with this would be greatly appreciated. Dave 

Dynamically generating of hot spots on image


HI all,
           I am facing problem with the dynalically generating the image at particular with coordinate points on image map through code behind (aspx.cs).
    As per my requirement i need to generate Hotspots dynamically and also displaying an image to indicate the Hot spots.
Please send me the code above that ...

thanks in advance

how to dynamically set image's imagepath (imageURL) in the datalist1



Here i am again , with a new trouble Frown

I put a detalist in my vb.net web page. And bind with datasource, how can i bind a dynamical path on......


i solved by the working on the issue :)) Please find the following answer for setting dynamically setting the imageURL

        Dim img As Image
        Dim y1 As String = DropDownList1.SelectedItem.Value.ToString
        If DropDownList1.SelectedIndex = 1 Then
            y1 = "Genel"

Image Rotate by Javascript


Hi ,

I have a DataTable in which i have some images i want to bind the image and want to rotating them only by javascript.

plz give me solution.


Dynamically generate image on image map or image button


Here is this thing which to me looks possible, but when I searched over
the net I couldnt find anything. Any ideas about this please do let me know.

I want to create a page where I can upload an image using any upload
function and then display it.
Now after diplaying it I want to select the hotspots for an image map.
The coordinates of image map values are stored in a database.

Basically I want that to create image maps and hotspots I dont use any
offline software, this work is successfully completed and working perfectly, but i want generate one identification where i click the hot spots position in image or CSS file Generate for user identifications, So how can i solve this problem,please Help me.

I hope You are clear in that what I am looking for.

Please do reply if you have any sugestions.

Thanks In Advance:



Dynamically Generate hotspots With one identification like image or CSS in Image map


Hi One And All,

              Here I am write one query please help to me.

Query:how to Dynamically Generate Hotspots On image map with identification like image or CSS this logic for admin side ,and this image is Display in Front end side with Hotspots  using asp.net and c#.

I hope this understand one and all,

Thanks In Advance.

Adding an Image to a StackPanel dynamically


I feel silly asking this, but so far I haven't been able to solve this problem by myself, so here goes.

I'm trying to dynamically add a StackPanel to a Canvas, which works, but I also need to add an Image to the same StackPanel, which does not yet work. My code for this looks like this:

public void CreateInfo()
  StackPanel info = new StackPanel();
  TextBlock authorBlock = new TextBlock();
  TextBlock extraBlock = new TextBlock();

  info.Height = 500;
  info.Width = 500;

  authorBlock.Text = "Some text to test.";

  System.Windows.Controls.Image img = new System.Windows.Controls.Image(); // I needed to disambiguate Image.
  img.Source = new BitmapImage(new Uri("/Trex;component/Resources/icons/fire.png", UriKind.RelativeOrAbsolute)); // fire.png is something like 24 x 44 pixels.

  Canvas.SetLeft(info, 100);

Dynamically adding a javascript control to a row.


Hi all,

I have an old classic asp page that uses a 3rd party javascript calendar control. On that page I dynamically build up controls on a click of a button like so:

function AddContractorRow()
	with (frmMain)
		var objRow = document.all.Table1.insertRow(document.all.Table1.rows.length - 2);

		objRow.style.cursor = "hand";
		objRow.id = "row";

		var objCell = objRow.insertCell();
		objCell.innerHTML = "<input class='mnwInput200' type='text' id='txtTest1' name='txtTest1' value='some val' readonly>";

		var objCell = objRow.insertCell();
		objCell.innerHTML = "<input class='mnwInput200' type='text' id='txtTest2' name='txtTest2' value='some val' readonly>";
		objCell = "";
		objRow = ""


Basically I want to also add this JS control in another cell on the end. Normally to add this control to the page you would just declare it like so:

var calInServiceDate = new ctlSpiffyCalendarBox("calInServiceDate", "frmMain", "datInServiceDate","btnInServiceDate","<%=Date()%>");


Then the markup is just:

dynamically change the background image of a


I have created an asp.net website using visual studio express 2008.  I am having trouble mapping a path to my image folder from other files in the website.

My image folder's path is http://localhost/Cafeteria/Image/MyImage.gif

My aspx page that I want to map from is http://localhost/Cafeteria/Submeals/burgers.aspx

In my /burgers.aspx I have the following code:


<asp:content id="Content1" contentplaceholderid="Main" runat="server"><

Image Color Change Dynamically on the fly, is it possible?


Hey All,

I have created an aspx page that is displaying user profiles, and on that page I have an asp.net image control that I dynamically populate at runtime based on the users profile image.

I have created several themes, just modifying css to display the profiles with different background and different layouts.

For fun I have created one theme that is kind of like the matrix, and I would like to be able to take the users profile image and change it to a 'green scale' so to speak, or even just a straight up green color, more so this one #20f380. The profile images are just jpg, and are already cartoonish so they should change to green without the image looking to bad.

Is there a way to use code behind to change an image's colors?

C# or VB is fine, currently I've not been able to find any tutorials that work for me, or are close to what I am trying to do.

Send Image via Javascript


I am trying to accomplish the following with javascript and .NET:

I have two websites.

When a user is surfing website A, the user sees a picture of a fat lady. When he clicked on the picture, the image is sent (via javascript) to website B.

Website B is running .NET, and the image must be sent directly from the client (not from website A).

Is this possible?

How to dynamically populate a ComboBox through client-side Javascript?


I'm using the ComboBox control from the May 2009 release of the ASP.NET Ajax Control Toolkit.

I'd like to try and populate this ComboBox's list of options dynamically from the client-side Javascript (because I'm retrieving the data from the server based on the user's selection in another drop-down box).  Can anyone suggest how to accomplish this?  I tried this:


                var teacherComboBox = document.getElementById("ctl00_ContentPlaceHolder1_TeacherComboBox_OptionList");
                teacherComboBox.innerHTML = "";
                for (var i = 0 ; i < result.length ; i++) {
                    var listitem = document.createElement("li");
                    listitem.innerHTML = result[i];


And it didn't work.  The ComboBox just ended up with just one item (the first one) in the list, instead of all of them.

Any help appreciated.


Reference Dynamically Created JavaScript File


I would like to dynamically create, and reference, entirely different JavaScript files based on an id.  This is the route I've taken, and it appears to be working.  I guess I'm just curious if there's something obvious I'm missing, or if anybody has a better idea.

On the web page a reference points to what i'm calling a "javascript handler". 

<script type="text/javascript" src="http://localhost:50869/JsHandler.ashx?Id=0001"></script>


I may eventually experiment with routing to make the reference look like this...

<script type="text/javascript" src="http://localhost:50869/js/0001"></script>


But that's besides the point.  Please keep in mind, the following example is very simple and could be accomplished in easier ways.  Its more of a proof of concept, and I will be creating completely different JS files, from begining to end, depending on the Id passed in.

So yeah basically the logic in my JavaScript handler looks like this

var Id = context.Request["Id"];
            using (var sr = new StreamReader("/Forms/0001.js"))
                var chingy = E

JavaScript Panning on ASP Image


Hey guys,

got a little problem here. I tried to implement some javascript, which should add some client side functionality to an ASP Image component. Actually this image component is one of the DevExpress component, called "AspxBinaryImage". It's just a little modified ASP Image, with some more CSS and stuff, but the base is still just HTML and many lines of JavaScript.

Okay now to my problem: I tried to implement a panning on this image. If I leave out any type of ASP components and just name the site to an simple HTML page, there is no problem with the IE, but Mozilla doens't work at all. If I try to use this JavaScript in an ASP Page context, nothing works at all.

I found this: http://stackoverflow.com/questions/2463739/panning-image-using-javascript-in-asp-net-page-overflows-div and adapted many parts of it into my functions. I also tried the "customizing" in one of the responses, but it didn't work. Actually the JavaScript console of Firefox, as well as the FireBug console doesn't seem to find any mistakes, conflicts or problems in source.

Here is my complete Code of the ASP page which doesn't work in any browser:

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend