Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

How to generate HTML and CSS dynamically in asp.net?

$
0
0

I am trying to integrate [this photo album]: http://youhack.me/demo/g%20plus%20photo/ in my asp.net website. I am selecting urls of 3 images from database and and displaying those 3 images from a particular album. Now the problem is that what if the user has multiple user? It should be able to generate as many Jquery albums on the page as there are in the database associated with that user.


<div class="image_stack" style="margin-left:300px" runat="server" ><img  id="photo1" class="stackphotos"  runat="server" clientidmode="static" ><img  id="photo2" class="stackphotos"  runat="server" clientidmode="static"><img   id="photo3" class="stackphotos"  runat="server" clientidmode="static" ></div>

 public DataTable dt = new DataTable();
    dboperation dbo = new dboperation();

    protected void Page_Load(object sender, EventArgs e)
    {

        string q = "select photourl ,AlbumName  from PhotoAlbum where UserId=42";
        dt = dbo.Getdt(q);
        string a = dt.Rows[0]["photourl"].ToString();
        string b = dt.Rows[1]["photourl"].ToString();
        string c = dt.Rows[2]["photourl"].ToString();

        photo1.Src = a.Substring(1, a.Length - 1);
        photo2.Src = b.Substring(1, b.Length - 1);
        photo3.Src = c.Substring(1, c.Length - 1);

        q = "  select PhotoAlbum.AlbumId,PhotoAlbum.AlbumName from PhotoAlbum where UserId=42";

         dt = dbo.Getdt(q);
         drpalbum.DataSource = dt;
         drpalbum.DataTextField = "albumname";
         drpalbum.DataValueField = "albumid";
         drpalbum.DataBind();
    }



Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>