I have a JQuery (using JQuery 1.4.2) problem that exhibits only in IE8 in standards mode, on one specific DOM element but not on other nearly identical dom ellements. The best example of why it makes no sense is below:
$('span.error:visible')[0].style.display
The above piece of code returns "none" which unless i am having some sort of brain aneurism is impossible without there being a bug in either JQuery or IE8. This only occurs in IE8 in standards mode, not in any other browser or on IE8 compatiblity mode. The span that it finds is actually an ASP.net validation control so i only have a limited amount if control over what it renders to the browser. When i inspect the DOM using IE8 developer toolbar and copy the HTML from the DOM it gives me the below:
<SPAN style="DISPLAY: none; COLOR: red"
id=ctl00_cphContentBody_mnMainMiddleNames_ebvMiddleName1 class=error
controltovalidate="ctl00_cphContentBody_mnMainMiddleNames_txtMiddleName0"
errormessage="JQuery should not find this" display="Dynamic" validationGroup="MiddleNames"
isvalid="true" validationexpression="[A-Za-z][A-Za-z '-]*[A-Za-z]*">JQuery should not
find this</SPAN>
If i just do a view source and copy and paste it i get the below:
<span id="ctl00_cphContentBody_mnMainMiddleNames_ebvMiddleName1" class="error"
style="color:Red;display:none;">JQuery should not find this</span>
If i create a simple HTML file containing just either of the above pices of HTML then $('span.error:visible') does not find the spans and i am unable to post code to be able to reproduce this problem. But in the actual asp.net page if i run $('span.error:visible')[0].style.display it returns "none" and if i run $('span.error:visible').text() it returns "JQuery should not
find this".
tl;dr How can $('span.error:visible')[0].style.display return "none".
Edit to answer Nicks comment.
$('span.error:visible')[0].offsetWidth returns 3
$('span.error:visible')[0].offsetHeight returns 22
Which is puzzling, i found the below on the Jquery site.
In jQuery 1.3.2 an element is visible
if its browser-reported offsetWidth or
offsetHeight is greater than 0.
THe element isn't visible, but acording to the above JQuery thinks it is. What does this change mean? It means that if your element's CSS display is "none", or any of its parent/ancestor element's display is "none", or if the element's width is 0 and the element's height is 0 then an element will be reported as hidden. So is the above just wrong. Display is "none" but offsetWidth and offsetHeight are not zero
I have an animation that hides the calling button and then shows a panel with text related to the button. The text panel needs to be "display:none" in my CSS because it and the button are part of a control overlay in a seadragon control (don't want it to stop the deep zoom).
When I run the animation, the button fades out, but the text panel does not appear. When I watch the panel's style, the opacity does go to 1, but the display style does not change from none.
I have the following animation block:
[Code]....
And the CSS for the report panel looks like this:
[Code]....
It does fade in if don't use the display style, and instead set the visibility to hidden, but then I can't interact with my deepzoom.
I have a panel and am loading a user control into it. I am trying to set its Visible property to true. But when I say controlFoo.Visible = true, it is not becoming visible. When I add a watch to controlFoo.Visible, it shows False.I have already made sure that its parent control's visbility is set to true. My code is as follows:
My observation so far in the output rendered by a datalist (when I use this user control inside it) is that the value for the name attribute is the same.I want to use this control inside a datalist/repeater such that I'd want a unique value for the input element's name attribute when the datalist/repeater renders. How is this done?
EDIT: My bad obversation. Actually the names are unique. However, when I try to post the page to another web page which outputs the key & value of all the items in Request.Form I don't see the input elements...
In the main code, I just have a panel inside a DataList control. I'm attempting to adjust change the visibility to true or false in the code behind, but it's not having any affect on the panel.
I have a label that is associated with a css class "applycolor", which is applied the first time it is displayed on a page.
[Code]....
defined in css, label.applycolor { width: 200px; color: red; }
Based upon the selection of a radio button, i would like to change its color back to normal. I tried to use lblHomeAdd.Style.Remove("applycolor"); but this did not give me a solution.
I have a <div> element in a web page. I've assigned it an "ID" and made it a server-side control by using "runat=server". How do I define that <div> in the code-behind. I'm been looking at the "System.Web.UI.HtmlControls" namespace and not sure what to use. The reason I need to do this is because within this <div> is a "Submit" button which will cause a postback. When I click the submit button the first thing it does is it executes a procedure to perform edit checks on the various textbox controls. If a control is empty, a message pops up. When the user clicks "Ok" for the message, the <div> disappears because when the form loads, the <div> style.display property is set to "none" by default. Basically, all I want is for the <div> not to disappear when the edit checks are performed and a messagebox pops up.
and it's not recognising that I added the span to the page. Is there something I need to do to make this happen? I have been working in MVC lately, so I haven't had to worry about the relationship between the page & code-behind in a while, but I can't remember any tricks that I had to perform to reference a HTML element in my code.
I'm trying to set a value for an HTML Element within my code-behind. I need to set a <div> elements "display" property to "inline". The way I have it coded is like this:
Code: divContact.Style("display") = "inline"
Is this the right syntax? I only ask because it doesn't seem to work but I don't get a run-time error when the statement is executes. ???
I've been hired to clean up a website that was written by another company. One of the main issues they have is that the navigation menu doesn't always match the content. On closer look, they didn't use a navigation control or an accordion, but made their own user control out of HTML UL's and LI's (see below). Each section is supposed to expand when you click on it to offer sub menus. Any how, I am trying to find a way when the content pages load to force the menu to focus on the correct UL. Any thoughts on how to do this? By the way they wrote this stuff in 2.0, which I guess maybe why they didn't use the Accordion from the AJAX Toolkit.
HTML Code: <div class="left-menu"> <div class="arrowlistmenu"> <h3 id="H3mymessage" class="menuheader expandable" onclick="RedirectBrowser(1)"> My Messages </h3>
[Code] ....
Redirect Browser is defined on the master page:
HTML Code: <script type="text/javascript"> function RedirectBrowser(ID) { if (ID == 1) window.location="MyMessageList.aspx?MessageFolderID=-1"; else if (ID == 2)
[Code] ....
Here is an example of how it is messed up. My Messages should be highlighted but My Profile is.
Now that I put this html inside a Tab containe (subpanel) the Page.Request.Form["Name"].ToString() fail, actually while I was debugging I could not find this element inside Page.Request.Form.
maybe there is another way of accessing the Html element from my c# code?
The controls show up fine on the page, but they don't show up when I view source, nor can I access them from the code behind.If I add the controls in the on_init method, they work. But I have some business rules driving changes to the list of controls itself that require I fire the add method elsewhere. Has anyone seen this before? I'm away from work so I can't copy the exact code.
I have two terrible ideas for how to get it working. One involves some jQuery and a set of hidden controls holding a big array of integers; the other is run the method on_init AND on my other events so the controls at least show up. Both smell like ugly hacks.
I got a asp: label (hidden by css) to which I store something.
I could not use a hiddenfield since you cannot set a css class on it. I need a css class so I can select it in jQuery. I cannot select by Id since asp.net webforms change your id. I cannot use xxxxx.ClientId, since my jQuery script isn't on that form (oh oh, i miss my mvc)
Anyhow, I pop up a dialog, let the user type sth in. When the dialog closes, I set that label to whatever the use typed in the dialog. That work (I'm testing for now using some alerts) but when I add a button, and in it's click event check the value of taht label, it is still what it originally have been though.
Here is the content of my usercontrol (at run time add as many as needed of them to my view):
Code: // Brings up a jQuery UI Dialog containing a textarea to which the user can enter a dispute // Upon close, place that reason in the hidden input we keep for each date. function GetDisputeReason(parent) { var disputeReasonElement = $('.disputeReason', parent); var existingDispute = disputeReasonElement.val(); var win = $('<div><p>Enter your reason for dispute:</p></div>'); var userInput = $('<textarea style="width:100%">' + existingDispute + '
We have an asp.panel that by default is set to visible=false. When a checkbox is clicked the panel is set to visible=true. The checkbox is set to autopostback and viewstate=true as well as the panel's viewstate =true. This code has worked perfectly for several years and suddenly it has started throwing an error on the built in .net java function below. It doesn't do it in the IDE when you run it either. The bold line is where the exception is being thrown.
function
ValidatorCommonOnSubmit() { var result = !Page_BlockSubmit; Page_BlockSubmit = false; event.returnValue = result; return result; }
Still new. What can I add to my site to get picked up by serch engines without paying for services? Right now if I do a search My site does not appear.
Anybody else find the web page editor for Visual Studios (2008) to be horribly buggy? Almost every other time I try to debug a program, it sputters around for a minute or two, and then I get this error: Unable to Start Program [URL]. Element not found. Sometimes it happens two or three times in a row, and each time it leaves a hung browser I have to go and end the process for and then try again, so it can get up to 10 minutes at times just to get the damn debugger going. Really frustrating, especially when it's at the end of the day and I'm trying to finish things up.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="test.ascx.cs" Inherits="UserControls_test" %> <p id="XXX">aaa</p>
and here is the contents of my test.ascx.cs file:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class UserControls_test : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { this.XXX.InnerHtml = "BBB"; } }
I get an error when I refer to the id, "XXX" (underlined above) in code behind which reads: 'UserControls_test' does not contain a definition for 'XXX' and no extension method 'XXX' accepting a first argument of type 'UserControls_test' could be found (are you missing a using directive or an assembly reference?)
I have tried XXX.InnerHtml and I have tried this.XXX.InnerHtml and get same problem.
How do I successfully refer to ID'ed HTML elements in code behind?
I have a webservice I need to call via a link. The webservice returns a pdf document and takes a document Id as a input parameter.Under normal circumstances I could have the link call some code in the code behind which in turn calls the webservice.
However the difficult part about it is I can't add code to the code behind. The reason is it is for some CMS users who want to know what links to add to the page which will download the pdfs. I can only add the link to the aspx page.
I have an Outer gridview (called grdvOUTERGRIDVIEW) and an Inner Gridview (called grdvOUTERGRIDVIEW) and I am able to see and use the outer gridview in my codep-behind vb page however when I try to handle an event for the Inner gridview then I get the warning: "handles clause requires a withevents variable defined in the containing type or one of its base types".
After creating the inner gridview I closed the page out and re-opened it however still getting that error and not able to create the grdvINNERGRIDVIEW.RowDataBound event function like I am trying to do.
In ASP .NET 2.0, I've created a user control which is meant to work as a dropdown or popup by using an <input type="button" id="btnTogglePopup" runat="server" style="display:inline"... /> and <div id="divPopup" runat="server" style="display:none" ... /> the rest of the controls are contained inside this div, and they do mantain their values between posts, etc. This button 'runs at server' but it's not intended to post back or submit.It just toggles the popup (div) visible/hidden using Javascript client code by setting the div's style display property to "none" or "block" The problem I'm having is that when a page containing this control posts back, the state visible/hidden of the div is not maintained. If the user had the popup open, after the postback, it will display closed.I've read a bunch by now about ViewState & ControlState, and have the save and load contol state methods working, but when I step thru them they load old values (setting the popup to hidden all the time),and the popup doesn't work! I've come to think that b/c when the button is clicked,the visible state of the div is changed in client code w/o a postback, maybe I have to maintain this state info in a hidden fiel or something like that?At the same time I don't want to have a hidden field if it's unnecessary,and I may just doing something wrong.
I'm looking at an asp.net application, i notice that there are assemblies defined into two places. In web.config there is configuration/system.web/compilation/assemblies/add elements. In the project file there are references setup under the Project/ItemGroup/Reference elements.
I was wondering, what is the difference between assemblies/references added in either location?
Hi I have a situation where I want to set the initial visible property of an Image to False and then in my code change it to True and then run a sub routine. My problem is that no matter how I order the code the sub runs before the image becomes visible. When I debug the image only becomes visible when it hits End Sub. Is there any way around this? Here's my code: