Dim DBConnection As SqlConnection
Dim DBCommand As SqlCommand
Dim DBReader As SqlDataReader
Dim SQLString As String
Dim PageSize As Integer = 4
Public IsAdmin As Boolean
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'-- Load array NewsIdList() with item numbers
Dim NewsIdList = New ArrayList()
DBConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString)
SQLString = "SELECT id, itemdate FROM Announcements " & _
"ORDER BY id DESC, itemdate DESC"
DBConnection.Open()
DBCommand = New SqlCommand(SQLString, DBConnection)
DBReader = DBCommand.ExecuteReader()
While DBReader.Read()
NewsIdList.Add(DBReader("id"))
End While
DBReader.Close()
DBConnection.Close()
NewsIdList.TrimToSize()
'-- Create Paging Buttons
Dim StartIndex As Integer
Dim EndIndex As Integer
Dim StartKey As String
Dim EndKey As String
Dim StartDate As DateTime
Dim i As Integer
StartIndex = 0
For i = 1 To Math.Ceiling(NewsIdList.Count / PageSize)
'-- Determine starting and ending array indexes
EndIndex = StartIndex + PageSize - 1
If EndIndex > NewsIdList.Count - 1 Then
EndIndex = NewsIdList.Count - 1
End If
'-- Create a button and assign to placeholder
Dim PageButton As Button
PageButton = New Button()
PageButton.Text = i
PageButton.ID = "P" & i
PageButton.CommandName = StartKey & "|" & EndKey
PageButton.Style("width") = "20px"
PageButton.Style("background-color") = "#F0F0F0"
AddHandler PageButton.Command, AddressOf DisplayRepeater
PageButtons.Controls.Add(PageButton)
StartIndex += PageSize
Next
If Not Page.IsPostBack Then
Dim FirstButton As Button
FirstButton = CType(PageButtons.FindControl("P1"), Button)
FirstButton.Style("background-color") = "#990000"
FirstButton.Style("color") = "#FFFFFF"
End If
End Sub
Sub Fill()
Dim DBConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString)
SQLString = "SELECT Top " & PageSize & _
" id, itemdate, title, description, photo FROM Announcements " & _
"ORDER BY itemdate DESC, id DESC"
DBConnection.Open()
DBCommand = New SqlCommand(SQLString, DBConnection)
DBReader = DBCommand.ExecuteReader()
NewsRepeater.DataSource = DBReader
NewsRepeater.DataBind()
DBReader.Close()
DBConnection.Close()
End Sub
Sub DisplayRepeater(ByVal Src As Object, ByVal Args As CommandEventArgs)
Dim Keys() As String
Keys = Split(Args.CommandName, "|")
'-- Bind the Repeater
DBConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString)
DBConnection.Open()
SQLString = "SELECT id, itemdate, title, description, photo FROM Announcements WHERE " & _
"id >= '" & Keys(1) & "' AND " & _
"id <= '" & Keys(0) & "' " & _
"ORDER BY id DESC, itemdate DESC"
DBCommand = New SqlCommand(SQLString, DBConnection)
DBReader = DBCommand.ExecuteReader()
NewsRepeater.DataSource = DBReader
NewsRepeater.DataBind()
DBReader.Close()
DBConnection.Close()
'-- Highlight clicked button
Dim Item As Button
Dim ThisButton As Button
For Each Item In PageButtons.Controls
ThisButton = CType(Item, Button)
ThisButton.Style("background-color") = "#F0F0F0"
ThisButton.Style("color") = "#000000"
Next
ThisButton = CType(PageButtons.FindControl(Src.id), Button)
ThisButton.Style("background-color") = "#990000"
ThisButton.Style("color") = "#FFFFFF"
End Sub
End Class
You can download this at aspsksolutions.com, of course I posted it here as well.
I quote "A web-based bug/issue tracker written using ASP.NET and C#. Requires SQL Server or MSDE. Easy to install and learn how to use, but there's power if you need it. Probably has all the features you want. Nice integration with email."
ASP.NET, C#, SQL !!! extending it should be a breeze...[8-|]
It's supposedly Production/Stable &
GNU General Public License (GPL) open source so any enhancements /upgrades (along with your reputation) will effectively reach a wider audience (current/future downloaders) as the market-branding already exists. [cool]
Think of it as another Strater Kit !!![;)]
Caveat: BugTracker.NET is just my uninformed suggestion. Not responsible for any future outcome Good or Bad, including acts of Nature.[Angel]
"Our truest life is when we are in dreams awake." - Henry David Thoreau
I just started uploading the bug tracker.net to my test site, unbelieveably slow ftp but i will let you know when i get it running, So you can check it out.
I really hope I did not miss the solution for this one, but I tried to find posts about it and did not succeed.
If it's already been delt with.....Sorry
When you simply hit the upload_image button in Member_details with no image selected:
Parameter is not valid.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Parameter is not valid.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
Just found this one when looking at mr. Lunch's forum, thought the new code was the culprit at first. To be sure I started with a fresh CWS, and the problem was already there.
Sorry for the empty error page in the previous post (forgot it was fresh from the Template)
Parameter is not valid.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Parameter is not valid.
Source Error:
Line 57:
Line 58: Protected Sub uploadimage_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Line 59: Dim thumbimage As Byte() = ImageUtils.MakeThumb(newavatar.FileBytes, 69, 69)
Line 60: Dim m As New DataSetTableAdapters.MemberInfo1TableAdapter
Line 61: Dim memberid As Guid = CType(Membership.GetUser().ProviderUserKey, Guid)
Protected Sub uploadimage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Try
' next line errors if no image uploaded
Dim thumbimage As Byte() = ImageUtils.MakeThumb(newavatar.FileBytes, 69, 69)
Dim m As New DataSetTableAdapters.MemberInfo1TableAdapter
Dim memberid As Guid = CType(Membership.GetUser().ProviderUserKey, Guid)
Dim origid As Guid = memberid
m.Update(memberid, thumbimage, origid)
avatarimage.ImageUrl = "AvatarImagefetch.ashx?Memberid=" & memberid.ToString Catch ex As Exception
' maybe enable an error message label here
Return
End Try
End Sub
Could it be that with your AvatarImageFetch.ashx (bundled with the Forum) the Avatar is not immediately updated in Member_details?
No, but my version does set an expires header, I think to 10 minutes. I have this thing about *making* the browser cache stuff. But that's not good here, because that'll make it look like the upload failed when it's actually OK but the browser is showing
you the previous image. You can just take out that line where it sets Expires.
aabruzzese
Contributor
2806 Points
759 Posts
Re: locations_list.aspx bad event wireup
Apr 20, 2006 06:00 PM|LINK
Hi, actually I was refering the the news_list.aspx
http://67.164.255.166:8029/news_list.aspx
I found that the Paging was not working once there was more than 10 news(announcements) in the db.
Here is the fix I implemented after reviewing several examples and tutorials available out on the web.
This is the News_List.aspx Page:
<%@ Page Language="VB" MasterPageFile="~/Default.master" AutoEventWireup="false" CodeFile="News_List.aspx.vb" Inherits="News_List" Title="News Articles" %>
<%@ Register TagPrefix="Club" Namespace="ClubSite" %>
<%@ Register TagPrefix="Club" TagName="LoginBanner" Src="LoginBanner.ascx" %>
<%@ Register TagPrefix="Club" TagName="ImageThumbnail" Src="ImageThumbnail.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="body">
<Club:LoginBanner ID="LoginBanner1" runat="server" />
<!--
Left column
-->
<div id="columnleft">
<a name="content_start" id="content_start"></a>
<div class="leftblock">
<h2>
News Articles</h2>
<p>
Keep current on news and events for Check Raise Inc.
Recaps of our exciting events and tournaments are regularly posted here and any major events/site upgrades will be reported here as well.
</p>
</div>
</div>
<!--
Right column
-->
<div id="columnright">
<div class="rightblock">
<asp:panel ID=panel1 runat=server cssclass="actionbuttons">
<Club:RolloverLink ID="RemoveBtn" runat="server" Text="Add new Article" NavigateURL="News_Edit.aspx?Action=New" />
</asp:panel>
<div class="dashedline">
</div>
<!-- begin news item -->
<asp:Repeater ID="NewsRepeater" runat="server" >
<ItemTemplate>
<div class="listitem">
<div class="thumbnail">
<a href='<%# "News_View.aspx?Articleid=" &Cstr( Eval("ID"))%>'>
<Club:ImageThumbnail ID="ImageThumbnail1" runat="server" PhotoID='<%# Eval("photo") %>'
NoPhotoImg="images/news.jpg" />
</a>
</div>
<asp:panel ID=panel2 runat=server Visible='<%#IsAdmin %>'>
<Club:RolloverLink ID="EditBtn" runat="server" Text="Edit" NavigateURL='<%# "News_Edit.aspx?Action=Edit&ArticleID=" & Cstr( Eval("ID")) %>' />
<Club:RolloverLink ID="RemoveBtn" runat="server" Text="Remove" NavigateURL='<%# "News_Edit.aspx?Action=Remove&ArticleID=" & Cstr( Eval("ID")) %>' />
</asp:panel>
<h3>
<asp:Label ID="itemdateLabel" runat="server" Text='<%# Eval("itemdate","{0:d}") %>' />
<a href='<%# "news_view.aspx?articleid=" &Cstr( Eval("ID"))%>'>
<asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' />
</a>
</h3>
<p>
<asp:Label ID="descriptionLabel" runat="server" Text='<%# truncate(CStr(Eval("description"))) %>' />
<a href='<%# "news_view.aspx?articleid=" &Cstr( Eval("ID"))%>'>read more »</a></p>
<div class="clearlist">
</div>
</div>
</ItemTemplate>
</asp:Repeater>
<div class="dashedline"></div>
<div class="newscrumbs">
Page: <asp:PlaceHolder id="PageButtons" runat="server"/>
</div>
</div>
</div>
<div class="clear2column"></div>
</div>
</asp:Content>
Here is the VB code for the Code Behind File.
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.Common
Imports System.Data.SqlClient
Imports System.Data.OleDb
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Partial Class News_List
Inherits System.Web.UI.Page
Dim DBConnection As SqlConnection
Dim DBCommand As SqlCommand
Dim DBReader As SqlDataReader
Dim SQLString As String
Dim PageSize As Integer = 4
Public IsAdmin As Boolean
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
IsAdmin = User.IsInRole("Administrators")
panel1.Visible = IsAdmin
If Not Page.IsPostBack Then
Fill()
End If
'-- Load array NewsIdList() with item numbers
Dim NewsIdList = New ArrayList()
DBConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString)
SQLString = "SELECT id, itemdate FROM Announcements " & _
"ORDER BY id DESC, itemdate DESC"
DBConnection.Open()
DBCommand = New SqlCommand(SQLString, DBConnection)
DBReader = DBCommand.ExecuteReader()
While DBReader.Read()
NewsIdList.Add(DBReader("id"))
End While
DBReader.Close()
DBConnection.Close()
NewsIdList.TrimToSize()
'-- Create Paging Buttons
Dim StartIndex As Integer
Dim EndIndex As Integer
Dim StartKey As String
Dim EndKey As String
Dim StartDate As DateTime
Dim i As Integer
StartIndex = 0
For i = 1 To Math.Ceiling(NewsIdList.Count / PageSize)
'-- Determine starting and ending array indexes
EndIndex = StartIndex + PageSize - 1
If EndIndex > NewsIdList.Count - 1 Then
EndIndex = NewsIdList.Count - 1
End If
'-- Assign starting and ending item numbers
StartKey = NewsIdList(StartIndex)
EndKey = NewsIdList(EndIndex)
'-- Create a button and assign to placeholder
Dim PageButton As Button
PageButton = New Button()
PageButton.Text = i
PageButton.ID = "P" & i
PageButton.CommandName = StartKey & "|" & EndKey
PageButton.Style("width") = "20px"
PageButton.Style("background-color") = "#F0F0F0"
AddHandler PageButton.Command, AddressOf DisplayRepeater
PageButtons.Controls.Add(PageButton)
StartIndex += PageSize
Next
If Not Page.IsPostBack Then
Dim FirstButton As Button
FirstButton = CType(PageButtons.FindControl("P1"), Button)
FirstButton.Style("background-color") = "#990000"
FirstButton.Style("color") = "#FFFFFF"
End If
End Sub
Sub Fill()
Dim DBConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString)
SQLString = "SELECT Top " & PageSize & _
" id, itemdate, title, description, photo FROM Announcements " & _
"ORDER BY itemdate DESC, id DESC"
DBConnection.Open()
DBCommand = New SqlCommand(SQLString, DBConnection)
DBReader = DBCommand.ExecuteReader()
NewsRepeater.DataSource = DBReader
NewsRepeater.DataBind()
DBReader.Close()
DBConnection.Close()
End Sub
Sub DisplayRepeater(ByVal Src As Object, ByVal Args As CommandEventArgs)
Dim Keys() As String
Keys = Split(Args.CommandName, "|")
'-- Bind the Repeater
DBConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("ClubSiteDB").ConnectionString)
DBConnection.Open()
SQLString = "SELECT id, itemdate, title, description, photo FROM Announcements WHERE " & _
"id >= '" & Keys(1) & "' AND " & _
"id <= '" & Keys(0) & "' " & _
"ORDER BY id DESC, itemdate DESC"
DBCommand = New SqlCommand(SQLString, DBConnection)
DBReader = DBCommand.ExecuteReader()
NewsRepeater.DataSource = DBReader
NewsRepeater.DataBind()
DBReader.Close()
DBConnection.Close()
'-- Highlight clicked button
Dim Item As Button
Dim ThisButton As Button
For Each Item In PageButtons.Controls
ThisButton = CType(Item, Button)
ThisButton.Style("background-color") = "#F0F0F0"
ThisButton.Style("color") = "#000000"
Next
ThisButton = CType(PageButtons.FindControl(Src.id), Button)
ThisButton.Style("background-color") = "#990000"
ThisButton.Style("color") = "#FFFFFF"
End Sub
End Class
You can download this at aspsksolutions.com, of course I posted it here as well.
BugSlayer
Member
246 Points
58 Posts
Re: Buglist suggestions - implementing the Issue Tracker Kit ...
May 05, 2006 02:29 PM|LINK
Hi,
I hope U guys have seen, evaluated and thought about BugTracker.NET [:-*]
If not pls take a look gere http://sourceforge.net/projects/btnet/
I quote "A web-based bug/issue tracker written using ASP.NET and C#. Requires SQL Server or MSDE. Easy to install and learn how to use, but there's power if you need it. Probably has all the features you want. Nice integration with email."
ASP.NET, C#, SQL !!! extending it should be a breeze...[8-|]
It's supposedly Production/Stable & GNU General Public License (GPL) open source so any enhancements /upgrades (along with your reputation) will effectively reach a wider audience (current/future downloaders) as the market-branding already exists. [cool]
Think of it as another Strater Kit !!![;)]
Caveat: BugTracker.NET is just my uninformed suggestion. Not responsible for any future outcome Good or Bad, including acts of Nature.[Angel]
aabruzzese
Contributor
2806 Points
759 Posts
Re: Buglist suggestions - implementing the Issue Tracker Kit ...
May 05, 2006 03:42 PM|LINK
Hi,
I will check it out but I do have something that is nearing completion of beta.
Of course I work in VB.net for now and it seems that as percieved VB.Net is for lightweights?
LOL
TommyIT
Member
10 Points
2 Posts
Re: Buglist suggestions - implementing the Issue Tracker Kit ...
May 05, 2006 07:01 PM|LINK
Angelo,
I just started uploading the bug tracker.net to my test site, unbelieveably slow ftp but i will let you know when i get it running, So you can check it out.
Tom
lexy
Participant
1668 Points
441 Posts
Member_details Upload image with no image selected
May 09, 2006 05:54 PM|LINK
Hi all,
I really hope I did not miss the solution for this one, but I tried to find posts about it and did not succeed.
If it's already been delt with.....Sorry
When you simply hit the upload_image button in Member_details with no image selected:
Parameter is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Parameter is not valid.
Source Error:
Stack Trace:
Just found this one when looking at mr. Lunch's forum, thought the new code was the culprit at first. To be sure I started with a fresh CWS, and the problem was already there.
Lex
lexy
Participant
1668 Points
441 Posts
Re: Member_details Upload image with no image selected
May 09, 2006 06:01 PM|LINK
Sorry for the empty error page in the previous post (forgot it was fresh from the Template)
Parameter is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.ArgumentException: Parameter is not valid.
Source Error:
Source File: C:\ClubWebSite1\Member_Details.aspx Line: 59
Stack Trace:
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
MrLunch
Member
727 Points
144 Posts
Re: Member_details Upload image with no image selected
May 09, 2006 06:10 PM|LINK
in member_details.aspx:
Protected Sub uploadimage_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Try
' next line errors if no image uploaded
Dim thumbimage As Byte() = ImageUtils.MakeThumb(newavatar.FileBytes, 69, 69)
Dim m As New DataSetTableAdapters.MemberInfo1TableAdapter
Dim memberid As Guid = CType(Membership.GetUser().ProviderUserKey, Guid)
Dim origid As Guid = memberid
m.Update(memberid, thumbimage, origid)
avatarimage.ImageUrl = "AvatarImagefetch.ashx?Memberid=" & memberid.ToString
Catch ex As Exception
' maybe enable an error message label here
Return
End Try
End Sub
Forums Starter Kit
lexy
Participant
1668 Points
441 Posts
Re: Member_details Upload image with no image selected
May 09, 2006 06:22 PM|LINK
Hi Mark,
Wow you're fast.
That solves the error part.
Could it be that with your AvatarImageFetch.ashx (bundled with the Forum) the Avatar is not immediately updated in Member_details?
(Will get back to you on the forum when I have seen and tested it thorougly, but for now I can say it really has potential)
Best regards,
Lex
MrLunch
Member
727 Points
144 Posts
Re: Member_details Upload image with no image selected
May 09, 2006 06:51 PM|LINK
No, but my version does set an expires header, I think to 10 minutes. I have this thing about *making* the browser cache stuff. But that's not good here, because that'll make it look like the upload failed when it's actually OK but the browser is showing you the previous image. You can just take out that line where it sets Expires.
Forums Starter Kit
lexy
Participant
1668 Points
441 Posts
Lets get things straight
May 12, 2006 02:04 PM|LINK
Hi,
this is no exactly a BUG
But when you look at Login Page the lower rightblock(s) shift about 1 mm. to the left.
Not visible in designtime.
Can't find the culprit.
Should be simple, but could not solve it with deducing and combining.
Lex