Print Page | Close Window

Lots of Problems.

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=17197
Printed Date: 29 March 2026 at 4:24am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Lots of Problems.
Posted By: davidshq
Subject: Lots of Problems.
Date Posted: 09 November 2005 at 11:16pm
Uggg...So many problems thus far with transferring my app. from ASP.NET 2.0 Beta to 2.0 Final. :-/ Every time I correct an error I'm running into another one.
Any ideas on why this code is throwing an error (it worked fine with beta):
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles GridView1.RowDataBound
        ' Sets null cells to more pretty values.
        If e.Row.RowType = DataControlRowType.DataRow Then
            If IsDBNull(e.Row.DataItem("Popularity2")) Then
                e.Row.Cells(3).Text = "-"
            End If
            If IsDBNull(e.Row.DataItem("Popularity")) Then
                e.Row.Cells(4).Text = "-"
            End If
            If IsDBNull(e.Row.DataItem("LastPlayedDate")) Then
                e.Row.Cells(5).Text = "Never"
            End If
        End If
        ' Changes numeric value to text value for presentation purposes.
        Select Case e.Row.Cells(6).Text
            Case 1
                e.Row.Cells(6).Text = "Active Inside"
            Case 2
                e.Row. Cells(6).Text = "Semi-Active Inside"
            Case 3
                e.Row. Cells(6).Text = "Inactive Inside"
            Case 4
                e.Row.Cells(6).Text = "Chair Game"
            Case 5
                e.Row. Cells(6).Text = "Active Outside"
            Case 6
                e.Row. Cells(6).Text = "Semi-Active Outside"
            Case 7
                e.Row. Cells(6).Text = "Inactive Outside"
            Case 8
                e.Row.Cells(6).Text = "Water Game"
            Case 9
                e.Row.Cells(6).Text = "Messy Game"
            Case 10
                e.Row.Cells(6).Text = "Trick "
        End Select
    End Sub
I'm getting a:

Specified argument was out of the range of valid values.
Parameter name: index


David.


-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.



Replies:
Posted By: davidshq
Date Posted: 09 November 2005 at 11:42pm
Well, I haven't figured out the answer, but I do know a bit more about the problem.
I added the line:
Dim test as String = e.Row.Cells(6).Text
And then ran the program again, this allowed me to see that the response is "Nothing" What I don't understand is why e went from holding these values to holding nothing. :-( :-(
David.


-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.


Posted By: davidshq
Date Posted: 10 November 2005 at 10:31pm
I still haven't had any luck with this problem. I discovered however that nearly identical code on a different page works. Maybe it is something with my stored procedure?:
ALTER PROCEDURE dbo.AllGames
    (
    @varAI int,
    @varSI int,
    @varII int,
    @varCG int,
    @varAO int,
    @varSO int,
    @varIO int,
    @varWG int,
    @varMG int,
    @varTrick int,
    @varUserName varchar(200),
    @varSQL varchar(1000),
    @varSearch int
    )
AS
     select uID, gID, LastPlayedDate into #templastplayed from LastPlayed where uID LIKE @varUserName
 select uID as uID2, gID as gID2, Popularity as Popularity2 into #temppopularity from GamePopularity where uID LIKE @varUserName
If @varSearch = 0
BEGIN
     select * from Game G LEFT JOIN #templastplayed LP ON G.ID=LP.gID LEFT JOIN #temppopularity GP ON G.ID=GP.gID2 ORDER BY G.Type
END
If @varSearch = 1
BEGIN
    select * into #tempfilter from Game G LEFT JOIN #templastplayed LP on G.ID=LP.gID LEFT JOIN #temppopularity GP on G.ID=GP.gID2 WHERE G.Type=0
    If @varAI=1
    BEGIN
    Insert Into #tempfilter select * from Game G LEFT JOIN #templastplayed LP on G.ID=LP.gID LEFT JOIN #temppopularity GP on G.ID=GP.gID2 WHERE G.Type=1
    END
    If @varSI=1
    BEGIN
    Insert Into #tempfilter select * from Game G LEFT JOIN #templastplayed LP on G.ID=LP.gID LEFT JOIN #temppopularity GP on G.ID=GP.gID2 WHERE G.Type=2
    END
    If @varII=1
    BEGIN
    Insert Into #tempfilter select * from Game G LEFT JOIN #templastplayed LP on G.ID=LP.gID LEFT JOIN #temppopularity GP on G.ID=GP.gID2 WHERE G.Type=3
    END
    If @varCG=1
    BEGIN
    Insert Into #tempfilter select * from Game G LEFT JOIN #templastplayed LP on G.ID=LP.gID LEFT JOIN #temppopularity GP on G.ID=GP.gID2 WHERE G.Type=4
    END
    If @varAO=1
    BEGIN
    Insert Into #tempfilter select * from Game G LEFT JOIN #templastplayed LP on G.ID=LP.gID LEFT JOIN #temppopularity GP on G.ID=GP.gID2 WHERE G.Type=5
    END
    If @varSO=1
    BEGIN
    Insert Into #tempfilter select * from Game G LEFT JOIN #templastplayed LP on G.ID=LP.gID LEFT JOIN #temppopularity GP on G.ID=GP.gID2 WHERE G.Type=6
    END
    If @varIO=1
    BEGIN
    Insert Into #tempfilter select * from Game G LEFT JOIN #templastplayed LP on G.ID=LP.gID LEFT JOIN #temppopularity GP on G.ID=GP.gID2 WHERE G.Type=7
    END
    If @varWG=1
    BEGIN
    Insert Into #tempfilter select * from Game G LEFT JOIN #templastplayed LP on G.ID=LP.gID LEFT JOIN #temppopularity GP on G.ID=GP.gID2 WHERE G.Type=8
    END
    If @varMG=1
    BEGIN
    Insert Into #tempfilter select * from Game G LEFT JOIN #templastplayed LP on G.ID=LP.gID LEFT JOIN #temppopularity GP on G.ID=GP.gID2 WHERE G.Type=9
    END
    If @varTrick=1
    BEGIN
    Insert Into #tempfilter select * from Game G LEFT JOIN #templastplayed LP on G.ID=LP.gID LEFT JOIN #temppopularity GP on G.ID=GP.gID2 WHERE G.Type=10
    END
    select * from #tempfilter
END
    /* SET NOCOUNT ON */
    RETURN



-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net