Placing images programatically on page ASP.net Web application c# -


How can I take an image control programatically? In the asp.net web application on that page, I want to create 3 images with the program and some distance between them;

  int punctX = 50; Int punctY = 50; For (int y = 0; y & lt; 2; y ++) {System.Web.UI.WebControls.Image image = new system. Web.UI.WebControls.Image (); Image.ID = "coloere" + y.ToString ();   

- How to insert an image on the page? }

This is better if you can use any type of place holder to add your images Are there. In this example I am using an ASP.NET panel control. In the code behind it, you can set the property property with the same property.

  & lt;% @ page title = "home page" language = "c #" masterpagefile = "~ / Site.master" AutoEventWireup = "true" CodeBehind = "Default.aspx.cs "Inheritance =" stack overflow_2. default "%> & Lt; ASP: Content ID = "Header Content" Run = "Server" Content Placeholder ID = "Head Content" & gt; & Lt; / ASP: Content & gt; & Lt; Asp: Content ID = "BodyContent" runat = "server" ContentPlaceHolderID = "MainContent" & gt; & Lt; Asp: panel id = "pnlImages" runat = "server" & gt; & Lt; / Asp: Panel & gt; & Lt; / ASP: Content & gt;   

provided that you have such images

 Enter the image </ P> <p> </ p> <p> </ p> </ p> <p> You can do something like this (can not be a clean code, but you get this idea ) </ P> <pre> <code> using system; using System.Web.UI; namespace stack overflow_2 {public partial class _Default: System.Web.UI.Page {secure zero page_load (object sender, event event E) {if (! Page.IsPostBack) {double punctX = 10; double punctY = 10; double vacancy = 5; PNL g (Style = Stack.imgur .com / DmRr4.png "alt =" Enter image details here ">

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -