views:

706

answers:

3

Hi,

I want to strike off all the dates before today in a calendar control with an overlapping, red color x in ASP.NET. I can strikethru using the normal font strikethrough using the DayRender event. I can add an image but that sits adjacent to the date. I want the x (image) to overlap the date

Is this possible? If so, please help me how to go about it.

Thank you.

+1  A: 

Use CSS,

  1. Make the table cell position relative
  2. Make the image position absolute, top & left: 0

Update: The calendar control, like all ASP.NET control, outputs HTML. In this case it will output an HTML table, with a structure that looks something like this:

<table class="calendar_widget">
 <tr>
  <td>01</td>
  <td>02</td>
  <td>03</td>
  <td>04</td>
  <td>05</td>
  <td>06</td>
  <td>07</td>
 </tr>
 ....etc

The <td>, or table-cell as it's known, will contain the date and image you're inserting. You can use CSS to apply specific styles to the cell and image so that they are rendered differently.

My guess is your calendar's HTML with an image will look something like this:

<td><img src="x.gif" />01</td>

You can use a CSS stylesheet to apply the following styles:

table.calendar_widget td { 
  position: relative; 
}

table.calendar_widget td img { 
  position: absolute;
  left: 0;
  top: 0;
}

That's the basics of HTML - if this doesn't help I'd recommend tracking someone down familiar with front end development and getting their help.

Mike Robinson
A: 

Hi Mike,

Thank you for the response. Can you explain the table cell point a bit further? What table cell are you referring to? I have a calendar control on a web form. If possible, please drop a code snippet so I know exactly what you mean.

A: 

Hi Mike,

Thank you again for the update . I tried the CSS idea. It didnt work. The image doesnt overwrite the text. It still either sits on one of the sides of the date text. I m getting a feeling that this is probably not possible.

Sammy, it's possible, however at this point I think you should go find someone experienced with html/css.
Mike Robinson