How is it not initialized? Here's the code, am I missing something? Thanks.
' Handles creation of each repeater item (ie, row)
Sub myRepeater_ItemCreated(sender As Object, e As RepeaterItemEventArgs)
' If the item is a header, change the background color of the column by which
the records are sorted
If e.Item.ItemType = ListItemType.Header Then
Dim SortedColumn As HTMLTableCell
' If user has selected column to sort by
If Not Request.Form("SortBy") Is Nothing Then
SortedColumn = e.Item.FindControl(Request.Form("SortBy"))
' If user has not selected column to sort by, select default column
Else
SortedColumn = e.Item.FindControl(DefaultSortColumn)
End If
' Add background color to sorted column
SortedColumn.Attributes.Add("bgcolor","#ffffef")
End If
' If the item is an alternating item, change the background color
If e.Item.ItemType = ListItemType.AlternatingItem Then
Dim ThisRow As HTMLTableRow
ThisRow = e.Item.FindControl("BodyRow")
ThisRow.Attributes.Add("bgcolor","#f0f8ff")
End If
End Sub
Dean Fiala <[EMAIL PROTECTED]> wrote:
SortedColumn has not been initialized.
On 9/20/05, sas0riza <[EMAIL PROTECTED]> wrote:
> What does the error below mean? Thanks!
>
>
>
>
> "Object reference not set to an instance of an object."
>
> 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.NullReferenceException: Object reference
> not set to an instance of an object.
>
> Source Error:
>
>
> Line 300:
> Line 301: ' Add background color to sorted column
> Line 302: SortedColumn.Attributes.Add
> ("bgcolor","#ffffef")
> Line 303:
> Line 304: End If
>
>
> Source File: F:\Paging.aspx.vb Line: 302
>
> Stack Trace:
>
>
> [NullReferenceException: Object reference not set to an instance of
> an object.]
> PagingCodeBehind.myRepeater_ItemCreated(Object sender,
> RepeaterItemEventArgs e) in F:\Paging.aspx.vb:302
> System.Web.UI.WebControls.Repeater.OnItemCreated
> (RepeaterItemEventArgs e) +84
> System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex,
> ListItemType itemType, Boolean dataBind, Object dataItem) +92
> System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean
> useDataSource) +357
> System.Web.UI.WebControls.Repeater.CreateChildControls() +61
> System.Web.UI.Control.EnsureChildControls() +100
> System.Web.UI.WebControls.Repeater.get_Controls() +12
> System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
> +179
> System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
> +311
> System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
> +311
> System.Web.UI.Page.LoadPageViewState() +156
> System.Web.UI.Page.ProcessRequestMain() +439
>
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com
SPONSORED LINKS
Basic programming language Computer programming languages Programming languages
Java programming language The history of computer programming language
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "AspNetAnyQuestionIsOk" on the web.
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/