Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Jscript in a C# button
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00785384
Message ID:
00785468
Vues:
8
Stephen,

I tried you exact code and it worked fine for me after I removed the space.

You can also use the StringBuilder, Page.IsStartupScriptRegistered, and Page.RegisterStartupScript classes to write out your script instead. You put this code in the Page_Load.
StringBuilder sb = new StringBuilder();
sb.Append("<SCRIPT LANGUAGE = \"JavaScript\">");
sb.Append(" window.open('Explain.aspx','MyWindow','width=250, height=300')");
sb.Append("</SCRIPT>");

if (!Page.IsStartupScriptRegistered("newwindow"))
{
	Page.RegisterStartupScript("newwindow", 
		sb.ToString());
}
>Tried that again and it's not working. I have found lot's of references to this and in a variety of languages! Lot's of frowning emoticons too.
>
>2'nd param is Window title, os I need to show a CameCaseWindowTitleForMyUsers? I'll get a few calls on that one!
>
>I don't have a title and I show the toolbar < what I was loking to false anyway> for now.
>
>>Hi Stephen,
>>
>>All you need to do is remove the space in "My Window" to "MyWindow". Then it will work just fine.
>>
>>>I have a need to pop open an change log window :
>>>
>>>int lnses = Convert.ToInt32(Session["Changes"]); // # of changes for log
>>>if (lnses >0)
>>>{
>>>string sScript = " {script language=javascript>";
>>>sScript += " window.open('Explain.aspx')";
>>>sScript += " {/script>";
>>>Response.Write(sScript);
>>>}
>>>This works fine/\
>>>
>>>If I change the .open line to add a title, size or ANYTHING, the .open doesn't fire?
>>>
>>>sScript += " window.open('Explain.aspx','My Window','width=250, height = 300' )";
>>>
>>>Any work arounds ?
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform