Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Dynamic Creation of aweb page at runtime

Dynamic Creation of aweb page at runtime

Scheduled Pinned Locked Moved ASP.NET
databasehelp
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    raj420
    wrote on last edited by
    #1

    I am planning to create a web page for a work of mine. The various components to be loaded are saved in a database. The page on load should get the components from the database,and on load shoud generate the components. All the controles are listed on the database... Please someone help

    S 1 Reply Last reply
    0
    • R raj420

      I am planning to create a web page for a work of mine. The various components to be loaded are saved in a database. The page on load should get the components from the database,and on load shoud generate the components. All the controles are listed on the database... Please someone help

      S Offline
      S Offline
      Sketchy Steve
      wrote on last edited by
      #2

      The way this is normally done is by creating an ASPX (equiv to HTML) page and placing webcontrols onto it like so... Image Alt : Image : < asp:image id="imgImage" runat="server"/> Then populating them in code behind using the page_load event (which is fired when the page is loaded) check if this is the first time the page has been loaded (using IsPostBack), if it is then fill out the fields using a database query like the one shown below - if not dont bother as asp.nets view state will make most info persistant. It would help if you were more specific, what i've put down here may well confuse you more than it will help but I hope it will point you in the right direction. Sounds like you could do with reading a few basic tutorials - try them (theres some good ones on 4 guys frm rolla, this one will give you all the basics too http://www.w3schools.com/aspnet/default.asp[^], there also some right here on code project ;) protected void Page_Load(Object sender, EventArgs e) { CheckUserLoggedIn(); mySQLConnection.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]; mySQLCommand.Connection = mySQLConnection; if (!IsPostBack){ mySQLCommand.CommandText = "SELECT * FROM tblKnowledgeBase WHERE [ID] ='"+ tbArticleID.Text +"'"; ; mySQLConnection.Open(); mySQLDataReader = mySQLCommand.ExecuteReader(); while (mySQLDataReader.Read()){ tbTitle.Text = mySQLDataReader.GetString(3); tbText.Text = mySQLDataReader.GetString(4); if (mySQLDataReader.GetString(5) != ""){ imgImage.ImageUrl = "Uploads/" + mySQLDataReader.GetString(5); } }// End If !PostBack

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups