locked
events calendar issue - image not showing RRS feed

  • Question

  • User1216627406 posted

    Greetings again mates,

    We  have calendar of events.

    If it is birthdate, show the title, color designated for birthday and birthdate image.

    The only thing showing is the title and nothing else.

    What am I doing wrong?

                    <ItemTemplate>
                        <a href='#' OnClick="javascript:window.open('admin/eventDetail.aspx?id=<%# Container.DataItem("EventID") %>','EventsDetail','width=800,height=600;toolbar=no;');" & ">                    
                            <img  alt="" src='images/<%# Container.DataItem("CategoryImage") %>' height="12" width="12" align="absmiddle" border="0" /><br />
                            <font color='<%# Container.DataItem("CategoryColor") %>'>
                                <%# Container.DataItem("EventTitle") %>
                            </font>
                        </a>            
                    </ItemTemplate>

    Saturday, May 14, 2016 1:58 AM

Answers

  • User-271186128 posted

    Hi simflex,

    According to your code, I create a sample using the following code, it seems that everything works well. I suggest you can use F12 developer tools to check the image src attribute.

     <a href='#' onclick="javascript:window.open('admin/eventDetail.aspx?id=<%# Eval("ID") %>','EventsDetail','width=800,height=600;toolbar=no;');" & ">                    
              <img  alt="" src='images/<%# Eval("CategoryImage") %>' height="12" width="12" border="0" /><br />
              <font color='<%# Eval("Name") %>'>
                                <%# Eval("Name") %>
                            </font>
     </a>     

    Code behind:

            protected void Page_Load(object sender, EventArgs e)
            {
                DataTable dt1 = new DataTable();
                dt1.Columns.AddRange(new DataColumn[4] { new DataColumn("Id", typeof(int)),
                            new DataColumn("Name", typeof(string)),
                            new DataColumn("Category",typeof(string)),
                            new DataColumn("CategoryImage", typeof(string))});
                dt1.Rows.Add(1, "John Hammond", "UnitedStates", "image1.png");
                dt1.Rows.Add(2, "Sam", "India", "image2.png");
                dt1.Rows.Add(3, "Suzanne Mathews", "Russia", "image3.png");
                dt1.Rows.Add(4, "Robert Schidner", "Russia", "image4.png");
    
                GridView2.DataSource = dt1;
                GridView2.DataBind();
            }

    You can also try to use the following path:

    src='../Images/<%# Eval("CategoryImage") %>'

    Best regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 14, 2016 9:26 AM

All replies

  • User-271186128 posted

    Hi simflex,

    According to your code, I create a sample using the following code, it seems that everything works well. I suggest you can use F12 developer tools to check the image src attribute.

     <a href='#' onclick="javascript:window.open('admin/eventDetail.aspx?id=<%# Eval("ID") %>','EventsDetail','width=800,height=600;toolbar=no;');" & ">                    
              <img  alt="" src='images/<%# Eval("CategoryImage") %>' height="12" width="12" border="0" /><br />
              <font color='<%# Eval("Name") %>'>
                                <%# Eval("Name") %>
                            </font>
     </a>     

    Code behind:

            protected void Page_Load(object sender, EventArgs e)
            {
                DataTable dt1 = new DataTable();
                dt1.Columns.AddRange(new DataColumn[4] { new DataColumn("Id", typeof(int)),
                            new DataColumn("Name", typeof(string)),
                            new DataColumn("Category",typeof(string)),
                            new DataColumn("CategoryImage", typeof(string))});
                dt1.Rows.Add(1, "John Hammond", "UnitedStates", "image1.png");
                dt1.Rows.Add(2, "Sam", "India", "image2.png");
                dt1.Rows.Add(3, "Suzanne Mathews", "Russia", "image3.png");
                dt1.Rows.Add(4, "Robert Schidner", "Russia", "image4.png");
    
                GridView2.DataSource = dt1;
                GridView2.DataBind();
            }

    You can also try to use the following path:

    src='../Images/<%# Eval("CategoryImage") %>'

    Best regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 14, 2016 9:26 AM
  • User1216627406 posted

    Thank you very much.

    It is working well now.

    Tuesday, May 17, 2016 7:26 PM