AJAX Calender User Control Next and Previous button Issue - ajax

I created Ajax Calender Extender as a user control and using the same in various pages. My problem with the calender user control is, When I click on the Next and Previous buttons in the calender It is not navigating previous month or next month.
AJAX version is : 4.1.40412.2
AJAX Calendar CSS :
.ajax_calendar
{
position: relative;
left: 0px !important;
top: 0px !important;
visibility: visible;
display: block;
background-color: Red;
}
.ajax_calendar iframe
{
left: 0px !important;
top: 0px !important;
}
Here is my user Control is :
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="UCCalender.ascx.cs"
Inherits="test.Web.Pages.UserControls.UCCalender" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxControl" %>
<div style="position:relative;border:solid 1px red;">
<asp:TextBox ID="txtDate" MaxLength="10" CssClass="txtBox medium" ToolTip="DD/MM/YYYY"
Style="width: 85px;" Font-Size="11px" runat="server"></asp:TextBox>
<asp:ImageButton ImageUrl="~/Resources/Images/calendar.gif" ID="imgCalender" runat="Server"
BorderWidth="0" ImageAlign="absmiddle" />
<ajaxControl:CalendarExtender ID="AjaxCalenderCtrl" runat="server" Format="dd/MM/yyyy" PopupPosition ="TopLeft"
TargetControlID="txtDate" FirstDayOfWeek="Sunday" PopupButtonID="imgCalender">
</ajaxControl:CalendarExtender>
<ajaxControl:TextBoxWatermarkExtender WatermarkCssClass="watermark" ID="txtWaterMarkDate"
runat="server" WatermarkText="DD/MM/YYYY" TargetControlID="txtDate">
</ajaxControl:TextBoxWatermarkExtender>
<asp:RegularExpressionValidator ID="regexpvalEndDateEdit" ErrorMessage="!" ValidationExpression="(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d"
ControlToValidate="txtDate" runat="server"></asp:RegularExpressionValidator>
</div>
And I am using the same UserControl in the pages in this way:
<table id="inputDetails" style="padding: 0px; width: 700px;" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 198px; position: relative" align="left">
<asp:Label ID="lblBeginning" runat="server" Text="Beginning :" Style="margin-left: 10px;"></asp:Label>
<asp:TextBox ID="tbxBeginCalendar" TabIndex="3" runat="server" Style="width: 85px;" Font-Size="11px"></asp:TextBox>
<asp:ImageButton ID="BeginCal" runat="server" ImageUrl= "~/Resources/Images/calendar.gif" />
<uc1:UCCalender ID="UCCalStartDate" runat="server" />
</td>
</table>
Please provide the solution for this post.

This problem happens when you browse the CalendarExtender in IE8. You need to add the following CSS class to have the problem solved:
.MyCalendar .ajax__calendar_title
{
border: none; /* Fixes the "previous" and "next" buttons in the popup title */
}
This is explained here: http://ajaxcontroltoolkit.codeplex.com/workitem/22894

I have just come across this same issue. It was seemingly being caused because I had applied position:relative to the parent element.
Adding this this CSS fixed the issue for me:
.ajax__calendar_prev, .ajax__calendar_next{z-index:1;}
Hope that helps!

Related

Unable to click on a button placed inside an iframe in Safari browser with Selenium

OS: OSX macOS Sierra 10.12.6
Selenium Version: 3.6.0
Browser: Safari
Browser Version: 11.0.1(12604.3.2)
Expected Behavior - click() action should work on a button located inside an iframe in Safari browser
Actual Behavior - No action when performed button.click() action on Safari browser
Steps to reproduce -
Open safari browser
Access web application login screen
Enter valid credentials and click on Login button, pop up appears
Switch to iframe
Click on button placed inside an iframe
No action when clicked on button. Same code is working fine in other browsers(Chrome, Mozilla, IE11)
Below is the code:
SafariOptions options = new SafariOptions();
options.setUseCleanSession(true);
driver = new SafariDriver(options);
driver.manage().window().maximize();
driver.get("testurl");
driver.findElement(By.id("UN")).sendKeys("admin");
driver.findElement(By.id("UN")).sendKeys("admin$");
driver.findElement(By.id("Login")).click();
driver.switchTo().frame(driver.findElement(By.xpath("//*[starts-with(#class,'dijitDialog') and contains(#style,'z-index: 950;')]//*[starts-with(#id,'AxDojo_Dialog_frame')]")));
driver.findElement(By.xpath("//*[#id='ButtonPlaceHolder']/button[2]")).click();
No action when last step is executed.
As work around found an alternate to perform click on the button with below code
driver.findElement(By.xpath("//*#id='ButtonPlaceHolder']/button[2]")).sendKeys(Keys.ENTER);
But like this we need to change in many areas, Selenium is browser independent and maintenance of code browser wise is tedious task to us. Please can anyone look into this issue.
Please find HTML code inside iframe.
<iframe id="AxDojo_Dialog_frame_1508320744505" name="AxDojo_Dialog_frame_1508320744505" style="border: 0px; width: 605px; height: 159px;" width="605" height="136px" scrolling="auto" frameborder="0" src="about:blank" axpageload="1"></iframe>
#document
<!DOCTYPE html>
<html style="overflow-y: hidden"><head>
<title>Login</title>
<link href="../AxCommon/Styles/ECDefault/main.css" type="text/css" rel="stylesheet">
<script language="javascript" type="text/javascript" src="../Packages/Scripts/JQuery/jQuery.js"></script>
<script type="text/javascript" language="javascript" src="../AxCommon/Scripts/AxSystemBroadcast.js"></script>
<script type="text/javascript" src="../AxCommon/Scripts/AxMyParent.js"></script>
<script type="text/javascript" src="./Scripts/AxDialog.js?v=14082015"></script>
<style type="text/css">
.DialogBtn{width: 80px; font-size: 10pt;white-space:nowrap;}
.DialogCustomBtn{font-size: 10pt;white-space:nowrap;}
#popupMandatoryDiv { display:none;position:relative;height:auto;background:#FFFFFF;z-index:999999;overflow:auto;border:1px solid black;padding:5px 20px 10px 18px;font-size:12px;}
li {list-style: none; }
/*li:before {content:'\2022'; display: block; position: relative; max-width: 0px; max-height: 0px; left: -13px; top: -4px; color: red; font-size: 20px;padding-right: 5px;}*/
li:before {content:'\2217'; display: block; position: relative; max-width: 0px; max-height: 0px; left: -13px; top: -2px; color: red;font-weight:bold}
</style>
</head>
<body>
<div id="divMask" style="height: auto; width: auto;">
<table id="Table1" cellspacing="6" cellpadding="4" border="0">
<tbody><tr>
<td rowspan="3" style="width: 3px; height: 5px" valign="top" align="center"></td>
<td colspan="2" valign="top" align="center" height="10"></td>
</tr>
<tr style="width:100%">
<td valign="top" align="center" width="10%">
<img id="IconImage" src="../AxCommon/Images/28 information.gif">
</td>
<td valign="middle" align="left" height="5" width="90%">
<div id="divPrompt" align="left" style="DISPLAY: block; FONT-SIZE: 9pt; OVERFLOW: hidden; DIRECTION: ltr;">You are already logged into Excelicare in other active session(s). Please choose one of the options below:</div>
</td>
</tr>
<tr style="width: 100%; display: none;">
<td valign="top" align="center" width="10%">
</td>
<td valign="top" align="left" height="5" width="90%">
<div id="popupMandatoryDiv" align="left" style="DISPLAY: block; FONT-SIZE: 9pt; OVERFLOW: auto; DIRECTION: ltr;display:none">
</div>
</td>
</tr>
<tr>
<td valign="middle" align="center" colspan="2" style="padding-top: 10px">
<div id="ButtonPlaceHolder"><button class="DialogCustomBtn" onclick="AxSysF_CloseWindow(6)">Open new session / <br>end other session(s)</button>
<button class="DialogCustomBtn" onclick="AxSysF_CloseWindow(7)">Open new session / <br>retain other session(s)</button>
<button class="DialogCustomBtn" onclick="AxSysF_CloseWindow(0)">Cancel login<br> </button> </div>
</td>
</tr>
<tr id="trchkPlaceHolder" style="visibility: hidden; display: none;">
<td> </td>
<td valign="middle" align="left" colspan="3" id="tdchkPlaceHolder">
<div id="checkPlaceHolder"></div>
</td>
</tr>
</tbody></table>
<div>
<br>
<div id="lblInfo" style="display: block;"><b>Note : </b> If you choose to <i>Open new session/end other session(s)</i> any unsaved data in the other session(s) will be lost.</div>
</div>
</div>
<input id="hdnTitle" type="hidden" value="Login">
<script type="text/javascript">
var strProductType = '<%=System.Configuration.ConfigurationSettings.AppSettings("ProductType")%>';
strModulePageName = 'frmdialog';
$(document).ready(function() { PageLoaded();setTimeout('self.focus()', 10);});
function setCallback(CallbackFn) {
_CallbackFn = CallbackFn;
}
document.oncontextmenu = function (event) {return false;};
</script>
</body></html>
As per the screenshot/HTML you provided, there needs some modification in your code block as follows:
The line :
driver.switchTo().frame(driver.findElement(By.xpath("//*[starts-with(#class,'dijitDialog') and contains(#style,'z-index: 950;')]//*[starts-with(#id,'AxDojo_Dialog_frame')]")));
Though the outer HTML element does have the class attribute as dijitDialogPaneContent but doesn't have style attribute as z-index: 950;.
The line :
driver.findElement(By.xpath("//*[#id='ButtonPlaceHolder']/button[2]")).click();
As you are using xpath with index e.g. button[2] the xpath becomes brittle and vulnarable. I would have prefered to expand the <button> tag and use the <span> or any other tag/text present within to construct an unique css/xpath.
Following those 2 observation you can make some minor changes in your code as follows:
driver.switchTo().frame(driver.findElement(By.xpath("//div[#class='dijitDialogPaneContent')/iframe[starts-with(#id, 'AxDojo_Dialog_frame')]")));
//clicking the first button
driver.findElement(By.xpath("//button[#class='DialogCustomBtn' and contains(.,'end other session(s)')]")).click();
In-case the loading sequence of this <iframe> is constant, our xpath would be much more generic as follows:
driver.switchTo().frame(driver.findElement(By.xpath("//div[#class='dijitDialogPaneContent')//following::iframe[1]")));
//clicking the first button
driver.findElement(By.xpath("//button[#class='DialogCustomBtn' and contains(.,'end other session(s)')]")).click();

Why the ComboBox would add a top attribute on the table?

I am using a combo-box control inside Grid View.
I am trying to describe the problem clearly
My HTML Code:
<AJAX:ComboBox ID="ddlContactName1" runat="server"
AutoPostBack="true" Width="190px"
OnSelectedIndexChanged="ddlContactName_SelectIndexChanged"
DropDownStyle="DropDownList" Enabled="false" CssClass="WindowsStyle" AutoCompleteMode="Suggest">
</AJAX:ComboBox>
Code Generated by ASP on browser:
<td class="td_search_box">
<div id="ctl00_MainContent_grdContacts_ctl02_ddlContactType1" class="acb" style="display: inline-block;">
<table id="ctl00_MainContent_grdContacts_ctl02_ddlContactType1_Table" class="ajax__combobox_inputcontainer" cellspacing="0" cellpadding="0" border="0"
style="border-style: none; border-width: 0px; border-collapse: collapse;
display: inline-block; position: relative; top: 5px;">
...........
Combobox (ddlContactType1) renders as div and table inside. Table has class and style. Style has attribute "top: 5px;" causing padding from top.
As a result combobox is shifted on 5 pixels from top and lies above table grid line.
I want to make the top:0px;.How to do this?
Can anybody has any idea?
Thnaks in advance
I got the solution.And hope it will help others,
<style type="text/css">
.ajax__combobox_inputcontainer
{
top:0px !important;
}
</style

JSTL error in freemarker template

I am trying to implement JSTL in Freemarker template. To do that, I got a sample freemarker template example and tried to incorporate JSTL namespace and trying to execute it.
Here is how my code looks right now.
<html>
<head><title>ViralPatel.net - FreeMarker Spring MVC Hello World</title>
<#assign c=JspTaglibs["http://java.sun.com/jstl/core"]/>
<style>
body, input {
font-family: Calibri, Arial;
margin: 0px;
padding: 0px;
}
#header h2 {
color: white;
background-color: #3275A8;
height: 50px;
padding: 5px 0 0 5px;
font-size: 20px;
}
.datatable {margin-bottom:5px;border:1px solid #eee;border- collapse:collapse;width:400px;max-width:100%;font-family:Calibri}
.datatable th {padding:3px;border:1px solid #888;height:30px;background-color:#B2D487;text-align:center;vertical-align:middle;color:#444444}
.datatable tr {border:1px solid #888}
.datatable tr.odd {background-color:#eee}
.datatable td {padding:2px;border:1px solid #888}
#content { padding 5px; margin: 5px; text-align: center}
fieldset { width: 300px; padding: 5px; margin-bottom: 0px; }
legend { font-weight: bold; }
</style>
<body>
<div id="header">
<H2>
<img height="37" width="236" border="0px" src="http://viralpatel.net/blogs/wp-content/themes/vp/images/logo.png" align="left"/>
FreeMarker Spring MVC Hello World
</H2>
</div>
<div id="content">
<c:set var="Salary" value="4000/>
<c:out value="${Salary}/>
<fieldset>
<legend>Add User</legend>
<form name="user" action="add.html" method="post">
Firstname: <input type="text" name="firstname" /> <br/>
Lastname: <input type="text" name="lastname" /> <br/>
<input type="submit" value=" Save " />
</form>
</fieldset>
<br/>
<table class="datatable">
<tr>
<th>Firstname</th> <th>Lastname</th>
</tr>
<#list model["userList"] as user>
<tr>
<td>${user.firstname}</td> <td>${user.lastname}</td>
</tr>
</#list>
</table>
</div>
</body>
</html>
I know the problem is with the new code I added i.e Salary and I see the following error.
freemarker.core.InvalidReferenceException: Expression Salary is undefined on line 62, column 5 in index.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
What am I doing wrong?
Thanks
Nikhil
What you are doing wrong is not understanding how Freemarker works and thinking that it's somehow completely inoperable with JSP. As far as I can tell, you have imported JSTL in order to set and output variable values when Freemarker already does this.
Replace this:
<c:set var="Salary" value="4000/>
<c:out value="${Salary}/>
...with this:
<#assign Salary = 4000>
${Salary}
Also, rid yourself of the JSTL taglib and just learn how to use Freemarker. You will be much happier.

How to add Postback button to the Update Panel

I must add a Post Back Button to refresh all site to the Update Panel. How Could I do it ?
This is my code ASPX:
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<tr><td style="border: 1px solid #676767; width:200px;"><span style="color:#FF0000; font-weight:bold;">Wstaw datę dla dnia projektowego: </span></td><td style="border: 1px solid #676767"><asp:TextBox ID="TextBox3" runat="server" Width="249px" style="margin-right:3px;"></asp:TextBox></td><td style="border: 1px solid #676767"> format (2012-10-30)</td></tr>
<tr><td style="border: 1px solid #676767; width:200px;"><span style="color:#FF0000; font-weight:bold;">Wstaw procent zaangarzowania: </span></td><td style="border: 1px solid #676767"><asp:DropDownList ID="DropDownList2" runat="server" Width="273px"></asp:DropDownList></td><td style="border: 1px solid #676767"> od (1/8..8/8)</td></tr>
<tr><td colspan="3" style="border: 1px solid #676767;"><asp:Button ID="Button2" runat="server" Text="Dodaj pojedyńczy dzień projektowy" onclick="Button2_Click" Width="600px" /></td></tr>
</ContentTemplate>
</asp:UpdatePanel>
I added this code, and it worked ;)
<Triggers>
<asp:PostBackTrigger ControlID="Button6" />
</Triggers>

Table row height in Firefox

Due to current limitations on getting DIV tags to work well across browser platforms for the particular liquid layout I desire, I have opted to use a combination of Tables and DIVs for layout. That being said, a couple of issues remain.
The FIRST issue is that in Firefox, my table row height for my footer is being rendered differently than it is being rendered in IE when using a table with a height of 100%. What happens is that in Firefox the footer row for the table has a height that is greater than the height specified for the table row. This, in turn, throws off my footer layout.
Here is the code for the page:
<html>
<head>
<meta NAME="DESCRIPTION" CONTENT="Cold Fusion Applications and Development">
<meta NAME="keywords" CONTENT="cold fusion, coldfusion, sql server, graphic design, houston, texas, tx, web developer, web development, e-commerce, survey, surveys, web applications, php, mysql, access, foxpro, sql, perl, shopping cart, web programming, macromedia, webmaster, html, cfml, xml, 77057, cfware, cfware.com, www.cfware.com, hosting, dhtml, dynamic html, web programmer, graphic designer, website, resume">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<!-- BODY -->
<body topmargin="0" bottommargin="0" rightmargin="0" leftmargin="0">
<!--TABLE I -->
<table class="fullheight" width="100%" height="100%" min-height="100%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr><td height="116" align="center" valign="top">
<!-- HEADER -->
<div class="header">
<div class="lfc">Cornerstone</div>
<div class="rfl"><img src="c4sqlogo.gif" width="295" height="68"></div>
<div class="lf4">Foursquare</div>
</div>
<div class="spacer"></div>
<!-- HEADER END -->
</td>
</tr>
<tr><td align="center" valign="center" bgcolor="#FFFFFF">
<!-- CONTENT -->
<div class="content">
<table class="fullheight" width="100%" height="100%">
<tr>
<td></td>
<td></td>
<td></td>
</tr><tr>
<td></td>
<td align="center" valign="middle">
<h1 class="font-black">Cornerstone Foursquare Church</h1>
<br>
<h2>7791 Hillbarn Dr. Houston, TX 77040</h2>
<br>
<h2>(713) 856 - 7773</h2>
<br>
<br>
<h3>Service Times:<br>Sunday Morning Worship 10:30AM<br>Sunday Evening Bible Study 6:00PM
<br>Wednesday Evening Bible Study and Prayer 7:00PM</h3>
</td>
<td></td>
<tr>
<td></td>
<td></td>
<td></td>
</tr><tr>
</table>
</div>
<!-- CONTENT END -->
</td>
</tr>
<tfoot height="28"><td height="28" align="center" valign="middle" bgcolor="#FFFFFF">
<!-- FOOTER -->
<div class="clearspacer"><img src="1.gif" height="10" width="1"></div>
<div class="footer"><div class="footertext"> w w w . c 4 s q . o r g </div></div>
<!-- FOOTER END -->
</td>
</tr>
</table>
<!-- TABLE I END -->
</body>
</html>
And here is the code for the sytle sheet:
html, body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: :#a02f1d;
height: 100%;
width: 100%;
}
a {
color: #ffffff;
text-decoration: none;
font-size: 12;
font-weight: 500;
}
.header {
color: #ff0000;
margin: 0 auto;
width: 760px;
height: 116px;
background-image: url(stripe.gif);
background-repeat: repeat-x;
}
.fullheight {
height:100%;}
.lf4 {
float: left;
margin-top: 0px;
clear: left;
width: 240px;
margin-left: 190px;
color: #a02f1d;
font-size: 26px;
font-weight: semi-bold;
font-style: italic;
}
.lfc {
float: left;
margin-top: 8px;
margin-left: 20px;
color: #a02f1d;
font-size: 48px;
font-weight: semi-bold;
font-style: italic;
}
.rfl {
float: right;
margin-top: 24px;
margin-right: 20px;
clear: right;
}
.content {
margin: 0 auto;
width: 760px;
overflow: hidden;
color: :#a02f1d;
}
.spacer {
background-color:#a02f1d;
margin: 0 auto;
width: 760px;
height: 4px;
overflow: hidden;
}
.clearspacer {
background-color:#000000;
}
.footer {
color: #ffffff;
background-color:#a02f1d;
margin: 0 auto;
width: 760px;
height: 30px;
clear: both;
}
.footertext {
color:#ffffff;
margin-top: 6px;
font-size: 12px;
}
The SECOND issue has to do with modifying the existing layout so that there is a centered vertical area of 760px in width that displays in a shade of color different from the surrounding viewport. The primary difficulty is that in order to get my footer to stick to the bottom in both browsers and resize with the viewport, I had to re-adopt a table layout. The current strategy, however, is to use as few nests as possible in order to benefit from the speed and clarity from using DIVs. I would opt to use a DIV layout to the exclusion of a TABLE layout if it were not for the apparently, currently insoluble problem of getting a working sticky-footer to work with a DIV liquid layout.
I know this is quite unrelated, but I recommend that you use the w3c validator to validate your HTML once in a while.
A couple suggestions:
Add a doctype - if use use the right one you can get IE to standards mode rather than quirks mode http://www.quirksmode.org/css/quirksmode.html, so behaviour will be more consistent between IE and other browsers.
As suggested by K4emic - validate your markup.
Add a css reset to zero default margins and paddings, a good starting point here http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/.
You will find that these things will make chasing down layout bugs a lot easier. Otherwise, you just won't know where to start, is it your css, your html, the default browser stylings, the rendering mode of IE......?
As the other responders pointed out you first have to make sure that your document is well formed. That is, it must conform to a DTD. I will point out one issue that is easy to spot:
<tfoot height="28"><td height="28" align="center" valign="middle" bgcolor="#FFFFFF">
<!-- FOOTER -->
<div class="clearspacer"><img src="1.gif" height="10" width="1"></div>
<div class="footer"><div class="footertext"> w w w . c 4 s q . o r g </div></div>
<!-- FOOTER END -->
</td>
</tr>
</table>
In this snippet you can see that your
<tfoot>
element is unclosed. It should contain
<tr>
but that is missing.
These small errors are probably causing the inconsistent behavior that you are witnessing. After they have been corrected if you are still getting the behavior then you can look at the browser differences. Some HTML editor like Frontpage and Dreamweaver can be set to out put code that conforms to a DTD and highlight areas that do not conform. I would recommend using one.

Resources