Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
When are control properties available
Message
From
15/05/2008 14:41:21
 
 
To
15/05/2008 11:49:25
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01317170
Message ID:
01317422
Views:
12
Partial good news, I found an event that would give me the proper value for the DataItemCount. It is the PreRender Event of the FormView1. However now I am having trouble with the syntax of commands in the loop. It isn't clear which items should be indexed by the counter "i". I have tried all the variations I can think of for DataKey(i), DataKey.Item(i), and DataKey.Value without much luck. Does anyone know the proper way to form this loop?




>Well, I moved it back to the Load event and also tried it in the PreRender event (I couldn't find the Render event) all with the same result. The DataItemCount comes up 0 and the loop never executes. Perhaps the problem is with the code and not the location?
>Paul - Thanks for the graphic. I will have to get more familiar with .NET before it will be of much help but I'm sure it will come in handy.
>
>
>>I think you should move your code to Form's Load method or Render method.
>>
>>>Can someone tell me with .NET, when do the control properties become available? With the following code
>>>
>>>    Protected Sub Page_init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
>>>        Dim CurrentRecord As Int32 = Request.QueryString("user_id")
>>>        Dim i As Int32
>>>
>>>        Response.Write(CurrentRecord)               ' For testing
>>>        Response.Write(VarType(CurrentRecord))      ' For testing
>>>        Response.Write(FormView1.DataItemCount)     ' For testing
>>>
>>>        For i = 0 To FormView1.DataItemCount - 1
>>>            Response.Write(i)
>>>            If FormView1.DataKey(i).value = CurrentRecord Then
>>>                FormView1.PageIndex = "3"           ' For testing
>>>                Exit For
>>>            End If
>>>        Next
>>>    End Sub
>>>
>>>the third response.write produces a 0 even though the formview has several records available to it. Probably my code is wrong but I think I'm getting close. The Formview1.init is set to Page_load.
>>>
>>>
>>>Thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform