Usability issues:
The third way to add an event is, yup you guessed it, from the add new event page! Clicking on add new event when one is adding a new event is not only from the Department of Redundancy Department, but also throws and error. Not sure why the add new event
division is included on the Events_Edit page in the first place but I just removed the <div></div> starting on line 75 of my Events_Edit page.
When logging out, nothing happens visually to say you're logged out. Clicking on another link / button will show that one is logged out but that is insufficient. I added a response.redirect to Default.aspx to provide the user with a visible confirmation that
they were logged out. An easy fix that, thanks to login banner, required only two corrections to provide the same behavior for all logout buttons (the second response.redirect is on the login page displayed on Default.aspx).
I agreed with the RequiredValidator as a quick fix to prevent adding an event or an announcement (news item) without also requiring a description. However, that prevented the Cancel button from working. It also didn't fit with the database as the description
field allowed Null entries. So, I changed the inline code in Events_List.aspx, News_List.aspx, Events_Calendar.aspx, and Default.aspx to use the DataBinder rather than converting to string (after getting some great advice from my buddy Mike). I also modified
the Shared_routines.vb truncate functions. Here is the original line from each of the four web pages:
We then changed the truncate function to accept an object data type rather than string.
Public Function truncate(ByVal originalInput As String) As String
to:
Public Function truncate(ByVal originalInput As Object) As String
and I promptly got an error message. After debugging, I found that the object I was passing (when the description wasn't added) was still null rather than empty "" and I still had the same error. I then added a try-catch-end try before passing the output
to the second truncate function. The new truncate functions look like this:
Public Module Shared_Routines
Const TRUNCATE_COUNT As Integer = 50
Public Function truncate(ByVal originalInput As Object) As String
Try
Dim originalInput1 As String = CStr(originalInput)
Return truncate(originalInput1, TRUNCATE_COUNT)
Catch
Return ""
End Try
End Function
Public Function truncate(ByVal originalInput As String, ByVal wordsLimit As Integer) As String
If Not originalInput Is Nothing AndAlso originalInput <> "" Then
Dim output As New Text.StringBuilder(originalInput.Length)
Dim input As New Text.StringBuilder(originalInput)
Dim words As Integer = 0
Dim lastwasWS As Boolean = True
Dim count As Integer = 0
Do
If Char.IsWhiteSpace(input.Chars(count)) Then
lastwasWS = True
Else
If lastwasWS Then words += 1
lastwasWS = False
End If
output.Append(input.Chars(count))
count += 1
Loop While (words < wordsLimit Or lastwasWS = False) And count < (originalInput.Length)
Return output.ToString
Else
Return ""
End If
End Function
Public Function Encode(ByVal contents As Object) As String
Return HttpUtility.HtmlEncode(CStr(contents))
End Function
What happens is that the first truncate function attempts to convert the description to string and, if Null, returns empty "". If not Null, then the converted string value is passed (along with the word count) to the second function where it counts and adds
each character until the 50 word limit is reached; then it passes that value back to the page for display. The second function's check for Null should never evaluate true but I left it in just in case. I also tried to combine the two functions into one but
VB threw a compile error.
An interesting property of the button control, or any control that causes postback(I think) is the "causes validation" property. You can set the causes validation property of the Cancel button to false and use the navigate url property to redirect when
the user presses the cancel button. Setting the causes validation property to false for the cancel button results in the page parse without evaluating the validation controls on the page. Then you can redirect back to where the user came from ( or where
ever you like) using the navigate url property. This allows you to use the required field validator, and other validation controls, on the page and still use a cancel button as well.
It has occurred to me that a user may want to enter only an event title without a description and in this case your solution is best. However, in the announcement(news item) I prefer to force the user to enter a description. What good is only a news heading
without any news.
junck --
All human actions have one or more of these seven causes: chance, nature, compulsion, habit, reason, passion, and desire.
Aristotle Greek critic, philosopher, physicist(384 BC - 322 BC)
I'm new to html and asp.net so could you please detail for me where and how I should best fix this? I'm using Visual Web Developer 2005 Express. Does it require implementation
of RequiredFieldValidator fields as per your post above? If so, do I just add the code right there in
Events_List.aspx, or is there a more appropriate place?
By using the RequiredFieldValidator in the Events_Edit.aspx page you prevent the Administrators to leave the description field empty, so you don't have problems in other pages like Events_View.aspx or Events_List.aspx.
Below you can see my InsertItemTemplate for the Events_Edit.aspx page, including the RequiredFieldValidators.
cougar6
Member
20 Points
4 Posts
Re: Identified bugs and fixes for the ClubSite Starter kit
Aug 05, 2006 07:29 AM|LINK
The third way to add an event is, yup you guessed it, from the add new event page! Clicking on add new event when one is adding a new event is not only from the Department of Redundancy Department, but also throws and error. Not sure why the add new event division is included on the Events_Edit page in the first place but I just removed the <div></div> starting on line 75 of my Events_Edit page.
When logging out, nothing happens visually to say you're logged out. Clicking on another link / button will show that one is logged out but that is insufficient. I added a response.redirect to Default.aspx to provide the user with a visible confirmation that they were logged out. An easy fix that, thanks to login banner, required only two corrections to provide the same behavior for all logout buttons (the second response.redirect is on the login page displayed on Default.aspx).
cougar6
Member
20 Points
4 Posts
Re: Identified bugs and fixes for the ClubSite Starter kit
Aug 08, 2006 02:10 AM|LINK
<%# truncate(CStr(Eval("description"))) %>'
and Mike had me change it to:
<%# truncate(DataBinder.Eval(Container.DataItem, "description")) %>'
We then changed the truncate function to accept an object data type rather than string.
Public Function truncate(ByVal originalInput As String) As String
to:
Public Function truncate(ByVal originalInput As Object) As String
and I promptly got an error message. After debugging, I found that the object I was passing (when the description wasn't added) was still null rather than empty "" and I still had the same error. I then added a try-catch-end try before passing the output to the second truncate function. The new truncate functions look like this:
Public Module Shared_Routines
Const TRUNCATE_COUNT As Integer = 50
Public Function truncate(ByVal originalInput As Object) As String
Try
Dim originalInput1 As String = CStr(originalInput)
Return truncate(originalInput1, TRUNCATE_COUNT)
Catch
Return ""
End Try
End Function
Public Function truncate(ByVal originalInput As String, ByVal wordsLimit As Integer) As String
If Not originalInput Is Nothing AndAlso originalInput <> "" Then
Dim output As New Text.StringBuilder(originalInput.Length)
Dim input As New Text.StringBuilder(originalInput)
Dim words As Integer = 0
Dim lastwasWS As Boolean = True
Dim count As Integer = 0
Do
If Char.IsWhiteSpace(input.Chars(count)) Then
lastwasWS = True
Else
If lastwasWS Then words += 1
lastwasWS = False
End If
output.Append(input.Chars(count))
count += 1
Loop While (words < wordsLimit Or lastwasWS = False) And count < (originalInput.Length)
Return output.ToString
Else
Return ""
End If
End Function
Public Function Encode(ByVal contents As Object) As String
Return HttpUtility.HtmlEncode(CStr(contents))
End Function
What happens is that the first truncate function attempts to convert the description to string and, if Null, returns empty "". If not Null, then the converted string value is passed (along with the word count) to the second function where it counts and adds each character until the 50 word limit is reached; then it passes that value back to the page for display. The second function's check for Null should never evaluate true but I left it in just in case. I also tried to combine the two functions into one but VB threw a compile error.
cougar6
Member
20 Points
4 Posts
Re: Identified bugs and fixes for the ClubSite Starter kit
Aug 08, 2006 02:14 AM|LINK
junck
Member
60 Points
12 Posts
Re: Identified bugs and fixes for the ClubSite Starter kit
Aug 08, 2006 03:37 AM|LINK
Nice looking code. I like the word count routine.
An interesting property of the button control, or any control that causes postback(I think) is the "causes validation" property. You can set the causes validation property of the Cancel button to false and use the navigate url property to redirect when the user presses the cancel button. Setting the causes validation property to false for the cancel button results in the page parse without evaluating the validation controls on the page. Then you can redirect back to where the user came from ( or where ever you like) using the navigate url property. This allows you to use the required field validator, and other validation controls, on the page and still use a cancel button as well.
It has occurred to me that a user may want to enter only an event title without a description and in this case your solution is best. However, in the announcement(news item) I prefer to force the user to enter a description. What good is only a news heading without any news.
All human actions have one or more of these seven causes: chance, nature, compulsion, habit, reason, passion, and desire.
Aristotle Greek critic, philosopher, physicist(384 BC - 322 BC)
hmeijeri
Member
10 Points
2 Posts
Re: Identified bugs and fixes for the ClubSite Starter kit
Aug 15, 2006 10:49 AM|LINK
Hi Limmer,
The following (line 130 in Events_List.aspx) also causes problem - it can't convert the Eval result (a System.DBNull type) to a string.
<
asp:Label ID="descriptionLabel" runat="server" Text='<%# SharedRoutines.truncate((string)Eval("description")) %>' />I'm new to html and asp.net so could you please detail for me where and how I should best fix this? I'm using Visual Web Developer 2005 Express. Does it require implementation of RequiredFieldValidator fields as per your post above? If so, do I just add the code right there in Events_List.aspx, or is there a more appropriate place?
Cheers, hmeijeri.
Limmer
Member
40 Points
11 Posts
Re: Identified bugs and fixes for the ClubSite Starter kit
Aug 15, 2006 12:39 PM|LINK
Hi hmeijeri,
By using the RequiredFieldValidator in the Events_Edit.aspx page you prevent the Administrators to leave the description field empty, so you don't have problems in other pages like Events_View.aspx or Events_List.aspx.
<InsertItemTemplate>Below you can see my InsertItemTemplate for the Events_Edit.aspx page, including the RequiredFieldValidators.
Limmer
<div class="actionbuttons">
<Club:RolloverButton ID="GreenRolloverButton2" CommandName="Insert" Text="Toevoegen" runat="server" />
<Club:RolloverLink ID="GreenRolloverLink1" Text="Annuleren" runat="server" NavigateURL='<%# "Events_calendar.aspx" %>' CausesValidation="false" />
</div>
<div class="dashedline">
</div>
<asp:ValidationSummary ID="valSummary" runat="server" ShowMessageBox="true" ShowSummary="false" HeaderText="The following fields are mandatory:" />
<table>
<tr>
<td class="formlabel">
<asp:Label ID="lblTitle" runat="server" Text="Titel:" />
<asp:RequiredFieldValidator ID="valTitle" runat="server" ErrorMessage="title" ControlToValidate="txtTitle" Text="*" />
</td>
<td align="left">
<asp:TextBox ID="txtTitle" runat="server" Width="500px" Text='<%# Bind("title") %>' />
</td>
</tr>
<tr>
<td class="formlabel">
<asp:Label ID="lblDescription" runat="server" Text="Description:" />
<asp:RequiredFieldValidator ID="valDescription" runat="server" ErrorMessage="description" ControlToValidate="txtDescription" Text="*" />
</td>
<td align="left">
<asp:TextBox Text='<%# Bind("description") %>' runat="server" ID="txtDescription" Rows="10" TextMode="MultiLine" Width="500px" Height="166px" MaxLength="1000" />
</td>
</tr>
<tr>
<td class="formlabel">
<asp:Label ID="lblDate" runat="server" Text="Date:" />
</td>
<td align="left">
<Club:Durationpicker ID="dtpicker" runat="server" startDateTime='<%#Bind("Starttime") %>' endDateTime='<%#Bind("endtime") %>' />
</td>
</tr>
<tr>
<td class="formlabel">
<asp:Label ID="lblPhoto" runat="server" Text="Photo:" /></td>
<td align="left">
<Club:Photopicker ID="Photopicker1" runat="server" ImageId='<%# Bind("photo") %>' />
</td>
</tr>
</table>
<div class="dashedline">
</div>
<div class="actionbuttons">
<Club:RolloverButton ID="apply1" CommandName="Insert" Text="Save" runat="server" />
<Club:RolloverLink ID="Cancel" Text="Cancel" runat="server" NavigateURL='<%# "Events_calendar.aspx" %>' CausesValidation="false" />
</div>
</InsertItemTemplate>
hmeijeri
Member
10 Points
2 Posts
Re: Identified bugs and fixes for the ClubSite Starter kit
Aug 15, 2006 01:21 PM|LINK
sqlm002
Member
70 Points
14 Posts
Re: Identified bugs and fixes for the ClubSite Starter kit
Aug 30, 2006 05:18 AM|LINK
1) "Login in an Admin role and add a new Event"
How do I add a new Event? from here...
2) Because U have no Albums the Album combo-box is empty. Let it be so.
Should I delete all the Photo_News under images folder?
I just start to work on this Clubsite and I am a newbie with ASP.NET 2.0, and I found your guys posted are awesome... I learned a lot!!
Thanks
sqlm002
sqlm002
Member
70 Points
14 Posts
Re: Bug #6 Erratic Prev/Next links in News_view
Aug 30, 2006 06:20 AM|LINK
Have anyone translated bug# 6 from C# to Vb.Net? If you do have it please e-mail me the script..I am appreciate very much.
Thanks
sqlm002
Member
70 Points
14 Posts
Re: Image scaling algorithm incorrect
Aug 31, 2006 05:13 AM|LINK
Hello this is Sqlm002
The original "scale = iOriginal.Width / maxwidth;" work fine for me. :)