Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Current page

Status
Not open for further replies.

netangel

Programmer
Feb 7, 2002
124
PT
A few days ago I saw a great idea in this forum that I can't find now.

Someone was calling a function or method that would interact with some control of the calling page. Inside the method the control was used without sending a reference to the calling page.

Right now I'm using it like:

Private Sub DoSomething(ByVal myPage As Page)
myPage.Textbox1.Text = "Hello World"
End Sub

In that post I saw, the method was something like:
Private Sub DoSomething()
CurrentPage.Textbox1.Text = "Hello World"
End Sub

That red colored word (CurrentPage) is what I'm searching for.

Any ideas? Anyone can find that thread, or just tell me the word?

NetAngel
 
Q you can simply type Thread 855 - 378341 (w/o spaces) to create a link like so
Thread855-378341 That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Kewl, thanks, I see now. Wasn't sure before. Not often I can share info... you guys are good!
 
lol Wasn't all that long ago I was in your shoes. Asking alot of questions and unable to answer many. Keep up the work and you'll be up there to. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Thanks qwert.

That was what I was looking for. It has just saved me with part of my code, but now I have some other problem: I can't reach controls. On my above sample:

Private Sub DoSomething(ByVal myPage As Page)
Current.Textbox1.Text = "Hello World"
End Sub

I understand that the 'Current' is a sort of interface to all pages, but I'd expect to find a method like 'FindControl' or something similar.
NetAngel
 
Do you have this control in a datagrid? With datagrid's, it works kinda funny. You can't access it directly... but you can get to it. This is what I found for accessing a datgrid control... but if this is not the context of your control... well... we'll have to look elsewhere.

Dim _item As DataGridItem = dataGridName.Items(0)
Dim t As TextBox = CType((_item.Cells(0).FindControl("controlName"), TextBox)
 
Np. My control lays simply on the page. I just can't access it with the Current keyword, because that keyword may refer to any webform. As I said before it works like a interface. It can't guess on design time what page am I going to call on run time.
Thanx anyway.
NetAngel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top