Home All Groups Group Topic Archive Search About

Where is Page.RegisterClientScriptBlock Available?

Author
10 Jun 2006 5:19 AM
Nathan Sokalski
I have used the RegisterClientScriptBlock method in external functions of
mine (ones that are saved in a separate *.vb file), where I use them as
follows:

Public Shared Sub MyFunction(ByVal txtbox As TextBox)
    'other code
    txtbox.Page.RegisterClientScriptBlock("mykey","myscript")
    'other code
End Sub

When I use this external function in my *.aspx.vb files, it does what I want
and expect. However, when I try to use the RegisterClientScriptBlock in my
*.aspx.vb files, it is not included in the list of methods, properties, etc.
when I type 'Page.' Why is Visual Basic not listing this method with the
others while I am writing my code? The *.aspx.vb file inherits
System.Web.UI.Page just like all the *.aspx.vb files. Thanks.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Author
10 Jun 2006 6:29 AM
Mark Rae
"Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
news:Os8O61EjGHA.4512@TK2MSFTNGP04.phx.gbl...

> When I use this external function in my *.aspx.vb files, it does what I
> want and expect. However, when I try to use the RegisterClientScriptBlock
> in my *.aspx.vb files, it is not included in the list of methods,
> properties, etc. when I type 'Page.'

Is it available when you type 'Me.'?
Author
11 Jun 2006 6:12 PM
Nathan Sokalski
No, it is not.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quoteHide quote
"Mark Rae" <m***@markN-O-S-P-A-M.co.uk> wrote in message
news:e4plGdFjGHA.3780@TK2MSFTNGP03.phx.gbl...
> "Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
> news:Os8O61EjGHA.4512@TK2MSFTNGP04.phx.gbl...
>
>> When I use this external function in my *.aspx.vb files, it does what I
>> want and expect. However, when I try to use the RegisterClientScriptBlock
>> in my *.aspx.vb files, it is not included in the list of methods,
>> properties, etc. when I type 'Page.'
>
> Is it available when you type 'Me.'?
>
Author
12 Jun 2006 5:05 AM
Teemu Keiski
in VS, check

Tools->Options->Text Editor->Basic->General

and check that "Hide advanced members" is unchecked. If it is checked, VS
will hide some methods from you.


--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


Show quoteHide quote
"Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
news:OkGvYKYjGHA.1640@TK2MSFTNGP02.phx.gbl...
> No, it is not.
> --
> Nathan Sokalski
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
> "Mark Rae" <m***@markN-O-S-P-A-M.co.uk> wrote in message
> news:e4plGdFjGHA.3780@TK2MSFTNGP03.phx.gbl...
>> "Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
>> news:Os8O61EjGHA.4512@TK2MSFTNGP04.phx.gbl...
>>
>>> When I use this external function in my *.aspx.vb files, it does what I
>>> want and expect. However, when I try to use the
>>> RegisterClientScriptBlock in my *.aspx.vb files, it is not included in
>>> the list of methods, properties, etc. when I type 'Page.'
>>
>> Is it available when you type 'Me.'?
>>
>
>
Author
12 Jun 2006 5:17 AM
Nathan Sokalski
THANK YOU! It might have taken me who knows how long to find that, and it is
definitely an important method in some cases. Thanks again!
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quoteHide quote
"Teemu Keiski" <jot***@aspalliance.com> wrote in message
news:uwp1Z3djGHA.4044@TK2MSFTNGP03.phx.gbl...
> in VS, check
>
> Tools->Options->Text Editor->Basic->General
>
> and check that "Hide advanced members" is unchecked. If it is checked, VS
> will hide some methods from you.
>
>
> --
> Teemu Keiski
> ASP.NET MVP, AspInsider
> Finland, EU
> http://blogs.aspadvice.com/joteke
>
>
> "Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
> news:OkGvYKYjGHA.1640@TK2MSFTNGP02.phx.gbl...
>> No, it is not.
>> --
>> Nathan Sokalski
>> njsokal***@hotmail.com
>> http://www.nathansokalski.com/
>>
>> "Mark Rae" <m***@markN-O-S-P-A-M.co.uk> wrote in message
>> news:e4plGdFjGHA.3780@TK2MSFTNGP03.phx.gbl...
>>> "Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
>>> news:Os8O61EjGHA.4512@TK2MSFTNGP04.phx.gbl...
>>>
>>>> When I use this external function in my *.aspx.vb files, it does what I
>>>> want and expect. However, when I try to use the
>>>> RegisterClientScriptBlock in my *.aspx.vb files, it is not included in
>>>> the list of methods, properties, etc. when I type 'Page.'
>>>
>>> Is it available when you type 'Me.'?
>>>
>>
>>
>
>
Author
10 Jun 2006 2:25 PM
Göran_Andersson
You need a reference to the actual Page object for the page that is
created as a response to the request.

In the example you show, that is accomplished by the fact that the
control that you are passing to the method contains a reference to the
page that it has been added to.

Inheriting the Page class would give you access to the
RegisterClientScriptBlock method, but that doesn't help you a bit. You
need a reference to the page that is being created, not just any Page
object.

Nathan Sokalski wrote:
Show quoteHide quote
> I have used the RegisterClientScriptBlock method in external functions of
> mine (ones that are saved in a separate *.vb file), where I use them as
> follows:
>
> Public Shared Sub MyFunction(ByVal txtbox As TextBox)
>     'other code
>     txtbox.Page.RegisterClientScriptBlock("mykey","myscript")
>     'other code
> End Sub
>
> When I use this external function in my *.aspx.vb files, it does what I want
> and expect. However, when I try to use the RegisterClientScriptBlock in my
> *.aspx.vb files, it is not included in the list of methods, properties, etc.
> when I type 'Page.' Why is Visual Basic not listing this method with the
> others while I am writing my code? The *.aspx.vb file inherits
> System.Web.UI.Page just like all the *.aspx.vb files. Thanks.
Author
11 Jun 2006 6:34 PM
Nathan Sokalski
I realize that I need access to the Page object that is being created, but
shouldn't the keyword Me do that, as Mark Rae mentioned in one of the other
responses?
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quoteHide quote
"Göran Andersson" <gu***@guffa.com> wrote in message
news:%23ZLA4mJjGHA.2188@TK2MSFTNGP04.phx.gbl...
> You need a reference to the actual Page object for the page that is
> created as a response to the request.
>
> In the example you show, that is accomplished by the fact that the control
> that you are passing to the method contains a reference to the page that
> it has been added to.
>
> Inheriting the Page class would give you access to the
> RegisterClientScriptBlock method, but that doesn't help you a bit. You
> need a reference to the page that is being created, not just any Page
> object.
>
> Nathan Sokalski wrote:
>> I have used the RegisterClientScriptBlock method in external functions of
>> mine (ones that are saved in a separate *.vb file), where I use them as
>> follows:
>>
>> Public Shared Sub MyFunction(ByVal txtbox As TextBox)
>>     'other code
>>     txtbox.Page.RegisterClientScriptBlock("mykey","myscript")
>>     'other code
>> End Sub
>>
>> When I use this external function in my *.aspx.vb files, it does what I
>> want and expect. However, when I try to use the RegisterClientScriptBlock
>> in my *.aspx.vb files, it is not included in the list of methods,
>> properties, etc. when I type 'Page.' Why is Visual Basic not listing this
>> method with the others while I am writing my code? The *.aspx.vb file
>> inherits System.Web.UI.Page just like all the *.aspx.vb files. Thanks.
Author
12 Jun 2006 8:20 AM
Göran_Andersson
Only if the code is inside the page class. If the code is in some other
class, the Me keyword references the instance of that class.

Nathan Sokalski wrote:
Show quoteHide quote
> I realize that I need access to the Page object that is being created, but
> shouldn't the keyword Me do that, as Mark Rae mentioned in one of the other
> responses?