L
lisa
I'm still banging away at my tabstrip problem, which I've mentioned in
other threads here.
One of the things I've noticed is that in design view, none of the
controls inside of a tab page show up in the property grid.
This makes sense, I suppose, because once they're added, even if
they're being added manually in the HTML view, they're a part of the
control, and they aren't any more visible to the page than any other
constituent of the control.
That's probably why postback data isn't updating those controls. I
still don't see how Microsoft beat that in their Multipage control, but
apparently they did. Which means that it's possible.
One thing I tried was this:
============================
' Populate controls with PostData, saving a list of those that were
modified:
Dim modifiedControls As New ArrayList
Dim myControl As control
For Each key As String In Page.Request.Form.AllKeys
myControl = FindControl(key)
If TypeOf myControl Is IPostBackDataHandler Then
If CType(myControl, IPostBackDataHandler).LoadPostData(key,
Page.Request.Form) Then
modifiedControls.Add(myControl)
End If
End If
Next key
'Raise PostDataChanged event on all modified controls:
Dim control As IPostBackDataHandler
For Each control In modifiedControls
control.RaisePostDataChangedEvent()
Next control
============================
I stole that from
http://www.codeproject.com/aspnet/PersistentStatePage.asp, with some
modifications.
The problem is, FindControl doesn't find the controls. I tried
modifying it so that it does FindControl on each Tab control in the
TabStrip's TabCollection. Still nothing.
Here's something twisted from the Command Window:
?Tabs(2).Controls(1).ID
"CheckBox1"
?Tabs(2).HasControls
True
?CType(Tabs(2),Control).FindControl("Checkbox1").ID
Referenced object 'FindControl' has a value of 'Nothing'.
?CType(Tabs(2),Control).Controls(1).ID
"CheckBox1"
Can anyone explain this to me? Just those last two items make no sense
at all. CheckBox1 is visible when I try to get its ID. But when I try
from the other direction, using FindControl to get the control using
the ID, I get Nothing.
Thanks,
Lisa
other threads here.
One of the things I've noticed is that in design view, none of the
controls inside of a tab page show up in the property grid.
This makes sense, I suppose, because once they're added, even if
they're being added manually in the HTML view, they're a part of the
control, and they aren't any more visible to the page than any other
constituent of the control.
That's probably why postback data isn't updating those controls. I
still don't see how Microsoft beat that in their Multipage control, but
apparently they did. Which means that it's possible.
One thing I tried was this:
============================
' Populate controls with PostData, saving a list of those that were
modified:
Dim modifiedControls As New ArrayList
Dim myControl As control
For Each key As String In Page.Request.Form.AllKeys
myControl = FindControl(key)
If TypeOf myControl Is IPostBackDataHandler Then
If CType(myControl, IPostBackDataHandler).LoadPostData(key,
Page.Request.Form) Then
modifiedControls.Add(myControl)
End If
End If
Next key
'Raise PostDataChanged event on all modified controls:
Dim control As IPostBackDataHandler
For Each control In modifiedControls
control.RaisePostDataChangedEvent()
Next control
============================
I stole that from
http://www.codeproject.com/aspnet/PersistentStatePage.asp, with some
modifications.
The problem is, FindControl doesn't find the controls. I tried
modifying it so that it does FindControl on each Tab control in the
TabStrip's TabCollection. Still nothing.
Here's something twisted from the Command Window:
?Tabs(2).Controls(1).ID
"CheckBox1"
?Tabs(2).HasControls
True
?CType(Tabs(2),Control).FindControl("Checkbox1").ID
Referenced object 'FindControl' has a value of 'Nothing'.
?CType(Tabs(2),Control).Controls(1).ID
"CheckBox1"
Can anyone explain this to me? Just those last two items make no sense
at all. CheckBox1 is visible when I try to get its ID. But when I try
from the other direction, using FindControl to get the control using
the ID, I get Nothing.
Thanks,
Lisa