|
Hey,
Let me clear you a bit. Whenever we talk about WEB there are 2 computers involved. One is server, where IIS is running, and the other is Calling Computer, which uses only browser to get the output.
It is very easier to add dll in the server side, or API calls from the server computer, but 30 times tough if you want it from the client using Browser.
If you have an option so that you can connect the device through LAN using network from your server, then its just paste the code that your windows program has(slight alteration might be needed) and get the work done easily. But if you want the client computer to use the lan, it would be quite impossible (At least have to create Browser plugin for API calls)
Hope you got my point.
|
|
|
|
|
I want to popup an aspx page from a function using the following code..
string strScript = null;
ClientScriptManager ClientScript;
strScript = "window.open('popupContent.aspx','new_Win','height=650,width=250,resizable=0')";
ClientScript.RegisterClientScriptBlock(this.GetType(), "popup", strScript, true);
But it's not allow me to compile..showing that
Error Use of unassigned local variable 'ClientScript'
How can i resolve this?
Thanks
Md. Marufuzzaman
|
|
|
|
|
string strScript = null;
ClientScriptManager ClientScript;
strScript = "window.open('popupContent.aspx','new_Win','height=650,width=250,resizable=0')";
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "popup", strScript, true);
You do not need to define a new client script manager. Page class already has one
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.
|
|
|
|
|
Thanks for your help... but when i try as you suggest i get another error..
Error 1 ' does not contain a definition for 'ClientScript' and no extension method 'ClientScript' accepting a first argument of type 'GUInterface.SqlManager' could be found (are you missing a using directive or an assembly reference?)
I dont know why....
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
|
|
|
|
|
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.
|
|
|
|