A
antonyliu2002
I want to create session objects for all web controls in a page. Right
now, I am doing it in a dumb way like this (for example):
Session("Session1") = ctrl1.Text
Session("Session2") = ctrl2.Text
Session("Session3") = ctrl3.Text
Session("Session4") = ctrl4.SelectedValue
Session("Session5") = ctrl5.Text
Session("Session6") = ctrl6.Text
It would be good if I can get all web controls and loop through them.
I searched this group and noticed that this topic has been discussed in
a few threads. But I've tried
For Each objCtrl in Page.FindControl("MyForm").Controls
and
For Each objCtrl In Page.Controls
and
For Each objCtrl In MyForm.Controls
and
For Each objCtrl In Me.Controls
None of them worked. Would any guru please share your idea? Thanks.
now, I am doing it in a dumb way like this (for example):
Session("Session1") = ctrl1.Text
Session("Session2") = ctrl2.Text
Session("Session3") = ctrl3.Text
Session("Session4") = ctrl4.SelectedValue
Session("Session5") = ctrl5.Text
Session("Session6") = ctrl6.Text
It would be good if I can get all web controls and loop through them.
I searched this group and noticed that this topic has been discussed in
a few threads. But I've tried
For Each objCtrl in Page.FindControl("MyForm").Controls
and
For Each objCtrl In Page.Controls
and
For Each objCtrl In MyForm.Controls
and
For Each objCtrl In Me.Controls
None of them worked. Would any guru please share your idea? Thanks.