troubleshooting Question

How do you programmatically lput things into the Content Place holder from C# in an ASP.net page?

Avatar of VBBRett
VBBRett asked on
C#
10 Comments1 Solution889 ViewsLast Modified:
Hello.  I am trying to make things load in the "Slave" contentplaceholder section in an asp.net page that has a Master page.  The content is being loaded dynamically and that is why I am doing it the way I am doing it.  Below is the code that I have in the C# section and I have not touched the html side of the page.  Please let me know how I can program things into the contentplaceholder area of the web page and not above this and above the master page.  It appears as if the pictures that I have programmed to be loaded onto the page appear above the whole master/slave page.  Please tell me how I can get things to load inside the contentplaceholder.  thanks!

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
 
public partial class Internationalhotbedhome : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DAL.DAL intlhotbedimage = new DAL.DAL();
            DataTable dt;
            //dt = example
            dt = intlhotbedimage.IntlHotBedImageById(1);
 
            
            {                
 
                
                foreach (DataRow dr in dt.Rows)
                {
                    
                        
                        string x = (string)dr[2].ToString();
                        Response.Write("<img src=");
                        Response.Write(Server.HtmlEncode("'"));
                        Response.Write("images/hotbedintl/");
                        Response.Write(x);
                        Response.Write(Server.HtmlEncode("'"));
                        Response.Write(Server.HtmlEncode("/>"));
 
                                               
 
                        Response.Write("<br />");
                        string y = (string)dr[1].ToString();
                        Response.Write("<img src=");
                        Response.Write(Server.HtmlEncode("'"));
                        Response.Write("images/hotbedintl/");
                        Response.Write(y);
                        Response.Write(Server.HtmlEncode("'"));
                        Response.Write(Server.HtmlEncode("/>"));
                        Response.Write("<br />");                    
 
                }
                                            
     
            }
 
                                  
 
            
        }
 
    }
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros