Hey RR,
can ya have a look at what i got here, it recognises my repeaters, but i still get a Null Reference when trying to reference one of my rpActiveSpecs controls...
Code:
Dim categoryCount As Integer = 0
Dim subcategoryCount As Integer = 0
Dim specsCount As Integer = 0
Dim rpCategory As Repeater = rpActiveCategory
For categoryCount = 0 To rpCategory.Items.Count - 1
Dim rpSubCategory As Repeater = CType(rpCategory.Items(categoryCount).FindControl("rpActiveSubCategory"), Repeater)
For subcategoryCount = 0 To rpSubCategory.Items.Count - 1
Dim rpSpecs As Repeater = CType(rpSubCategory.Items(subcategoryCount).FindControl("rpActiveSpecs"), Repeater)
For specsCount = 0 To rpSpecs.Items.Count - 1
Dim lbtnActiveRoomNo As LinkButton = CType(rpSpecs.Items(specsCount).FindControl("lbtnActiveRoomNo"), LinkButton)
Dim lbtnActiveSpecNo As LinkButton = CType(rpSpecs.Items(specsCount).FindControl("lbtnActiveSpecNo"), LinkButton)
lbtnActiveRoomNo.CommandArgument = "sh!t"
Next
Next
Next
the bit in red gives the error:
Code:
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="App_Web_6ilwnity"
StackTrace:
at CustomControls_specs_interior.ActiveSortbuttons_OnClick(Object s, EventArgs e) in C:\inetpub\wwwroot\keithdesign\CustomControls\specs_interior.ascx.vb:line 496
at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e)
at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
Bookmarks