I used to work with a developer who, selects a text in aspx page and applies a keyboard shortcut to enclose it in double quotes.
Eg: runat=server. when i select server and press ctrl+somekey, it should be runat="server"
Could someone tell me what is the keyboard shortcut, i tried googling a lot, but couldnt find one..
Currently we are overhauling a page, and need this badly...
Thanks in advance.
As far as I know this is a setting in Visual Studio which enables you to immediatelly place quotes when you type attribute and press equals sign or if you type a few letter and press CTRL+Space. This will autocomplete the attribute and place quotes. In order to enable the quotes click on Tools then Options. If it is not checked, check Show all settings. Expand Text Editor, then HTML and click on Formatting. On the right side enable Insert attribute values quote when typing and Insert attribute value quotes when formatting
Format selection: ctrl+k, ctrl+f
I also have Tools > Options > HTML > Formatting > Insert attribute value quotes when formatting checked.
I think you should try this with the replace function
search : runat=server
replace: runat="server"
The developer may have been using a refactoring tool such as CodeRush or Resharper. Have a look at this link for how you may be able to do something similar without extra tools.
Related
I've got some dynamically generated html building a drop down menu using the Dojo library. I need to make my code Accessibility compliant and right now the screenreader looks at the menu item and reads it as plain html:
menu.addChild(new MenuItem({
label: "<a onclick=window.location.href='sampleurl.com'
href="sampleurl.com">Sample Link</a> ...
Excuse the onclick, it's for a different issue, but what I'm getting is basically:
Tab down to first menu item
Screenreader: "Less than a onclick equals window dot location dot href equals sampleurl"... etc
I've tried using aria-hidden, but the screen reader just reads that as text, I'm using voice over on Mac OS, but I need it compliant for JAWS as well. Any tips or advice? Thanks!
label is used for the label (which can be in HTML), not for putting the full link html tag.
See on the following page how to use the Dojo library to generate menu items:
https://dojotoolkit.org/reference-guide/1.10/dijit/Menu.html
Example:
menu.addChild(new MenuItem({
label: "Sample Link",
onclick: function() {window.location.href='sampleurl.com';}}));
This would be easier to debug with a working example along with something stating what screen reader / browser combo you are using. At the bare minimum, show us the HTML output of your script, considering it is writing HTML for the screen reader to parse.
That being said, I suspect the missing / inconsistent quotes. Note that you start a string with double quotes, then go into the onclick attribute with no quotes around, then single quotes around its value, and then use double quotes around the href.
Alternatively, you are writing the entire string into the page and somehow HTML encoding it.
I suggest using a linting tool to check your JS.
I can't work out why the first characters of all the labels on my asp login forms are showing in italics:
The code looks like this:
<asp:login DestinationPageUrl="blah.aspx" runat="server" usernamelabeltext="Email Address" ></asp:login>
When I inspect it using firebug it shows that the first characters are being enclosed in tags, like so:
<label for="ctl00_ctl00_ctl00_ContentPlaceHolderDefault_wwContentArea_ctl03_UserName">
<em>E</em>
mail Address
</label>
...
<label for="ctl00_ctl00_ctl00_ContentPlaceHolderDefault_wwContentArea_ctl03_Password">
<em>P</em>
assword:
</label>
Does anyone know what may be causing this? I thought it might have been something to do with access keys (if I press alt+e then it focuses to the email text box) but I cant work out how to stop this.
For me, it was because I was using the CSS Friendly Control Adapters. Since my primary motivation for installing them was for the menu control adapter, I've disabled the login control adapter.
Open the CSSFriendAdapters.browser in the App_Browsers folder.
Comment out the LoginAdapter, like so:
<!--<adapter controlType="System.Web.UI.WebControls.Login" adapterType="CSSFriendly.LoginAdapter" />-->
There's probably a way to get the advantages of the CSS adapter without the italics.
I can't answer why it was doing it, but I've managed to work around it.
With the line of code still as follows:
<asp:login DestinationPageUrl="/schools/what-works/whatworkssearch.aspx" runat="server" usernamelabeltext="Email Address"></asp:login>
This is what the control looked like in designer view:
Although there are no italics shown, it was being rendered with the first characters in italics as I described in my question. To get around this I converted the control to a template like so:
This created a template that shows the labels for the login fields and therefore I could remove the italics tags.
Although this doesn't answer why it was behaving like this for the single line of code, it shows how to get around it.
You may want to check the AccessKey property of the login control and the individual controls pasted within the login section such as Label, TextBox and buttons. By removing the AccessKey value should fix the issue.
I've got combobox inside some panel :
<ajaxToolkit:ComboBox
ID="YearList"
runat="server"
OnInit="YearList_Init1"
EnableTheming="false"
Width="45px"
ViewStateMode="Disabled" />
and it was OK before I updated project to .NET 4 , after updating project (And AJAX) to .net4 it's looking like really strange ... I can't explain it proper , I will show :
how can I fix it ? :) Full CSS / ASPX page here -> https://github.com/nCdy/Issues/tree/master/Ajax%20ComboBox (string # 287)
I had a similar issue and could resolve mine by removing the extender that I had added to the Panel containing the combobox. I had used a DropShadowExtender for the Panel, removing it caused the combobox to be displayed perfectly. Perhaps you can try that as well.
i am seeing a lot of texts like
Контрактный час
:
, every where in your form. So i need to know, are you using some sort of encoding , that is, is this placed by you or came unexpectedly. If you havent placed it, remove all unneccessary such lines and use plain text instead (if required). Then check the layout.
Also in your image, i can see , ur language is russian(if i am right :)). So try using your localized font that is direcly supported by aspx as we use english or better use resource file instead of the hardcoded text on the page. As per my view the language conversion is creating such issue.
In VS2008, it used to be that whenever I was typing an html attribute in an .aspx page when I hit '=' a pair of double quotes was automatically inserted and the cursor placed inside them. I guess I've changed a setting, but I don't know what to change to get that functionality back.
I am using Resharper if it makes a difference.
In VS2008. Tools -> Options -> Text Editor -> HTML -> Format -> Click "Insert attribute value quotes when typing".
Not sure how this is impacted with Resharper.
I have an ASP.NET MVC application and I'm using CKEditor for text entry. I have turned off input validation so the HTML created from CKEditor can be passed into the controller action. I am then showing the entered HTML on a web page.
I only have certain buttons on CKEditor enabled, but obviously someone could send whatever text they want down. I want to be able to show the HTML on the page after the user has entered it. How can I validate the input, but still be able to show the few things that are enabled in the editor?
So basically I want to sanitize everything except for a few key things like bold, italics, lists and links. This needs to be done server side.
How about AntiXSS?
See my full answer here from similar question:
I have found that replacing the angel
brackets with encoded angel brackets
solves most problems
You could create a "whitelist" of sorts for the html tags you'd like to allow. You could start by HTML encoding the whole thing. Then, replace a series of "allowed" sequences, such as:
"<strong>" and "</strong>" back to "<strong>" and "</strong>"
"<em>" and "</em>" back to "<em>" and "</em>"
"<li>" and "</li>" back to ... etc. etc.
For things like the A tag, you could resort to a regular expression (since you'd want the href attribute to be allowed too). You would still want to be careful about XSS; someone else already recommended AntiXSS.
Sample Regexp to replace the A tags:
<a href="([^"]+)">
Then replace as
<a href="$1">
Good luck!