473,386 Members | 1,706 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,386 software developers and data experts.

RegisterStartupScript Question.

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? Or can I put it anywhere.
Right now it is inside the eventhandler function that is called on the
"CheckChanged" event of a checkbox, but it never seems to add the javascript
code to the page. Is there another way to do this? Let me explain the
problem:

I have a page with a bunch of checkboxes. Each checkbox forces a postback.
In the eventhandler function for the "CheckChanged" event of the checkboxes
I need to determine if two values match each other. If they do, then I want
to use some javascript to open a modal dialog to allow for the input of two
new values. Make sense? Any help would be great! Thanks.

- Bill Jones
Nov 18 '05 #1
6 992
Bill Jones wrote:
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? Or can I put it anywhere.
Right now it is inside the eventhandler function that is called on the
"CheckChanged" event of a checkbox, but it never seems to add the javascript
code to the page. Is there another way to do this? Let me explain the
problem:

I have a page with a bunch of checkboxes. Each checkbox forces a postback.
In the eventhandler function for the "CheckChanged" event of the checkboxes
I need to determine if two values match each other. If they do, then I want
to use some javascript to open a modal dialog to allow for the input of two
new values. Make sense? Any help would be great! Thanks.

- Bill Jones


Yes, you can use it anywhere in code-behind; it will get added to the
response output. Are you positive the event is being run, have you
stepped thru in debug mode?

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #2
Bill,

Is your checkbox control set to runat=server? Is the AutoPostBack=True?

You can put this anywhere. In your CheckChanged event sub, you can put:

Dim sb As New System.Text.StringBuilder
sb.Append("<script language='javascript'>")
sb.Append("window.open('mypage.aspx','help','width =400,height=400,left=100,t
op=100,toolbars=no,status=no,scrollbars=yes,resiza ble=yes');")
sb.Append("</script>")
RegisterStartupScript("stp", sb.ToString)

or whatever your code is your using to open a modal dialog, the above opens
a window, but its just an example

HTH,

Raymond Lewallen

"Bill Jones" <wj****@actcci.com> wrote in message
news:#K**************@TK2MSFTNGP10.phx.gbl...
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? Or can I put it anywhere.
Right now it is inside the eventhandler function that is called on the
"CheckChanged" event of a checkbox, but it never seems to add the javascript code to the page. Is there another way to do this? Let me explain the
problem:

I have a page with a bunch of checkboxes. Each checkbox forces a postback. In the eventhandler function for the "CheckChanged" event of the checkboxes I need to determine if two values match each other. If they do, then I want to use some javascript to open a modal dialog to allow for the input of two new values. Make sense? Any help would be great! Thanks.

- Bill Jones

Nov 18 '05 #3

One place you shouldn't call them is Render; as a rule I always call them in PreRender.

Scott
"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Bill Jones wrote:
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? Or can I put it anywhere.
Right now it is inside the eventhandler function that is called on the
"CheckChanged" event of a checkbox, but it never seems to add the javascript
code to the page. Is there another way to do this? Let me explain the
problem:

I have a page with a bunch of checkboxes. Each checkbox forces a postback.
In the eventhandler function for the "CheckChanged" event of the checkboxes
I need to determine if two values match each other. If they do, then I want
to use some javascript to open a modal dialog to allow for the input of two
new values. Make sense? Any help would be great! Thanks.

- Bill Jones


Yes, you can use it anywhere in code-behind; it will get added to the
response output. Are you positive the event is being run, have you
stepped thru in debug mode?

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET

Nov 18 '05 #4
Scott wrote:
One place you shouldn't call them is Render; as a rule I always call them in PreRender.

Scott
"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Bill Jones wrote:

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? Or can I put it anywhere.
Right now it is inside the eventhandler function that is called on the
"CheckChanged" event of a checkbox, but it never seems to add the javascript
code to the page. Is there another way to do this? Let me explain the
problem:

I have a page with a bunch of checkboxes. Each checkbox forces a postback.
In the eventhandler function for the "CheckChanged" event of the checkboxes
I need to determine if two values match each other. If they do, then I want
to use some javascript to open a modal dialog to allow for the input of two
new values. Make sense? Any help would be great! Thanks.

- Bill Jones


Yes, you can use it anywhere in code-behind; it will get added to the
response output. Are you positive the event is being run, have you
stepped thru in debug mode?

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET


Ah, yes, there are places you could potentially cause trouble. My
statement should be for normal page event processing, where we usually
aren't dealing with page events mostly outside of Page_Load. Some of
the other events could (may or may not) get you in trouble :-) Still
not the best description by me, but thanx for the clarification...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #5
Yeah, the event is being run, and the RegisterStartupScript line is
executing error free. I tried using this.Page.RegisterStartupScript,
this.RegisterStartupScript, Page.RegisterStartupScript, and just
RegisterStartupScript. When I do a view source on the rendered page, I do
not see the javascript code anywhere. I added a protected override void
OnPreRender(EventArgs e) function and added break point within. When I
stepped through the code, all of the eventhandling code was executing prior
to the OnPreRender function being called, which makes me think that this
should work. Thanks again for any input.

Here is the code. One thing I did not mention before is that the checkbox
controls are being added to the page programatically in the
buildEmptyCalendar function. The code below is the Page_Load function, the
buildEmptyCalendar function, and the eventhandler for when the CheckChanged
event is called, timeSelect, along with the code generated by visual studio.
The line calling RegisterStartupScript is noted in the timeSelect function:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using com.actcci.schedule.sched_bl;

namespace com.actcci.schedule.schedules
{
/// <summary>
/// Summary description for custompattern2.
/// </summary>
public class custompattern2 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button ResetPattern;
protected System.Web.UI.WebControls.Button AddWeek;
protected System.Web.UI.WebControls.Button SavePattern;
protected System.Web.UI.WebControls.TextBox IptNumWeeks;
protected System.Web.UI.WebControls.Table PatternTable;
protected System.Web.UI.WebControls.Button RemoveWeek;
protected System.Web.UI.WebControls.DropDownList dd_patterns;
protected System.Web.UI.WebControls.PlaceHolder calHolder;
protected System.Collections.Hashtable sessionsTable;
protected int numweeks;

private void Page_Load(object sender, System.EventArgs e){
numweeks = Int32.Parse(IptNumWeeks.Text);
if(!IsPostBack){
buildEmptyCalendar();
}//end if
else{
if(Session["patterntable"] == null){
Response.Write("Session Timed Out");
Response.End();
}//end if
else{
PatternTable = (Table)Session["patterntable"];
}//end else
}//end else

calHolder.Controls.Add(PatternTable);
}

private void buildEmptyCalendar(){
PatternTable = new Table();

TableRow tr = this.weekHeader();

PatternTable.Rows.Add(tr);

TableItemStyle tis = new TableItemStyle();
tis.BackColor = ColorTranslator.FromHtml("#ffffff");
tis.ForeColor = ColorTranslator.FromHtml("#000000");
tis.Width = Unit.Pixel(100);
tis.Height = Unit.Pixel(100);
tis.Font.Size = FontUnit.XSmall;
tis.BorderColor = ColorTranslator.FromHtml("#000000");
tis.BorderStyle = BorderStyle.Solid;
tis.BorderWidth = Unit.Pixel(1);

listOfValues tsession = new listOfValues("truesession");

TableCell tc = null;
CheckBox chkbx = null;
TextBox fromtime = null;
TextBox totime = null;
string idpre = null;
for(int currweek=0;currweek<numweeks;currweek++){
tr = new TableRow();
for(int x=0;x<7;x++){
tc = new TableCell();
tc.ApplyStyle(tis);
for(int y=0;y<tsession.Count();y++){
chkbx = new CheckBox();
chkbx.Text = tsession.listItem(y).Description
+ "<BR>";
chkbx.AutoPostBack = true;
chkbx.CheckedChanged += new
System.EventHandler(this.timeSelect);
idpre = Convert.ToString((x + (currweek *
7)));
while(idpre.Length < 3){
idpre = "0" + idpre;
}//end while
chkbx.ID = idpre+ "chk" +
tsession.listItem(y).Val;
tc.Controls.Add(chkbx);
}//end for

fromtime = new TextBox();
fromtime.ID = idpre + "fromtime";
totime = new TextBox();
totime.ID = idpre + "totime";

tc.Controls.Add(fromtime);
tc.Controls.Add(totime);

tr.Cells.Add(tc);
}//end for
PatternTable.Rows.Add(tr);
}//end for

TableStyle ts = new TableStyle();
ts.CellPadding = 0;
ts.CellSpacing = 0;

PatternTable.ApplyStyle(ts);

Session["patterntable"] = PatternTable;
}//end private void buildEmptyCalendar()

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.AddWeek.Click += new System.EventHandler(this.AddWeek_Click);
this.RemoveWeek.Click += new System.EventHandler(this.RemoveWeek_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion
private void timeSelect(object sender, System.EventArgs e){
CheckBox chkbx = (CheckBox)sender;
string idpre = chkbx.ID.Substring(0,3);

if(Session["sessionsTable"]==null){
sessionsTable = new Hashtable();
}//end if
else{
sessionsTable = (Hashtable)Session["sessionsTable"];
}//end else

CheckBox oldchk = null;

string key = null;
ArrayList al = new ArrayList(sessionsTable.Keys);
for(int x=sessionsTable.Count-1;x>=0;x--){
key = (string)al[x];
if(key.IndexOf(idpre) >= 0){
oldchk = (CheckBox)PatternTable.FindControl(key);
oldchk.Checked = false;
sessionsTable.Remove(key);
}//end if
}//end foreach

if(chkbx.Checked){
actSession acts = new
actSession(chkbx.ID.Substring(chkbx.ID.Length - 3));
sessionsTable.Add(chkbx.ID,acts);
TextBox tbx = (TextBox)PatternTable.FindControl(idpre +
"fromtime");
tbx.Text = acts.fromTime.ToShortTimeString();
tbx = (TextBox)PatternTable.FindControl(idpre +
"totime");
tbx.Text = acts.toTime.ToShortTimeString();
string jscrpt = null;
if(acts.fromTime.CompareTo(acts.toTime) == 0){
jscrpt = "<script language=\"JavaScript\">";
jscrpt += "alert(\"yo yo fred\")";
jscrpt += "</script>";
string scriptKey = "windowload:" + this.UniqueID;

//HERE IS THE REGISTERSTARTUPSCRIPT LINE

RegisterStartupScript(scriptKey,jscrpt);
}//end if
}//end if
else{
TextBox tbx = (TextBox)PatternTable.FindControl(idpre +
"fromtime");
tbx.Text = null;
tbx = (TextBox)PatternTable.FindControl(idpre +
"totime");
tbx.Text = null;
}//end else

Session["sessionsTable"] = sessionsTable;
Session["patternTable"] = PatternTable;
}//end
}
}


"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:uQ**************@tk2msftngp13.phx.gbl...
Scott wrote:
One place you shouldn't call them is Render; as a rule I always call them in PreRender.
Scott
"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Bill Jones wrote:
I'm trying to use this.RegisterStartupScript to add some javascript to andaspx page that will run when the page is loaded. Does anyone know if thisfunction only works in the Page_Load function? Or can I put it anywhere.Right now it is inside the eventhandler function that is called on the
"CheckChanged" event of a checkbox, but it never seems to add the javascriptcode to the page. Is there another way to do this? Let me explain the
problem:

I have a page with a bunch of checkboxes. Each checkbox forces a postback.In the eventhandler function for the "CheckChanged" event of the checkboxesI need to determine if two values match each other. If they do, then I wantto use some javascript to open a modal dialog to allow for the input of twonew values. Make sense? Any help would be great! Thanks.

- Bill Jones

Yes, you can use it anywhere in code-behind; it will get added to the
response output. Are you positive the event is being run, have you
stepped thru in debug mode?

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET


Ah, yes, there are places you could potentially cause trouble. My
statement should be for normal page event processing, where we usually
aren't dealing with page events mostly outside of Page_Load. Some of
the other events could (may or may not) get you in trouble :-) Still
not the best description by me, but thanx for the clarification...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET

Nov 18 '05 #6

You can't do things like this; that is, you can't create a control tree and stick it into the
session and then add it back in on postback -- you'll have to recreate the table each time. I'm not
sure how you were able to see the postback event on the checkbox fire.... hummmm.....

Here's a sample that does something similar to what you have (you should look into composite
controls if you choose do things this way).

Scott

<%@ Page language="c#" AutoEventWireup="false" trace="true" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>LblCssClass</title>
<script language="C#" runat="server">
private void Page_Load(object sender, EventArgs e)
{
this.EnsureChildControls();
}

protected override void CreateChildControls()
{
Table table = new Table();
TableRow tr = new TableRow();
TableCell td = new TableCell();
CheckBox cb = new CheckBox();
cb.AutoPostBack = true;
cb.CheckedChanged += new EventHandler(CheckBox_Changed);

td.Controls.Add(cb);
tr.Cells.Add(td);
table.Rows.Add(tr);
this.Form1.Controls.Add(table);
}

protected override void OnInit(EventArgs e)
{
this.Load += new EventHandler(Page_Load);
base.OnInit(e);
}

protected void CheckBox_Changed(object sender, EventArgs e)
{
CheckBox cb = (CheckBox)sender;
this.Lbl.Text = "Changed " + cb.Checked;
AddJScript();
}

private void AddJScript()
{
string jscrpt = "<script language=\"JavaScript\">";
jscrpt += "alert(\"yo yo fred\");";
jscrpt += "</";
jscrpt += "script>";
string scriptKey = "windowload:" + this.UniqueID;
RegisterStartupScript(scriptKey,jscrpt);
}
</script>
</head>
<body>
<form id="Form1" method="post" runat="server">
<p>
<asp:label id="Lbl" runat="server">Hello</asp:label></p>
</form>
</body>
</html>

"Bill Jones" <wj****@actcci.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
Yeah, the event is being run, and the RegisterStartupScript line is
executing error free. I tried using this.Page.RegisterStartupScript,
this.RegisterStartupScript, Page.RegisterStartupScript, and just
RegisterStartupScript. When I do a view source on the rendered page, I do
not see the javascript code anywhere. I added a protected override void
OnPreRender(EventArgs e) function and added break point within. When I
stepped through the code, all of the eventhandling code was executing prior
to the OnPreRender function being called, which makes me think that this
should work. Thanks again for any input.

Here is the code. One thing I did not mention before is that the checkbox
controls are being added to the page programatically in the
buildEmptyCalendar function. The code below is the Page_Load function, the
buildEmptyCalendar function, and the eventhandler for when the CheckChanged
event is called, timeSelect, along with the code generated by visual studio.
The line calling RegisterStartupScript is noted in the timeSelect function:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using com.actcci.schedule.sched_bl;

namespace com.actcci.schedule.schedules
{
/// <summary>
/// Summary description for custompattern2.
/// </summary>
public class custompattern2 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button ResetPattern;
protected System.Web.UI.WebControls.Button AddWeek;
protected System.Web.UI.WebControls.Button SavePattern;
protected System.Web.UI.WebControls.TextBox IptNumWeeks;
protected System.Web.UI.WebControls.Table PatternTable;
protected System.Web.UI.WebControls.Button RemoveWeek;
protected System.Web.UI.WebControls.DropDownList dd_patterns;
protected System.Web.UI.WebControls.PlaceHolder calHolder;
protected System.Collections.Hashtable sessionsTable;
protected int numweeks;

private void Page_Load(object sender, System.EventArgs e){
numweeks = Int32.Parse(IptNumWeeks.Text);
if(!IsPostBack){
buildEmptyCalendar();
}//end if
else{
if(Session["patterntable"] == null){
Response.Write("Session Timed Out");
Response.End();
}//end if
else{
PatternTable = (Table)Session["patterntable"];
}//end else
}//end else

calHolder.Controls.Add(PatternTable);
}

private void buildEmptyCalendar(){
PatternTable = new Table();

TableRow tr = this.weekHeader();

PatternTable.Rows.Add(tr);

TableItemStyle tis = new TableItemStyle();
tis.BackColor = ColorTranslator.FromHtml("#ffffff");
tis.ForeColor = ColorTranslator.FromHtml("#000000");
tis.Width = Unit.Pixel(100);
tis.Height = Unit.Pixel(100);
tis.Font.Size = FontUnit.XSmall;
tis.BorderColor = ColorTranslator.FromHtml("#000000");
tis.BorderStyle = BorderStyle.Solid;
tis.BorderWidth = Unit.Pixel(1);

listOfValues tsession = new listOfValues("truesession");

TableCell tc = null;
CheckBox chkbx = null;
TextBox fromtime = null;
TextBox totime = null;
string idpre = null;
for(int currweek=0;currweek<numweeks;currweek++){
tr = new TableRow();
for(int x=0;x<7;x++){
tc = new TableCell();
tc.ApplyStyle(tis);
for(int y=0;y<tsession.Count();y++){
chkbx = new CheckBox();
chkbx.Text = tsession.listItem(y).Description
+ "<BR>";
chkbx.AutoPostBack = true;
chkbx.CheckedChanged += new
System.EventHandler(this.timeSelect);
idpre = Convert.ToString((x + (currweek *
7)));
while(idpre.Length < 3){
idpre = "0" + idpre;
}//end while
chkbx.ID = idpre+ "chk" +
tsession.listItem(y).Val;
tc.Controls.Add(chkbx);
}//end for

fromtime = new TextBox();
fromtime.ID = idpre + "fromtime";
totime = new TextBox();
totime.ID = idpre + "totime";

tc.Controls.Add(fromtime);
tc.Controls.Add(totime);

tr.Cells.Add(tc);
}//end for
PatternTable.Rows.Add(tr);
}//end for

TableStyle ts = new TableStyle();
ts.CellPadding = 0;
ts.CellSpacing = 0;

PatternTable.ApplyStyle(ts);

Session["patterntable"] = PatternTable;
}//end private void buildEmptyCalendar()

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.AddWeek.Click += new System.EventHandler(this.AddWeek_Click);
this.RemoveWeek.Click += new System.EventHandler(this.RemoveWeek_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion
private void timeSelect(object sender, System.EventArgs e){
CheckBox chkbx = (CheckBox)sender;
string idpre = chkbx.ID.Substring(0,3);

if(Session["sessionsTable"]==null){
sessionsTable = new Hashtable();
}//end if
else{
sessionsTable = (Hashtable)Session["sessionsTable"];
}//end else

CheckBox oldchk = null;

string key = null;
ArrayList al = new ArrayList(sessionsTable.Keys);
for(int x=sessionsTable.Count-1;x>=0;x--){
key = (string)al[x];
if(key.IndexOf(idpre) >= 0){
oldchk = (CheckBox)PatternTable.FindControl(key);
oldchk.Checked = false;
sessionsTable.Remove(key);
}//end if
}//end foreach

if(chkbx.Checked){
actSession acts = new
actSession(chkbx.ID.Substring(chkbx.ID.Length - 3));
sessionsTable.Add(chkbx.ID,acts);
TextBox tbx = (TextBox)PatternTable.FindControl(idpre +
"fromtime");
tbx.Text = acts.fromTime.ToShortTimeString();
tbx = (TextBox)PatternTable.FindControl(idpre +
"totime");
tbx.Text = acts.toTime.ToShortTimeString();
string jscrpt = null;
if(acts.fromTime.CompareTo(acts.toTime) == 0){
jscrpt = "<script language=\"JavaScript\">";
jscrpt += "alert(\"yo yo fred\")";
jscrpt += "</script>";
string scriptKey = "windowload:" + this.UniqueID;

//HERE IS THE REGISTERSTARTUPSCRIPT LINE

RegisterStartupScript(scriptKey,jscrpt);
}//end if
}//end if
else{
TextBox tbx = (TextBox)PatternTable.FindControl(idpre +
"fromtime");
tbx.Text = null;
tbx = (TextBox)PatternTable.FindControl(idpre +
"totime");
tbx.Text = null;
}//end else

Session["sessionsTable"] = sessionsTable;
Session["patternTable"] = PatternTable;
}//end
}
}


"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:uQ**************@tk2msftngp13.phx.gbl...
Scott wrote:
One place you shouldn't call them is Render; as a rule I always call them in PreRender.
Scott
"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...

>Bill Jones wrote:
>
>
>>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? Or can I put it anywhere.>>Right now it is inside the eventhandler function that is called on the
>>"CheckChanged" event of a checkbox, but it never seems to add the javascript>>code to the page. Is there another way to do this? Let me explain the
>>problem:
>>
>>I have a page with a bunch of checkboxes. Each checkbox forces a postback.>>In the eventhandler function for the "CheckChanged" event of the checkboxes>>I need to determine if two values match each other. If they do, then I want>>to use some javascript to open a modal dialog to allow for the input of two>>new values. Make sense? Any help would be great! Thanks.
>>
>>- Bill Jones
>>
>>
>
>Yes, you can use it anywhere in code-behind; it will get added to the
>response output. Are you positive the event is being run, have you
>stepped thru in debug mode?
>
>--
>Craig Deelsnyder
>Microsoft MVP - ASP/ASP.NET

Ah, yes, there are places you could potentially cause trouble. My
statement should be for normal page event processing, where we usually
aren't dealing with page events mostly outside of Page_Load. Some of
the other events could (may or may not) get you in trouble :-) Still
not the best description by me, but thanx for the clarification...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET


Nov 18 '05 #7

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

Similar topics

3
by: Lukman | last post by:
Hi, Could you tell me about what is RegisterStartupScript, I try to understand from MSDN sample, but I still don't understand. Could you give me more simple sample ? and what is the purpose of...
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? ...
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...
2
by: Guadala Harry | last post by:
I have a frameset aspx page that enables users to upload photos. One frame/page shows a thumbnail list of prevously-uploaded images, and the other frame/page includes the controls that enable...
0
by: rom | last post by:
my main aspx page has 3 user controls. they are all located in the same place of the page and each time i set the visibility of 2 of them to false and 1 to true. now, i want to use the...
5
by: Ahmed | last post by:
Hi all, Is there any way to replace a script I registered in Page Load with the method Page.RegisterStartupScript
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...
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...
3
by: Rob | last post by:
Hi, We've developed an ajax enabled web app which we're currently deploying to our production server. We use System.Web.UI.Page.RegisterStartupScript throughout the app, and all has worked well...
4
by: =?Utf-8?B?RHVuZTg4?= | last post by:
I've got some code that uses Page.ClientScript.RegisterStartupScript to call a javascript function from the Page_Load method in the code behind. The code works fine in IE but the javascript...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.