|
Small change in your code:
string strScript = null;
ClientScriptManager ClientScript = Page.ClientScript;
strScript = "window.open('popupContent.aspx','new_Win','height=650,width=250,resizable=0')";
ClientScript.RegisterClientScriptBlock(this.GetType(), "popup", strScript, true);
View line number 2.
|
|
|
|
|
Zoki Manas wrote: ClientScriptManager ClientScript = Page.ClientScript;
Why to create a new object unnecesarily ?
Btw, I noticed your last name is Manas.
In Hindi, it means some one who is very close to heart. What does it mean in your language?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
|
Manas Bhardwaj wrote: Why to create a new object unnecesarily ?
There's no object created there... just a reference to one which already exists on the Page class.
|
|
|
|
|
Manas Bhardwaj wrote: Why to create a new object unnecesarily ?
There is no harm in doing so.
|
|
|
|
|
|
Rather than using RegisterClientScriptBlock , it is better to use RegisterStarupScript
use
if(!this.ClientScript.IsClientScriptBlockRegistered("myscript"))
this.ClientScript.RegisterStartupScript(this.GetType(), "myscript", strScript , true);
Hope this helps.
|
|
|
|
|
Thanks.. Could you please tell me why RegisterStarupScript is better rather then the RegisterClientScriptBlock
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
Thanks
Md. Marufuzzaman
|
|
|
|
|
Make sure one things : if you have AJAX Script Manager in your page, then you have to use ScriptManager rather than ClientScript .
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Thanks for sharing...
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
Thanks
Md. Marufuzzaman
|
|
|
|
|
Yes... RegisterStartupScript places the script after all the objects are rendered while RegisterClientScriptBlock places the JS at the beginning.
Thus say you are calling a javascript using RegisterClientScriptBlock which gets an element, you will find this null, as the script gets executed just before any html is rendered. In case of RegisterStartupScript the script is placed after the html is generated. So If you want to place a javascript call in your html, always use RegisterStartupScript .
Hope you got it. If not I can give you examples.
|
|
|
|
|
Thanks for your excellent explanation..
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
Thanks
Md. Marufuzzaman
|
|
|
|
|
you are most welcome ... budd
|
|
|
|
|
I download a template in online and design my site and i finish my site. When i run IE it does not work button clicks and textbox input values and dropdownlist selected values and every values will be lost postback but it will work properly in firefox what is this error...give any solution to this problem...
Thanks in advance...
|
|
|
|
|
Can U Give u the link to ur Website So Tht We can See Whts going on
Check the source of the ie explorer of ur website
If It Helps Click It as Answer
|
|
|
|
|
http://matrimony.justclicksearch.in
|
|
|
|
|
smraj1503 wrote: http://matrimony.justclicksearch.in
I am using Ie8 and checked its Working Fine
I dont Know theexact Solution Try to clear all privacy data in ie and check it
If It Helps Click It as Answer
|
|
|
|
|
Iam using IE6.0 and clear private data, it does not work...
|
|
|
|
|
Without seeing your code its very difficult to tell
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
|
Can you atleast wrap the code. It is not readable.
Secondly, do you think anybody is gonna read all code of yours. Please narrow it down.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Please don't delete messages. This is Rude.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
are you using asp.net server control?
Share your code to help you.
|
|
|
|
|
I have asked for the code, but i dont know why he deleted his message
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Yes.. this is the most weird thing with some guys...
|
|
|
|