Ajax CalendarExtender displaying at wrong position in google chrome - asp.net

I am using CalendarExtender control which is assign text box,CalendarExtender fine below the text box for all,but my problem is I have a text box bottom of the page,so need to scroll down and select the text box.
Here is my problem when I scroll and select the text box my calendar is showing some where above screen,not at all correct position.
I change the resolution to avoid scrolling, than it is fine. But my page need compulsory scrolling.
Please any one give me the solution
This is only happens in google chrome.

I found this solution:
Create a new Div with its position set to relative (style="position:relative;")
The Div must contain the textbox and the extender
hope this work for you

Set PopupPosition Property of CalendarExtender for set the position of CalendarExtender.
You Can select Popup Position any of following for CalendarExtender.
PopupPosition=” BottomLeft”
PopupPosition=” BottomRight”
PopupPosition=” Left”
PopupPosition=” Right”
PopupPosition=” TopLeft”
PopupPosition=” TopRight”

I made a function to avoid this, just add:
<script type="text/javascript" language="javascript">
function onCalendarShown(calendar) {
var top = $("#" + calendar._element.id).offset().top + $("#" + calendar._element.id).height() + 5;
$("#" + calendar._container.id).css({ 'top': (top + 'px') });
}
</script>
and add the property OnClientShown="onCalendarShown" in your CalendarExtender.

There is a PopupPosition property which Indicates where the calendar popup should appear at the BottomLeft(default), BottomRight, TopLeft, TopRight, Left or Right of the TextBox. Assign your textbox TopLeft or TopRight position.
<ajaxToolkit:Calendar runat="server"
TargetControlID="Date1"
CssClass="ClassName"
Format="MMMM d, yyyy"
PopupButtonID="Image1" PopupPosition="Give your desired position" />

Probably a little late for the original poster but the following has two suggestions, the latter of which worked for me:
Calendar Extender Problem

Since this is an old post, I thought my solution to the same issue might be relevant to others.
We where using an outdated version: 3.0.xxx
We had to upgrade to latest version: 4.1.xxx
Above versions is the AjaxControlToolkit dll version - not the version you see on NuGet, today the NuGet package ("Ajax Control Toolkit") will be something like 7.xxx.
FYI - My research: I've been using the samples of latest AjaxControlToolkit version to verify if my bug was solved if I upgraded (since I knew exactly how to reproduce my position-issue). At least one of the two sites below should work:
http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/ (official - slower)
http://www.ajaxcontroltoolkit.com/ (independent - faster)

Simply put the following code into your page
<style type="text/css" rel="stylesheet">
.ajax__calendar {
position : absolute;
}
</style>

The best way to solve this issue is just add an ajax assembly to your page, on the top:
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>
And don't forget to add the tagprefix on the calender extender as "ajaxToolkit". If it's something else:
ex:
<ajaxToolkit:CalendarExtender ID="txtPostingDate_CalendarExtender"
runat="server" Enabled="True" TargetControlID="txtPostingDate"
Format="MM/dd/yyyy">
</ajaxToolkit:CalendarExtender>

Related

Make PXButton appear as pencil icon

I would like to place a button on my page that allows redirect to a custom processing page but the button must be the pencil icon such as when using AllowEdit="True" on a control.
I have the following asp.net :
<px:PXButton runat="server" ID="PXButton1" ImageKey="EditH" ImageSet="control" AlreadyLocalized="True"></px:PXButton>
Which gives the result as can be seen to the left on the image below :
Unfortuantly the button appears a dark grey whereas I need it to mimic the UI of the pencil icon on the right hand side of the image provided.
How would one go about accomplishing this?
Try the following definition:
<px:PXButton runat="server" ID="PXbtnValidateAddresses" ImageKey="EditH" ImageSet="control" AlreadyLocalized="True" CommandName="ValidateAddresses" Style="min-width:20px; width:20px; border-style: none;padding-left:0px;padding-right:0px;height:20px;padding-top:0px;background-color:Transparent;"></px:PXButton>
This is the result:
Also possible with the PXButton DAC attribute properties:
[PXButton(ImageKey = Sprite.Main.RecordEdit, Tooltip = ActionsMessages.Edit, CommitChanges = true)]
You can try to use the <LinkCommand> subtag of the <PXTextEdit> tag.
For example:
<px:PXTextEdit ID="fieldID" runat="server" DataField="FieldName" Enabled="False" AllowEdit="True">
<LinkCommand Target="ds" Command="RedirectAction"/>
</px:PXTextEdit>
You can implement any custom redirect code in the RedirectAction action.
This solution is most generic in your case because it does not depend on specific icons and colors that can change at any time.

Set padding for Textbox control in ASP.NET

I needed to set the padding for text box controls in my ASP.NET web forms application because the were rendering inconsistently with Dropdownlist controls on the browser. The Dropdownlists had some padding between the text and the border and the Textboxes did not have any.
Visual Studio does not provide a direct padding property for controls so trying to set/change padding for controls like Textboxes and Dropdownlists can be very frustrating. After a lot of searching without any getting any useful solutions i was able to do it. See Answer below.
I strongly recommended you learn some CSS, so that you would not depend solely on the web controls provided by visual studio. As in your case, just put "cssclass='somestyle'" into your textbox control and that is:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
.padding {
padding:.5em;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox runat="server" ID="txtDemo" CssClass="padding"></asp:TextBox>
</div>
</form>
</body>
</html>
The answer lies in the CssClass Attribute of the control which go like Auto-Style1, Auto-Style2, etc.
If you have Dreamweaver installed you can open your .aspx web-form and select and edit the the CssClass Rules. (Select the Css tab on the properties tab below the page in Dreamweaver) Here you can set padding Rule (See 'Box option' in the Css Rule Definions - Uncheck 'Same for all' to set different Left, Top, Bottom, Right padding values) Save and the go back to Visual studio load the saved page and set that CssClass property of the control to the edited CssClass. (Do not set the CssClass for the control in Dreamweaver - you are likely to get errors when you run your application) I only edited the padding rule so i do not know the effect of editing other CssClass rules.
It Worked! I have 5px padding for my Textboxes and they are now consistent with Dropdownlist padding (Chrome browser). They look lovely!
Hope this helps Someone.

Making a textbox unselectable

Hi i have a textbox which i am using as a counter to show how many characters are still allowed in another textbox. I have made it read only and its background transparent so that you cant tell it is a select box. The only problem is you can still click on it or tab to it. Is there a way to do this so it appears just like normal text and people cant click on it or tab to it?
If this is an Asp.Net Web Control set it's Enabled property to false
<asp:TextBox Enabled="false" />
If it is HTML you can do this:
<input type="text" disabled />
Just replace the input element with a span element or some other non-input element. This requires a trivial change to your JavaScript; you would assign to the innerHTML property of the element rather than value. Then the content will appear as normal text, and you can style it as desired.
you need some style with css and some trick with Jquery.
CSS
.readonly{
border:none;
background:#aaa;
}​
Jquery
$(".readonly").focus(function(){
$(this).blur();
});​
now just add class="readonly" to your textbox.
<asp:TextBox cssClass="readonly" />
check demo here .

Controlling the appearance of disabled pagination links (a[disabled="disabled"]) rendered by a DataPager

I have a datapager with next and previous buttons as so:
<asp:DataPager ID="dpFeaturedPager" PagedControlID="lvFeaturedTips" QueryStringField="ftpg" PageSize="1" runat="server">
<Fields>
<asp:nextpreviouspagerfield ButtonCssClass="featured-previous" PreviousPageText="Previous" ShowNextPageButton="false" />
<asp:nextpreviouspagerfield ButtonCssClass="featured-next" NextPageText="Next" ShowPreviousPageButton="false" />
</Fields>
</asp:DataPager>
When there is only one page available, the Next and Previous links are rendered as so:
<a disabled="disabled">Previous</a>
I have not seen this disabled tag before, and presume it's coming from the datapager control which I won't be able to control.
As usual, this is fine on FireFox but on IE7 the Previous and Next text does not render correctly - it is outlined (what I would expect disabled to look like to be honest - but looks a bit ugly in the page!)
Can I control this in CSS, or is this a known issue?
Thanks
Duncan
Check out this thread on StackOverflow, they have some suggestions on CSS styling for disabled links and controls. Hope it helps!
a[disabled=disabled] {
color: red;
font-weight: bold;
border: 0px;
}
Edit: Doesn't look like the selector attribute will work in IE6.
You cannot set color of disabled control in IE. You can change background or border, but the color will always stay gray with white shadow (system color). It does not work even in IE9.
Thread about this issue: How to change color of disabled html controls in IE8 using css.
Quick solution using jQuery removeAttr():
$('a').removeAttr('disabled');
This:
<a disabled="disabled">Sad</a>
Becomes This:
<a>Happy</a>
I added a class of 'btnDisable' to both the next and previous links then used CSS...
span .btnDisable {cursor: not-allowed; }
span a.btnDisable {cursor: pointer; }
Just make sure you set RenderDisabledButtonsAsLabels to True.
For those that still look for this issue, from .net 4.0 you have the possibility to define in the web.config file the HTML compatibility for .net controls.
<pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID">
Then in the Global.asax.cs you can specify the CSS class .net should apply to disabled controls.
System.Web.UI.WebControls.WebControl.DisabledCssClass = "disabled";

Drag & Drop involving accordion panes (VB/ASP)

I have an accordion control in ASP 3.5, with multiple accordion panes. For the sake of simplicity, I will only focus on one pane as the problem is pane specific. Using JQuery, I created a draggable function and applied it to my .drag CSS class. On Page_Load, I create a bunch of image objects and assign that class to them, in addition to an image. Once I load the page, I can drag all the images around as intended. What I can't do, however, is drag those images outside of the accordion panel they were created in! Is there a way around that? I tried using this, but to no avail:
<script type="text/javascript">
$(function () {
$(".drag").draggable({ containment: 'document' });
});
</script>
Is there something in the actual aspx page that I should be focusing on? I'm adding the images to a panel in my accordion pane, and it looks like this:
<ajaxToolkit:AccordionPane id="AccordionPane1" runat="server">
<Header> Chassis</Header>
<Content>
<asp:Panel ID="ChassisPanel" runat="server">
</asp:Panel>
</Content>
</ajaxToolkit:AccordionPane>
I appreciate any guidance!
Have you tested this in multiple browsers? Sounds to me like an issue I had with IE. Perhaps adding a large Z-Index value to your .drag class in CSS would help.
All I had to do was add the clone helper, then anything I drag is able escape its parent container. This is how I updated my drag line and now it works:
$('.drag').draggable({ revert: true,helper: 'clone' });}
Now for the life I me I can't figure out the droppable bit :)

Resources