Windows Phone Webbrowser - Cannot input text on empty line in contenteditable div - c#

I'm developing a note app in Windows Phone 8.1 and here is a bug I cannot fix.
Say you have an WebBrowser control and loaded a html page, inside which is a content-editable div.
<div id="content" contenteditable="true">
<div>Please edit content here...</div>
</div>
After running this app, I can edit content inside div.
The strange thing is, If I tap return several times, there will be several empty lines. Then I tap empty line before current caret position, and try to input text there. It turns out I cannot input text there, and text will always append to last line of the entire div.
content here...
(Wish to insert text here.)
But text goes here.
I tested it on my lumia 925 device running Windows Phone 8.1 and using Chinse Input Method.

Related

Selenium WebDriver C# Element not visible and unable to enter Data in Text Field

The URL of website is http://www.mca.gov.in/mcafoportal/viewCompanyMasterData.do
and when I click the Search icon beside Company/LLP Name it opens an overlay
with a text input to enter the company name, but the element is not visible in Selenium Webdriver C#
Here's the Screenshot of the wepPage
Below is the HTML code for Text Field
<input type="text" size="40" id="searchcompanyname" name="searchcompanyname" onkeydown="javascript: if (event.keyCode==13) return fetchCINData();">
and here's my C# code
IWebDriver chrome = new ChromeDriver("C:\\");
chrome.Navigate().GoToUrl("http://www.mca.gov.in/mcafoportal/viewCompanyMasterData.do");
chrome.FindElement(By.XPath(".//*[#id='imgSearchIcon']")).Click();
bool a = chrome.FindElement(By.CssSelector("input[type=text][name='searchcompanyname']")).Displayed;
MessageBox.Show(""+a,"");
When you click the search icon it takes +1 seconds for the form and the search input to get displayed, But in your code you're checking the element right after clicking the search icon which will take just a couple of milliseconds.
So you need to wait before doing that, maybe using Thread.Sleep(2000);
Or better keep checking if the element is displayed each -maybe- 500 ms.

printing a chat link in Chrome along with page contents which is a bug

I have a web page (Angular html5, css3, mvc made) and it has some contents in it. User can print it (There is no separate print button but one can right click and choose print). Now, it prints the contents, but along with the content, it also print the heading or content of a chat link (Small pop up box which opens when you click on that). I don't want the heading or contents of this lightbox to be printed, which is the case in IE, Firefox, but in Chrome it prints the lightbox contents too :(
On my search, I found this, helps me, but I dont know where to use the no-print class as I do not have a separate print button or functionality in my code.
How do I hide an element when printing a web page?
Please help
You apply the no-print class to the elements you want to hide when a user prints, such as your chat popup.
<header class="no-print">
<h1>My app</h1>
</header>
<p>Content</p>
<div class="no-print">
<h1>Chat popup</h1>
</div>
The content would print, but the header and chat dialog would not.

C# Email - New lines not rendering with white-space: pre-wrap

I have an email with a table and one value contains a string with multiple lines. (enter-key) When viewed in outlook or view source in IE, the white-space is not working.
Any idea or any solution?
Thanks.
This is related to Outlook (not C#). I have the same problem (using Java to send mail). I am using CSS style white-space:pre-wrap; on a span and it works well to preserve tabs, spaces, new lines and wrap text in GMail - web, Android and iOS.
As per my experimentation on Outlook 2016 Windows app and webapp (outlook.office365.com):
Value pre-wrap does not preserve new lines in both Windows app and webapp
Value pre preserves new lines in Windows app, but does not do so in webapp
New lines within html are not rendered as such. You need to add <br> tags at the end of each line to make sure that the email is rendered correctly with the new lines.
You can do this within your c# code by replacing every new line character in your problematic value with <br>.

Append Meta Tag in Html - Win Phone 8 - C#

Im building a Windows Phone 8 App which has a webbrowser. I would like append a meta tag inside the head tag on the page which is shown in my webbrowser.
I've tried it with this but it gives me a System Exception Error 80020101.
WebBrowser.InvokeScript("eval", #"document.getElementsByTagName(""head"")[0].appendChild(""<meta
name=""viewport"" content=""user-scalable=no"">"")");
I was told to try it with this code below but I dont think you can use that in C#.
link=document.createElement('link');
link.href='href';
link.rel='rel';
document.getElementsByTagName('head')[0].appendChild(link);
First of all make sure this property is set on your webBrowser object:
webBrowser.IsScriptEnabled = true;
Then you should also probably check your javascript method in the desktop IE11 debugger, whether the code actually works as expected. Adding new meta tags into your page might not be that easy.

ASP.NET Page loads slow as a popup, but not standalone link

Got a strange one, here.
I'm working on a basic ASP.NET/C# code-behind app where summary data is listed in a grid, and each record has an accompanying "update" button. Clicking the button triggers a window.open() where the ID for each row of the grid is passed into a query string to retrieve the related record for edit in the new window.
Example from the rendered "grid" page:
window.open('EditTool.aspx?ID=' + ID, 'new_window', width=550, height=300');
When the page opens from the button, it can take upwards of 10 seconds to render. When I open a new tab and just paste the URL and query string content into the address bar, the page renders almost immediately.
I've peppered the content of the page with log4net statements, and it looks like all of the controls and code-behind C# executes in a few milliseconds.
For investigation's sake, I've got popup blockers deactivated, and I've tried this on IE7 (workplace standard, ugh), FF, and Chrome.
Any ideas as to how to make the rendering faster, or where else I can look to see what's slowing it down?
Update:
I've created a new shell webapp that has a button opening an empty (just the stuff that gets added when you "Add New Item") ASPX as a popup. The popup renders immediately. I've also modified my existing app to open an empty popup, and I get the same delay. It's looking like the app server is waiting to process something before it starts processing the page, rather than rendering the page, slowly.
Does ASP.NET have a setting where you can tell it not to recompile a page on each render?

Categories