Jump to content

duplicated code | help


mr.abuasbe
 Share

Recommended Posts

hi,
i have this key on the client side (asp.net)

    function newContent()
     {
         var a = <%=rowCounter%>;
         for (i = 0; i < a; i++) {               
    
         document.write('<div class="col-sm-6 col-md-4">');
         document.write('<div class="thumbnail">');
         document.write('<img src="<%= array[0,2]%>" alt="..."/>');
         document.write('<div class="caption">');
         document.write('<h3 class="d-text"><%= array[0,1]%></h3>');
         document.write('<p class="d-text"><%= array[0,3]%></p>');

         document.write('</div>');
         document.write('</div>');
         document.write('</div>');    
         }
     }

but to make the loop work with the variables i need to move the code to server side,
so how can i use document.write() on the server side ?

thanks a lot

Edited by mr.abuasbe
Link to comment
Share on other sites

thanks for your help ..

now response didn't work for me ..

i used this way :
i created div (rowdg) and wrote in the div from the server side

        for (int i = 0; i < rowCounter; i++) {  
        rowdg.InnerHtml += "<div class="+'"'+ "col-sm-6 col-md-4" +'"'+ ">";
        rowdg.InnerHtml += "<div class=" + '"' + "thumbnail" + '"'+ "style="+'"'+ "height:400px" + '"'+  ">";
        rowdg.InnerHtml += "<img src=" + '"' + array[i, 2] + '"' + "height="+'"'+"225"+'"'+"width="+'"'+ "225" +'"' + "/>";
        rowdg.InnerHtml += "<div class=" + '"' + "caption" + '"' + ">";
        rowdg.InnerHtml += "<h3 class=" + '"' + "d-text" + '"' + ">" + array[i, 1] + "</h3>";
        rowdg.InnerHtml += "<p class=" + '"' + "d-text" + '"' + ">" + array[i, 3] + "</p>";
        rowdg.InnerHtml += "<p class=" + '"' + "=text-center" + '"' + "><a href = " + '"' + array[i;
        rowdg.InnerHtml += "</div>";
        rowdg.InnerHtml += "</div>";
        rowdg.InnerHtml += "</div>";   
        }
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...