radhakrishan
asked on
Calendar Trouble
Hello Experts,
I am designing a calendar and one thing is troubling me big time.
My day render is quiet simple, picking data from a datatable and then creating the hyperlinks.
Now, when the hyperlinks are created the text goes on two lines if the number of characters are more than 13, even though it could easily fit about 30 characters
as I can see.
Can anyone pls tell why this thing is happening, and why not text is on single line when it could be.
Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls. DayRenderE ventArgs) Handles Calendar1.DayRender
Dim datarow1 As DataRow()
datarow1 = Bookings1.Select( _
String.Format("Dateto>= #{0}# AND Dateto <#{1}# AND DayDifference = 0", _
e.Day.Date.ToLongDateStrin g(), e.Day.Date.AddDays(1).ToLo ngDateStri ng(), e.Day.Date.AddDays(2).ToLo ngDateStri ng()))
For Each xlrow As DataRow In datarow1
If counter < 5 Then
Dim hyperLink As System.Web.UI.WebControls. HyperLink
hyperLink = New System.Web.UI.WebControls. HyperLink
With hyperLink
.ID = "myNewHyperLink"
.Text = "<BR>" + "Nitin Sharma trying 1"
.NavigateUrl = "javascript:window.open('B ookingPage .aspx?@id= " & xlrow.Item(8) & "&@cid=" & Trim(DropDownList1.Selecte dValue) & "&@ctext=" & Trim(DropDownList1.Selecte dItem.Text ) & "','newBookingPage', 'width=500,height=370, status=no toolbar=no');void(0);"
.ToolTip = Trim(xlrow.Item(0)) + Trim(xlrow.Item(4)) + " - " + Trim(xlrow.Item(5))
End With
e.Cell.Controls.Add(hyperL ink)
End If
e.Cell.BackColor = Color.Aqua
Next
End Sub
I am designing a calendar and one thing is troubling me big time.
My day render is quiet simple, picking data from a datatable and then creating the hyperlinks.
Now, when the hyperlinks are created the text goes on two lines if the number of characters are more than 13, even though it could easily fit about 30 characters
as I can see.
Can anyone pls tell why this thing is happening, and why not text is on single line when it could be.
Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.
Dim datarow1 As DataRow()
datarow1 = Bookings1.Select( _
String.Format("Dateto>= #{0}# AND Dateto <#{1}# AND DayDifference = 0", _
e.Day.Date.ToLongDateStrin
For Each xlrow As DataRow In datarow1
If counter < 5 Then
Dim hyperLink As System.Web.UI.WebControls.
hyperLink = New System.Web.UI.WebControls.
With hyperLink
.ID = "myNewHyperLink"
.Text = "<BR>" + "Nitin Sharma trying 1"
.NavigateUrl = "javascript:window.open('B
.ToolTip = Trim(xlrow.Item(0)) + Trim(xlrow.Item(4)) + " - " + Trim(xlrow.Item(5))
End With
e.Cell.Controls.Add(hyperL
End If
e.Cell.BackColor = Color.Aqua
Next
End Sub
ASKER
Hi Ramuncikas,
I tried it but it still exactly the same problem, rather doing that the spacing between two lines always increases.
I tried it but it still exactly the same problem, rather doing that the spacing between two lines always increases.
Could you post Page source (a hyperlink part only) from a browser please
ASKER
4</a><span> &nb sp; & nbsp;  ; &nb sp; & nbsp;</spa n>
<a id="newHyperLink" title="Complete View" href="javascript:window.sh owModalDia log('Dayde scription. aspx?@cid= 1&@did =04/07/200 6&@cte xt=Rooms&a mp;@dday=1 1/07/2006 00:00:00','', 'dialogHeight: 400px; dialogWidth: 650px; status:no; resizable: yes; edge: raised'); ">Expand</a>
<a id="newHyperLink" title="Room A 08:00-08:15" href="javascript:window.op en('Bookin gPage.aspx ?@id=86&am p;@cid=1&a mp;@ctext= Rooms','ne wBookingPa ge', 'width=500,height=420, status=no toolbar=no');void(0);">
<BR>Room A 08:00</a>
<a id="newHyperLink" title="Room A 09:00-21:30" href="javascript:window.op en('Bookin gPage.aspx ?@id=81&am p;@cid=1&a mp;@ctext= Rooms','ne wBookingPa ge', 'width=500,height=420, status=no toolbar=no');void(0);">
<BR>Room A 09:00</a>
<a id="newHyperLink" title="Complete View" href="javascript:window.sh
<a id="newHyperLink" title="Room A 08:00-08:15" href="javascript:window.op
<BR>Room A 08:00</a>
<a id="newHyperLink" title="Room A 09:00-21:30" href="javascript:window.op
<BR>Room A 09:00</a>
ASKER
If I change this from:
Room A 08:00
to
Room A 08:00 xxxxxxx
It would take it to next line and show like
Room A 08:00
xxxxxxx
Room A 08:00
to
Room A 08:00 xxxxxxx
It would take it to next line and show like
Room A 08:00
xxxxxxx
Add this:
With hyperLink
...
.BorderStyle = BorderStyle.Solid
.BorderWidth = 1
...
End with
and see how your hyperlink expands.
Calendar is rendered as a table and has default cellspacing and cellpadding set. Maybe it is worth to try to add a CSS file and override your calendars styles.
With hyperLink
...
.BorderStyle = BorderStyle.Solid
.BorderWidth = 1
...
End with
and see how your hyperlink expands.
Calendar is rendered as a table and has default cellspacing and cellpadding set. Maybe it is worth to try to add a CSS file and override your calendars styles.
I can point you towards a ready-made event-calendar.
http://www.codeproject.com/aspnet/MellDataCalendar.asp
I think it's in C#, but you don't need to do any real coding yourself.
Hope this helps.
http://www.codeproject.com/aspnet/MellDataCalendar.asp
I think it's in C#, but you don't need to do any real coding yourself.
Hope this helps.
ASKER
Hi,
I tried to do that thing and it still does not solve the problem.
I actually found the problem and its that in every cell a <td> is created and the height and width of that <td> is 100px if I remove that thing and make it a html page it works fine as i would expect everything coming on one line..
But because its system generated settings how can i actually make that not to happen?
I tried to do that thing and it still does not solve the problem.
I actually found the problem and its that in every cell a <td> is created and the height and width of that <td> is 100px if I remove that thing and make it a html page it works fine as i would expect everything coming on one line..
But because its system generated settings how can i actually make that not to happen?
Try removing the width value of a calendar.
ASKER
The trouble is I am not setting the width anywhere:
--Code:
<td title=" Toshiba Tec. 09:00 - 09:30" align="Left" valign="Top" onmouseover="onOverDay(thi s, '#FFE0C0');"
onmouseout="onOutDay(this) ;" style="background-color:#E 5E5EF;bord er-width:1 px;border- style:Soli d;height:1 00px;width :100px;">
<a href="javascript:__doPostB ack('Calen dar1','238 4')" style="color:Black">12</a>
<span> &n bsp; &nbs p; &n bsp; </span><a id="newHyperLink" title="Complete View" href="javascript:window.sh owModalDia log('Dayde scription. aspx?@cid= 2&@did =12/07/200 6&@cte xt=Laptops &@dday =13/07/200 6 00:00:00','', 'dialogHeight: 400px; dialogWidth: 650px; status:no; resizable: yes; edge: raised'); ">Expand</a>
<a id="newHyperLink" title="Toshiba Tec. 09:00-09:30" href="javascript:window.op en('Bookin gPage.aspx ?@id=131&a mp;@cid=2& amp;@ctext =Laptops', 'newBookin gPage', 'width=500,height=420, status=no toolbar=no');void(0);"><BR >Toshiba Tec. 09:00</a><span>*</span></t d>
If I dreamweaver I remove this from
<td title=" Toshiba Tec. 09:00 - 09:30" align="Left" valign="Top" onmouseover="onOverDay(thi s, '#FFE0C0');"
onmouseout="onOutDay(this) ;" style="background-color:#E 5E5EF;bord er-width:1 px;border- style:Soli d;height:1 00px;width :100px;">
to
<td title=" Toshiba Tec. 09:00 - 09:30" align="Left" valign="Top" onmouseover="onOverDay(thi s, '#FFE0C0');"
onmouseout="onOutDay(this) ;" style="background-color:#E 5E5EF;bord er-width:1 px;border- style:Soli d;">
It seems to work fine, and take it all the way down.
My style sheet for calendar looks like this:
<style>
.CalStyle { PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 8pt; PADDING-BOTTOM: 5px; WORD-SPACING: 0px; PADDING-TOP: 5px; FONT-FAMILY: Verdana; WHITE-SPACE: normal; LETTER-SPACING: -1px; CellPadding: "0"; CellSpacing: "1"; BorderColor: "Black" }
</style>
<asp:calendar id="Calendar1" style="Z-INDEX: 105; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server"
CssClass="CalStyle" Width="1232px" PrevMonthText="Backward" NextMonthText="Forward" Height="664px"
BorderColor="Black">
--Code:
<td title=" Toshiba Tec. 09:00 - 09:30" align="Left" valign="Top" onmouseover="onOverDay(thi
onmouseout="onOutDay(this)
<a href="javascript:__doPostB
<span> &n
<a id="newHyperLink" title="Toshiba Tec. 09:00-09:30" href="javascript:window.op
If I dreamweaver I remove this from
<td title=" Toshiba Tec. 09:00 - 09:30" align="Left" valign="Top" onmouseover="onOverDay(thi
onmouseout="onOutDay(this)
to
<td title=" Toshiba Tec. 09:00 - 09:30" align="Left" valign="Top" onmouseover="onOverDay(thi
onmouseout="onOutDay(this)
It seems to work fine, and take it all the way down.
My style sheet for calendar looks like this:
<style>
.CalStyle { PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: normal; FONT-SIZE: 8pt; PADDING-BOTTOM: 5px; WORD-SPACING: 0px; PADDING-TOP: 5px; FONT-FAMILY: Verdana; WHITE-SPACE: normal; LETTER-SPACING: -1px; CellPadding: "0"; CellSpacing: "1"; BorderColor: "Black" }
</style>
<asp:calendar id="Calendar1" style="Z-INDEX: 105; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server"
CssClass="CalStyle" Width="1232px" PrevMonthText="Backward" NextMonthText="Forward" Height="664px"
BorderColor="Black">
<asp:calendar id="Calendar1" style="Z-INDEX: 105; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server"
CssClass="CalStyle" Width="1232px" PrevMonthText="Backward" NextMonthText="Forward" Height="664px"
BorderColor="Black">
Width="1232px"??? See that?
CssClass="CalStyle" Width="1232px" PrevMonthText="Backward" NextMonthText="Forward" Height="664px"
BorderColor="Black">
Width="1232px"??? See that?
ASKER
Thats really the width to make the calendar display on complete page size.
If I remove that then still the problem exist, as the size is calendar is half the size set in that width...
But don't u know Calendar width and Cell Width ( <td> width) are two different things completely.
and when I can see from the calendar that it could easily fit that in but still its not able to do it...
<td title=" Toshiba Tec. 09:00 - 09:30" align="Left" valign="Top" onmouseover="onOverDay(thi s, '#FFE0C0');"
onmouseout="onOutDay(this) ;" style="background-color:#E 5E5EF;bord er-width:1 px;border- style:Soli d;height:1 00px;width :100px;">
What I don't understand is that where this
height:100px;width:100px; above is coming from, if I remove this then it seems to work.
If I remove that then still the problem exist, as the size is calendar is half the size set in that width...
But don't u know Calendar width and Cell Width ( <td> width) are two different things completely.
and when I can see from the calendar that it could easily fit that in but still its not able to do it...
<td title=" Toshiba Tec. 09:00 - 09:30" align="Left" valign="Top" onmouseover="onOverDay(thi
onmouseout="onOutDay(this)
What I don't understand is that where this
height:100px;width:100px; above is coming from, if I remove this then it seems to work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Fantastic,
Cheers matey I found the reason in Daystyle property i was setting that height and width to be 100px.
thanks for directing me in the rite way.
Much appreciated.
{I can ave lunch now! hehe}
Cheers matey I found the reason in Daystyle property i was setting that height and width to be 100px.
thanks for directing me in the rite way.
Much appreciated.
{I can ave lunch now! hehe}
...
.Width = New Web.UI.WebControls.Unit(10
...
End with