473,394 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

RegisterStartupScript in User Control

I have a user control (.ascx) on a web form (.aspx). So far no code other
than on the page

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="default.aspx.vb"
Inherits="Test.default"%>
<%@ Register TagPrefix="test" TagName="test1" Src="test1.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>default</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<test:test1 id="myTest" Runat="server" />
</form>
</body>
</html>
and in the control there is no code. i want to add this line in the control
page load.
Page.RegisterStartupScript("ctrlId","<script>var ctrlId='"+this.ClientID
+"_';</script>")

but intellisense doesnt have a clue as to that line, it won't compile. BTW
this is ASP.Net 1.1.

Help


Nov 19 '05 #1
2 7033
Because the Control needs a Page.
Try Parent.Page......

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Pitcairnia" wrote:
I have a user control (.ascx) on a web form (.aspx). So far no code other
than on the page

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="default.aspx.vb"
Inherits="Test.default"%>
<%@ Register TagPrefix="test" TagName="test1" Src="test1.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>default</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<test:test1 id="myTest" Runat="server" />
</form>
</body>
</html>
and in the control there is no code. i want to add this line in the control
page load.
Page.RegisterStartupScript("ctrlId","<script>var ctrlId='"+this.ClientID
+"_';</script>")

but intellisense doesnt have a clue as to that line, it won't compile. BTW
this is ASP.Net 1.1.

Help

Nov 19 '05 #2
Thanks a million, that did it.

"Curt_C [MVP]" wrote:
Because the Control needs a Page.
Try Parent.Page......

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Pitcairnia" wrote:
I have a user control (.ascx) on a web form (.aspx). So far no code other
than on the page

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="default.aspx.vb"
Inherits="Test.default"%>
<%@ Register TagPrefix="test" TagName="test1" Src="test1.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>default</title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<test:test1 id="myTest" Runat="server" />
</form>
</body>
</html>
and in the control there is no code. i want to add this line in the control
page load.
Page.RegisterStartupScript("ctrlId","<script>var ctrlId='"+this.ClientID
+"_';</script>")

but intellisense doesnt have a clue as to that line, it won't compile. BTW
this is ASP.Net 1.1.

Help

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark | last post by:
I've been reading the following link : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html /aspnet-injectclientsidesc.asp That supposedly tells you how to use these:...
6
by: Bill Jones | last post by:
I'm trying to use this.RegisterStartupScript to add some javascript to and aspx page that will run when the page is loaded. Does anyone know if this function only works in the Page_Load function? ...
2
by: Ollie | last post by:
I use javascript to open a child window from the browser (window.open.....) this is then registered with the system using Page.RegisterStartupScript, it display the child peffectly fine. The...
11
by: Stan Sainte-Rose | last post by:
Hi, I m working on a user control. I need to use a Js file, I would like to know how to load the js file using RegisterStartupScript command from the user control. Also, if I load the same user...
3
by: Mike | last post by:
Hi, I am trying to resize a HTML table through Javascript. When the user control loads the first time, the table is resized, but then it doesn't anymore. I am using the following code in the...
7
by: sck10 | last post by:
Hello, I have the following sub in a class in my "App_Code" directory. The script is for setting focus on a particular control, but I get the error, "Name ClientScript Not declared". Also, I am...
0
by: o0JoeCool0o | last post by:
I am trying to call Page.RegisterStartupScript from a method in a user control. I am getting a null reference error whenever I try to use Page.RegisterStartupScript. I trying to set the focus of...
3
by: MJP | last post by:
I have a button which kicks off the generation of a report after which the file will be downloaded. The report generation can take a long time, so client side onclick event of the button also...
1
by: Crazy Cat | last post by:
In the page load event of my user control I create and register a startup script with RegisterStartupScript. I am passing two controls (using the ClientID property of the controls) into a function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.