Print Page | Close Window

Requesting page data from a module

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=7052
Printed Date: 29 March 2026 at 1:24pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Requesting page data from a module
Posted By: Diep-Vriezer
Subject: Requesting page data from a module
Date Posted: 06 November 2003 at 1:19pm

Hey again!

This time I want to request the .Text value of a textbox on a page. But I want this to be done from a central module.

So I've got a textbox (txtBox1) and I want to request that value from a global module (Auth), in such a way that I don't have to submit any data to the function by using the header ( Function Test(ByVal text As String).

Is there anyway of doing this? I can submit the page to the function by using

    Public Function Test(ByVal Page As Page)

But howto get the data (txtBox1.Text) from that page?



-------------
Gone..



Replies:
Posted By: Mart
Date Posted: 06 November 2003 at 1:24pm

Can't you just put

Protected Text1 As System.Web.UI.WebControls.Textbox

Then use Text1.Text like normal?



Posted By: Diep-Vriezer
Date Posted: 06 November 2003 at 1:34pm
Where? In the module? In the page it already says that. But I don't know if it will work.. I'll give it a shot.

-------------
Gone..


Posted By: Diep-Vriezer
Date Posted: 06 November 2003 at 1:35pm
Protected stuff can't be used in a module

-------------
Gone..


Posted By: Diep-Vriezer
Date Posted: 06 November 2003 at 1:40pm

Nop that method won't work. "Object refference not set to an instance of an object"... The most annoying error of all.

Maybe it has something todo with Page.FindControls or something like that.



-------------
Gone..


Posted By: Diep-Vriezer
Date Posted: 06 November 2003 at 1:47pm

I guess I'm almost there

Public Sub Test(WichPage As Page)

HttpContext.Current.Response.Write(WichPage.FindControl("txt Box1"))

End Sub

Returns "System.Web.UI.WebControls.Textbox"

Now I just need to figure out how to set the .Text value... I'm quite sure it is possible.



-------------
Gone..


Posted By: Diep-Vriezer
Date Posted: 06 November 2003 at 1:49pm

Plz note that txtBox1 got splitted up.. It's that wicked error again



-------------
Gone..


Posted By: Diep-Vriezer
Date Posted: 06 November 2003 at 1:53pm

Got it!!! Jeeej. The WichPage still needs to be set from the page, but that's better than before. The topic was quite useless, but it might be usefull to people who want the same?

Public Sub Test(ByVal WichPage As Page)

Dim TestBox As System.Web.UI.WebControls.TextBox

TestBox = WichPage.FindControl("txtBox1")

TestBox.Text = "Boe"

End Sub



-------------
Gone..



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net