Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Requesting page data from a module
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Requesting page data from a module

 Post Reply Post Reply
Author
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Topic: Requesting page data from a module
    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?



Edited by Diep-Vriezer
Gone..
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post 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?

Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2003 at 1:35pm
Protected stuff can't be used in a module
Gone..
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post 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.



Edited by Diep-Vriezer
Gone..
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post Posted: 06 November 2003 at 1:49pm

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

Gone..
Back to Top
Diep-Vriezer View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 August 2003
Location: Netherlands
Status: Offline
Points: 831
Post Options Post Options   Thanks (0) Thanks(0)   Quote Diep-Vriezer Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.