This question already has answers here:
Programmatically close aspx page from code behind
(13 answers)
Closed 9 years ago.
I am Unable to close current asp.net page using C# code. I tried:
ClientScript.RegisterClientScriptBlock(Page.GetType(),
"script",
"window.close();",
true);
I am not getting any error, but it doesn't work.
Try the following link
Programmatically close aspx page from code behind
Based on the scenario it may very. Please read the above thread replies
Also the following link shows the same question
How to close the current tab in the server side button click?
Try this
ClientScript.RegisterStartupScript(typeof(Page),
"closePage",
"window.close();",
true);
Related
This question already has answers here:
Selenium web driver: cannot be scrolled into view
(5 answers)
Closed 4 years ago.
I'm using Selenium to automate an application but when I tried to click on an <a> tag, It throws below error:
Element <a id="play_button" class="clickable myButton margin_t15
lang_57 medium_font" href="javascript:;"> could not be scrolled into
view.
I'm using Selenium with C# and Firefox V62!
Also, I know that the element is hidden, and it will appear 5 seconds after loading the web page! Now how can I fix this error?
I also tried by.xpath(), by.name() and too many methods like these!
Here is my code:
IWebDriver driver = new FirefoxDriver();
driver.Url = "The Web Site";
driver.FindElement(By.Id("play_button")).Click();
You can use the following code to fix the problem:
IJavascriptExecutor js = (IJavascriptExecutor) driver;
button = river.FindElement(By.Id("play_button"));
jse.executeScript("arguments[0].scrollIntoView(true);", button);
button.Click()
PS: You can also use explicit wait to be clickable the element and after that click on it.
Hope it helps you!
This question already has answers here:
In my WPF application, my loaded PNG logo in image shows at design time but not at run time
(4 answers)
Closed 7 years ago.
How to use resource image in WPF image source.I given like below,
<Image Source="pack://siteoforigin:,,,/Resources/008.jpg"/>.
But it displays in edit page.If i run the application it not displaying in the window.
Please help me to solve this.
Thanks.
you need to provide the correct URI to the resource, and the URI depends on the method you used to add the resource this post give the details you need
How to Embed resources
You can add your image to your project Properties.Resources.Images and then use them like that:
<Image Source="{x:Static Properties:Resources.YourImageName}"/>
EDIT >>>>
I've forgotten to say that you have to add this line at the top:
<xmlns:Properties="clr-namespace:yournamespace.Properties"/>
This question already has answers here:
Load a ResourceDictionary from an assembly
(3 answers)
Closed 8 years ago.
I'm having some issues. I want my app to load a ResourceDictonnary dynamically in app.xaml.cs.
This is my code for the moment :
ResourceDictionary theme = XamlReader.Load(???);
Resources.MergedDictionaries.Add(theme);
The problem is, how can I get my ResourceDictionnary stream from the xaml file ? I don't want to copy the xaml file with the exe. It's build action is set to Page and I want to load it.
Can you tell me how to do that ?
Thanks !
try using the following code (I call it from my IModule.Initialize)
Application.Current.Resources.MergedDictionaries
.Add(new ResourceDictionary
{
Source = new Uri(#"pack://application:,,,/My.Application;component/Resources/Resources.xaml")
});
see the project tree in attached image:
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
View Generated Source (After AJAX/JavaScript) in C#
Note : I m' not using ASP.NET and i use a c# Console project.
With a simple html document :
<script type="text/javascript">
eval(function(p,r,o,x,y,s){y=function(c){return(c<r?'':y(parseInt(c/r)))+((c=c%r)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(o--){s[y(o)]=x[o]||y(o)}x=[function(y){return s[y]}];y=function(){return'\\w+'};o=1};while(o--){if(x[o]){p=p.replace(new RegExp('\\b'+y(o)+'\\b','g'),x[o])}}return p}('j=D^C;b=3;h=1;r=7;t=B^E;p=9;g=F^A;f=0;l=5;a=G^I;q=y^u;o=w^z;s=6;d=4;k=2;n=8;m=x^v;i=H^L;e=W^U;c=X^V;J=f^j;S=h^i;M=k^g;T=b^a;K=d^e;N=l^m;O=s^t;R=r^q;Q=n^o;P=p^c;',60,60,'^^^^^^^^^^Three4Two^Seven^One3Nine^Nine^Four4Three^Zero^OneTwoSix^Three^FourSixFive^Five8Four^One^Two^One2Eight^Five^ZeroThreeZero^Six^Nine0Seven^Four^Eight^SevenNineOne^8080^8888^10448^7095^12181^3129^88^11687^8090^3394^1337^3885^9893^12222^9090^ZeroOneNineThree^SixOneTwoOne^8000^ThreeEightThreeTwo^OneOneSixSeven^FourThreeEightZero^Eight2FourEight^Seven0ZeroNine^OneEightFiveSix^EightTwoSevenFive^Four0OneFour^808^1080^11238^10637'.split('\u005e'),0,{}))
document.write((Seven0ZeroNine^ZeroThreeZero));
</script>
Which Display simply "8"
I would like to get this "display" value. I need certainly Webrowser which decodes JavaScript.
WebBrowser web = new WebBrowser();
web.Navigate(#"c:\1.html");
Open a browser console (google it) and try:
console.log("string goes here")
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Disable browser's back button
i have one button on page
on that button click event page will redirect on the next page
now i click on the browser back button
but i want to restrict browser back button for some security purpose
does any one know how to block browser back button so that page can not redirect to previous page?
Do not disable expected browser behaviour and you can handle the possiblity at your end, but if you really want to do so,
there is one work around here...
Just put this javascript on the html section of aspx page above head section.
This causes every back to return with
a forward.
<script type = "text/javascript" >
function disableBackButton()
{
window.history.forward();
}
setTimeout("disableBackButton()", 0);
</script>
Open the webpage in a popup window rather than normal window. So, that you can restrict the popup window from displaying buttons, menus, status and other features.