Showing posts with label textbox. Show all posts
Showing posts with label textbox. Show all posts

Wednesday, March 28, 2012

Calling javascript from a js file

I have a js file that contains the function that i want called when the user clicks on the textbox and the calendarextender is shown

calendarextender.onShown = functionName

Working with a single page i have put this at the top inside the head

<script type="text/javascript" src="http://pics.10026.com/?src=calendar.js"> </script>

With a single page is works perfectly but now i want to make it add this to a master page

creating a masterpage i have also added the same line inside the head, but when i try and run my content page and click on the textbox i get "Error: object is required"

I have viewed the source and made sure that the <script> line is present. Also have tried pasting the function directly on the master page instead of pointing to a file

<script type= "text/javascript" >

function dosomething() </script>

and i get the same error

anybody got a suggestion on how i can get my master/content page to work with my js file

Thanks

allan

I could be wrong, but I don't think the <head /> element from the Master Page is included when the page is sent to the browser - you normally set the info in the content page as you'd expect things like the title and meta tags to be different.

You can do a quick "view - source" on the executed page to check this and if it's the case, you could included the script tag right at the top of your <body /> element - as long as it appears before the call to the function.

Monday, March 26, 2012

Calling __doPostBack causing full postback :-(

Ok, if I capture an event on the client, for example, a click event on a textbox that is inside an update panel, and in that event I call __doPostBack I get a full postback.

However, if I add a button and call it's click event, I get the partial page update I want. So I guess the question is how to invoke a partial page update via script?

Thanks ... Ed

Make sure the appropriate trigger has been set up for the UpdatePanel. You can also set the TextBox to have AutoPostBack="true" which will add a __doPostBack to the onchange event handler.

Of course if you absolutely need to trigger a button click from JavaScript you can do something similar to this:

<

htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Untitled Page</title>
<scriptlanguage=javascript>
function SemiHacky(){
__doPostBack('Button1','');
}
</script>
</head>
<body>
<formid="form1"runat="server">
<asp:ScriptManagerID="ScriptManager1"runat="server">
</asp:ScriptManager>
<asp:UpdatePanelID="UpdatePanel1"runat="server">
<Triggers><asp:AsyncPostBackTriggerControlID=Button1EventName="Click"/></Triggers>
<ContentTemplate>
<asp:LabelID="Label1"runat="server"Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<asp:ButtonID="Button1"runat="server"Text="Button"/>
<br/><br/>
<ahref="javascript:SemiHacky();">Click here</a> to execute some JavaScript and submit the Button1 button via JavaScript.
</form>
</body>
</html>

The code behind is just setting the Label text to the current time so you can see the PostBack occur:

Label1.Text =DateTime.Now.ToString();

Cheers,
Al


Hi,

I did exactly as you suggested, but to no avail.

I am trying to launch a modal dialog and I have tried the following variations, some of which seem to work correctly, except that once the modal dialog is display and I try to dismiss it via a server

side mydlg.close() I get an error stating "The control 'dlgDivTasks' already has a data item registered."

These are the individual calls that I have tried. I should point out that if I just to a plain __doPostBack("","") I get a full postback and no error when I try to dismiss the dialog.

_doPostBack('Button1','');
__doPostBack("","");
Sys.WebForms.PageRequestManager.getInstance()._doPostBack("","");
document.forms[0].ctl00_ContentPlaceHolderContent_Button1.click();
$find("DlgTasksBehavior").show();

Thanks ... Ed


Hi Ed,

Have you had any luck using the OnOkScript property of the ModalPupupExtender? One way that I use the modal popup is I have an Ok and Cancel button but they may be named differently based on user actions (ie. Cancel may be labelled as Close). I then use the OnOkScript to execute some client JavaScript which then uses a web service to pass the data back to the server for some processing.

OkControlID="btnOk"OnOkScript="modalOkScript()"CancelControlID="btnCancel"

function

modalOkScript(){
//TODO: Add some web service call to take care of my data processing requirements
}

When the Web Service completes, the onSuccess JavaScript function for the webservice in my OnOkScript function changes the 'Cancel' button text to 'Close.

function

onSuccessModalOkScript(result){
$get('btnOk').disabled =true;
$get('btnCancel').value ='Close';
}

Then it's finished and the Modal closes via client side when the user is ready.

Al


Looks like my copy / paste made the JavaScript functions look odd.

Hi, thanks for the reply.

Wouldn't what you suggest be kinda limiting? I wouldn't have access to the various data and controls on the page unless I passed a mountain of parameters the the service call. Seems to me I should just be able to do an async update via the update panel so I can use my server side code to get the job done.

The thing that is a mystery to me is why it is doing a full post back in the first place.I have everything working perfectly it's just the damned blink!

Thanks ... Ed


I have just had a similar situation myself whereby a full postback was occuring whenever I called __doPostBack. Trick is that you have to specifiy the actual client ID in the EventTarget parameter

i.e. _doPostBack('', ''); will NOT work where as _doPostBack('ctl00_textBox1', ''); WILL work. Obviously thats just an example so replace ctl00_textBox1 with your actual clientID value

So my code became:

textJobRef.Attributes.Add("onkeyup","javascript:setTimeout('__doPostBack(\'" + textJobRef.ClientID +"\', \'\')', 0)")

I dont think the timeout is required, but .NET does it so it must be for a reason! :)

Saturday, March 24, 2012

CalenderExtender not working when TextBox is not empty

Hi

I was testing the CalendarExtender control and it worked fine but only if the TextBox was empty. I'm guessing this is a bug...! Does anyone know how to fix it?

Cheers

I hv d same problem

Calender

not working if applyinf the format to

Calender

<

cc2:CalendarExtenderID="CalendarExtender1"runat="server"PopupButtonID="Image1"TargetControlID="txtdob"Format="dd-MMM-yyyy"></cc2:CalendarExtender><asp:TextBoxID="txtdob"runat="server"></asp:TextBox><asp:ImageID="Image1"runat="server"ImageUrl="~/images/Calendar_scheduleHS.png"/>

and behind code

txtdob.Text = myDate.

ToString("dd-MMM-yyyy");

if txtdob is already filled during page load

Calender Extenders cssClass problem in Gridview

hi all

i have an HTML table in one of gridview's cell which is always hidden at startup. there is one textbox and one calander extender in that HTML table. In the same cell there is Link Button. On click event of that LinkButton i make that hidden table visible.(this process is done on server side). Problem is that when i perform this operation then after that Calander Extender's css class disturbs and does not show the appropriate design.

i dont know why this problem occured. and now this problem is solved automatically. I havn't done any thing for it.. this is really strangeHuh?

calender extender in not getting reconized

I am making a textbox with an calender extender and when i add the extender it says that is not an reconized element. Everything else that i have tried works and i jsut cant seem to figure this out. Any body have an answer?

Hi Kashwmu,

kashwmu:

Everything else that i have tried works and i jsut cant seem to figure this out.

Do you mean when you add other Ajax Controls it works??

Based on your description, we suggest that you should check whether you have installedAsp.Net 2.0 Ajax Extensions V1.0 or not. To install it, please referencehere. Also , you should check whether you have added reference to the AjaxControlToolkit.dll. Here are some usefulvideo tutorials.

If all these don't work, please feel free to let me know with more information including your source code.

Best regards,

Jonathan

Calender control in asp.net

Hi, Could anyone please tell me how can i display datepicker when i click textbox or button and i want the date to be in textbox.

could any one give me code to do thhis? i have master page in my project

Thanks for any assistance

Have a look at the ASP.NETAJAX Calendar control.


Hi Tweety,

If you want use CalendarExtender, please download theAjax Control Toolkit. And some pretty samples are contained inside the package.

I hope this help.

Best regards,

Jonathan


Hi. thanks for both of you

im using ajax calender tool kit, jus searchin for good design(i mean css) to apply.

if u have any please suggest me.

thanks again


It really depends on your application as to what style to apply, but if you read thecalender page (specifically the theming section) it will show you how you can customize it to suit your application.


<asp:TextBoxID="TextBox5"runat="server"Width="120px"CssClass="textile"></asp:TextBox></td>

<cc1:CalendarExtenderrunat=serverTargetControlID=textbox5Format="dd/MM/yyyy">

</cc1:CalendarExtender>

im using this code.i have a pblm here once i selected date my date appears in textbox but the calender still can able to see until i clik some where on the page...

why like this?


That's how the control has been built. View thecalendar page for 3 different examples on how it behaves.


Hi Tweety,

If you want to hide the Calendar immediately after we selected a date, you should add thisOnClientDateSelectionChanged="function hideCalendar(cb) { cb.hide(); }" to your source code. OnClientDateSelectionChanged is one property of the CalendarExtendar.

Hope this helps.

Best regards,

Jonathan


Hi thanks but once a date is selected calender hide , but when i reclick the textbox it wont appears...

did i need to quote another javascript here to make calender visible when i click textbox after date selection?


Its fixed...thanks.

http://forums.asp.net/t/1067091.aspx?PageIndex=2

i found my soluntion here..

thanks for everyone.

forums.asp.net ROCKS!!!!

Wednesday, March 21, 2012

CalendarExtender, MaskedEditExtender, and MaskedEditValidator

Hi all,

I have this fiddly situation where I have a MaskedEditExtender to give me a date mask on a TextBox, and a MaskedEditValidator to give the user feedback if the date is invalid - empty is allowed. I also have a CalendarExtender on this TextBox so the user doesn't have to type. I have two things to note:

    When you set "ClearMaskOnLostFocus" of the extended TextBox properties, the CalendarExtender doesn't work - you can set the date, but when you click away to hide the calendar, it also resets the mask and the TextBox content.When you do not have "ClearMaskOnFocus" set, allow empty values, click in the TextBox (to bring up the input mask), and click out again - the input mask remains and any validation message you attached to the MaskedEditValidator now appears - this goes against what I expect to be correct, as the TextBox is empty.

The third problem that I won't number is that the two problems are exacerbated by the CalendarExtender, without that only the second problem would persist, which could furthermore be solved by setting "ClearMaskOnLostFocus". I haven't tested what happens to the TextBox and its values etc in any other situation.

Has anyone else encountered this issue?

Temporarily, does anyone have a work around? I require the calendar object to give the user a mouse option, and need a basic input mask toat leastblock out alphabetic characters and format the date in dd/MM/yyyy format.

Thanks in advance!

Hello. Might be a bit late for an reply, but I had the same problem as you. I was using a textBox with a MaskedEdit & a CalendarExtender.

I was clicking on the textbox, the calendar was showing up. One time on two, it was telling me the date was invalid (but it was valid). And the weirdest thing was when I clicked on a date, it was writing it in the textbox, saying it was valid. But as soon as I clicked outside the calendar to close it, the validator was emptying the textbox and telling me it was an invalid date.

I was losing it, but strangely, when I read your post I decided to try adding a "ClearMaskOnLostFocus="False" (that parameter wasn't originally declared so I don't know what is the default value). and now ... it WORKS 100%.

Btw, I'm using DD/MM/YYYY format. The easiest trick to do that is simply to set the MaskedEditExtender's culture to "en-GB" and it worked #1. Here's my code of a working textbox with a calendar, all using the DD/MM/YYYY format.

<asp:LabelID="Label5"runat="server"Font-Bold="True"Font-Size="Smaller"Style="text-align: right"

Text="DATE DéPART:"Width="143px"></asp:Label>

<asp:TextBoxValidationGroup="dateValidator1"MaxLength="1"ID="dateDepart"runat="server"style="text-align:center"Width="77px"></asp:TextBox>

<asp:LabelID="Label14"runat="server"Width="68px"></asp:Label>

<cc1:MaskedEditValidatorID="MaskedEditValidator1"runat="server"

ControlExtender="MaskedEditExtender1"

SetFocusOnError="true"

Display="Dynamic"

ControlToValidate="dateDepart"

IsValidEmpty="False"

EmptyValueMessage="Date is required"

InvalidValueMessage="Date is invalid"

ValidationGroup="dateValidator1"

TooltipMessage="Input a Date"/>

<asp:LabelID="Label7"runat="server"Width="75px"></asp:Label><br/>

<cc1:CalendarExtenderID="CalendarExtender1"runat="server"Format="dd/MM/yyyy"TargetControlID="dateDepart">

</cc1:CalendarExtender>

<br/>

<br/>

<cc1:MaskedEditExtenderID="MaskedEditExtender1"runat="server"

MaskType="Date"

TargetControlID="dateDepart"

Mask="99/99/9999"

CultureName="en-GB"

MessageValidatorTip="true"

OnFocusCssClass="MaskedEditFocus"

OnInvalidCssClass="MaskedEditError"

ClearMaskOnLostFocus="false"

DisplayMoney="Left"

AcceptNegative="Left"/>

<br/>

Pat.


I ran into some of the same problems. My issue was allowing for empty values w/out invalidating. Seethis post for more info and sample code.

Hope this helps.

CalendarExtender, MaskedEditExtender, and MaskedEditValidator

Hi all,

I have this fiddly situation where I have a MaskedEditExtender to give me a date mask on a TextBox, and a MaskedEditValidator to give the user feedback if the date is invalid - empty is allowed. I also have a CalendarExtender on this TextBox so the user doesn't have to type. I have two things to note:

    When you set "ClearMaskOnLostFocus" of the extended TextBox properties, the CalendarExtender doesn't work - you can set the date, but when you click away to hide the calendar, it also resets the mask and the TextBox content.When you do not have "ClearMaskOnFocus" set, allow empty values, click in the TextBox (to bring up the input mask), and click out again - the input mask remains and any validation message you attached to the MaskedEditValidator now appears - this goes against what I expect to be correct, as the TextBox is empty.

The third problem that I won't number is that the two problems are exacerbated by the CalendarExtender, without that only the second problem would persist, which could furthermore be solved by setting "ClearMaskOnLostFocus". I haven't tested what happens to the TextBox and its values etc in any other situation.

Has anyone else encountered this issue?

Temporarily, does anyone have a work around? I require the calendar object to give the user a mouse option, and need a basic input mask toat leastblock out alphabetic characters and format the date in dd/MM/yyyy format.

Thanks in advance!

Apologies, I appear to have double posted - use the other one :)

CalendarExtender with Minimum and Maximum Date that can be selected???

I have Textbox with CalendarExtender and RangeValidator for it..But I need that Minimum value for RangeValidator to be selected is Today(DateTime.Now) and Maximum value to be 1/01/2009 .How to do it,can someone write code for it...I tried but I always get some errors..ControlExtender Format is set to this ="d/MM/yyyy"

Page Load

rangevalidator1.minimumvalue = DateTime.Now.ToShortDateString

rangevalidator1.maximumvalue = "1/01/2009"

Here is the answer...and it works perfectly...

Code behing

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

RangeValidator1.MinimumValue = DateTime.Now.ToString("dd-MM-yyyy")

RangeValidator1.MaximumValue ="30-12-2200"

EndSub

<formid="form1"runat="server">

<asp:ScriptManagerID="ScriptManager1"runat="server">

</asp:ScriptManager>

<ajaxToolkit:CalendarExtenderID="CalendarExtender1"runat="server"TargetControlID="TextBox1"Format="dd-MM-yyyy">

</ajaxToolkit:CalendarExtender>

<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>

<asp:RangeValidatorID="RangeValidator1"runat="server"ErrorMessage="RangeValidator"ControlToValidate="TextBox1"Type="Date"></asp:RangeValidator>

</form>

CalendarExtender throws error after manual textbox input

Hya,

I'm encountering a few issues with the calendarextender on the new RTM, i just have a textbox, a image, and the extender on a blank page:

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><asp:Label ID="lblPublishDate" runat="server" AssociatedControlID="publish_date" Text="Publish Date:"></asp:Label><br /><asp:TextBox ID="publish_date" runat="server" CssClass="frm_textbox" Width="150px" ValidationGroup="SearchLatestNews"></asp:TextBox><asp:Image runat="Server" ID="imCalendar" CssClass="vm" ImageUrl="/images/calendar.png" /><br /><em>e.g. 01 Jan 2007</em><ajaxToolkit:CalendarExtender ID="extCalendar" runat="server" TargetControlID="publish_date" PopupButtonID="imCalendar" />


The data format is dd MMM yyyy and i want to allow the user to manually input the data aswell as picking it. and i get the following error in both IE and FF:

Error: [Exception... "'Sys.ArgumentUndefinedException: Sys.ArgumentUndefinedException: Value cannot be undefined.
Parameter name: array' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]

Is anyone experienced the same issue? Is there a known workaround?


Kind Regards,

P.

Sorry i was doing some tests, and i accidentally removed the format="dd MMM yyyy" from the code..

CalendarExtender rendering on a page with a large TabContainer

Very strange issue here. I have a page with embedded Tabcontainers and a CalendarExtender. When I click on the Textbox bound to the CalendarExtender it does not display properly. I get no forward/back arrows to scroll months, and if I click on the month name, panels start flying around as opposed to the scrolling behavior that should be experienced.

I've been gradually removing items from my page to try to isloate the problem, and have trimmed things to the attached file. From here, if I delete any one of the TabPanel items, the calendar will render properly. Put it back, and it's messed up again. Additionally, if I move the CalendarExtender above the TabPanel, it renders properly as well. This won't work for my solution, however.

Any insight on what is causing the problem?

/* test.aspx ******************************************************/

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="info_test" Title="Untitled Page" %>
<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<%@dotnet.itags.org. Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Test</title>
</head>
<body >
<form runat="server" id="frmMP" >
<asp:ScriptManager ID="scmMain" EnablePartialRendering="true" runat="server" />
<ajax:tabcontainer runat="server" ID="tbcMain">
<ajax:TabPanel runat="server" ID="tplMain1" HeaderText="Main1" >
<ContentTemplate>
<ajax:tabcontainer ID="tplSub1" runat="server">
<ajax:TabPanel runat="server" ID="tplSub1_1" HeaderText="Sub1_1"/>
<ajax:TabPanel runat="server" ID="tplSub1_2" HeaderText="Sub1_2"/>
<ajax:TabPanel runat="server" ID="tplSub1_3" HeaderText="Sub1_3"/>
<ajax:TabPanel runat="server" ID="tplSub1_4" HeaderText="Sub1_4"/>
<ajax:TabPanel runat="server" ID="tplSub1_5" HeaderText="Sub1_5"/>
<ajax:TabPanel runat="server" ID="tplSub1_6" HeaderText="Sub1_6"/>
<ajax:TabPanel runat="server" ID="tplSub1_7" HeaderText="Sub1_7"/>
</ajax:tabcontainer >
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="tplMain3" HeaderText="Main3">
<ContentTemplate>
<ajax:tabcontainer ID="tplSub3" runat="server">
<ajax:TabPanel runat="server" ID="tplSub3_1" HeaderText="Sub3_1" />
<ajax:TabPanel runat="server" ID="tplSub3_2" HeaderText="Sub3_2" />
<ajax:TabPanel runat="server" ID="tplSub3_3" HeaderText="Sub3_3" />
<ajax:TabPanel runat="server" ID="tplSub3_4" HeaderText="Sub3_4" />
<ajax:TabPanel runat="server" ID="tplSub3_5" HeaderText="Sub3_5" />
<ajax:TabPanel runat="server" ID="tplSub3_6" HeaderText="Sub3_6" />
</ajax:tabcontainer >
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" ID="tplMain4" HeaderText="Main4">
<ContentTemplate>
<ajax:tabcontainer ID="tplSub4" runat="server">
<ajax:TabPanel runat="server" ID="tplSub4_1" HeaderText="Sub4_1" />
<ajax:TabPanel runat="server" ID="tplSub4_2" HeaderText="Sub4_2" />
<ajax:TabPanel runat="server" ID="tplSub4_3" HeaderText="Sub4_3" />
<ajax:TabPanel runat="server" ID="tplSub4_4" HeaderText="Sub4_4" />
<ajax:TabPanel runat="server" ID="tplSub4_5" HeaderText="Sub4_5" />
<ajax:TabPanel runat="server" ID="tplSub4_6" HeaderText="Sub4_6" />
<ajax:TabPanel runat="server" ID="tplSub4_7" HeaderText="Sub4_7" />
<ajax:TabPanel runat="server" ID="tplSub4_8" HeaderText="Sub4_8" />
<ajax:TabPanel runat="server" ID="tplSub4_9" HeaderText="Sub4_9" />
<ajax:TabPanel runat="server" ID="tplSub4_10" HeaderText="Sub4_10" />
<ajax:TabPanel runat="server" ID="tplSub4_11" HeaderText="Sub4_11" />
</ajax:tabcontainer >
</ContentTemplate>
</ajax:TabPanel>
</ajax:tabcontainer>
<asp:TextBox ID="txtA" runat="server"/>
<ajax:CalendarExtender ID="ceCal" runat="server" TargetControlID="txtA" CssClass="MyCalendar"/>
</form>
</body>
</html>

Hi,

Wow... this is bizarre. Our current best guess is that it looks like IE will only load the first 32 <link> tags at the top of the page. Currently if you use the default tab style, it's adding a <link> for each tab/panel/etc. and the <link> for the Calendar's style is the 33rd (which is why moving the calendar above the tabs fixes the problem). As a quick workaround I'd recommend you not use the default style (i.e. copy the default style into your page, give it a different name, etc.) to prevent tabs from loading that many links. I'll open a work item to see what we can do from our end to not load duplicate <link>s.

Thanks,
Ted


Hi,

Here's thework item.

Also, there's an even quicker work around. Just move the CalendarExtender above the tabs. Your textbox can stay in the same place so your page looks fine, but the Calendar will be processed first.

Thanks,
Ted


Workaround works perfectly. Thanks for your assistance, Ted!

Yes

CalendarExtender reads textbox as MM/dd/yyyy regardless of Format field.

Regardless of what I set the Format field to the CalendarExtender always reads the date from the textbox in american MM/dd/yyyy format.

My site is in NZ format dd/MM/yyyy.

Anyone know a workaround?

The problem is with the date parsing, in that I'm only currently doing new Date(dateString), which does not obey the format rules specified yet. There is no format-specific date parsing in javascript or in the AJAX core, so I will have to talk with the team to determine how best to handle this.

Picker has some more complicated parsing features I may generalize to support this, so keep an eye on the project progress while we attempt to resolvethis.


Thank you for your help. Is there any way I can work around the problem by manually altering the date the calendarextender at some event?


Hi,

I have just tested it basing on AJAX 1.0 and it works for me if I set format like dd-MM-yy and properly fill in the master text box.

Double check please if you master text box has AutoPostBack set to false.

Regards,

Adam Koszlajda

CalendarExtender question

How do I get the CalendarExtender to close when a date is selected. I tried below, but when I click a date, the textbox is populated, but the calendar is still displayed.

<asp:TextBoxID="TextboxEnd"runat="server"Text="enter end date"/>

<ajaxToolkit:CalendarExtenderID="CalendarExtenderEnd"runat="server"TargetControlID="TextBoxEnd"Animated=true/>

That's funky...we had the opposite problem: if you brought up the calendar but didn't want to select a date...just make it disappear...and clicked anywhere else on the screen, it wouldn't hide the calander until you selected a date.

We found that the new version of the Toolbox that was released recently fixes our issue...it might fix yours too...are you using the updated Toolbox controls or the older ones?

Just curious: does this happen in Firefox and IE, or just in one?


It happens in both IE and FF. I think I am using the new ones. I downloaded about a month ago. Was there a new build since then? The only way I can get the calendar to disappear is to click somewhere else on the screen.


Thanks, D'Arcy. I downloaded the September 2007 release and it's working great now.

CalendarExtender question

I have a textbox, an image button and a calendar extender on my form. If I go with the default and don't make an entry for the PopupControlID attribute, the calendar gets displayed when the textbox gets focus and I can select a date from it. If I use the image button as the entry for the PopupControlID attribute, the calendar initially gets displayed but then the whole page posts to the server and returns before a date can be selected. There aren't any AJAX controls on the MasterPage and nothing in it's code-behind that would cause this issue. There also isn't currently any code-behind in my form ... just HTML ... and I'm posting it in its entirety below:

<%@dotnet.itags.org.PageLanguage="VB"MasterPageFile="~/MasterPages/MasterPage.master"AutoEventWireup="false"CodeFile="CalendarTest.aspx.vb"Inherits="Correspondence_CalendarTest"title="Untitled Page" %>
<%@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<asp:ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server">

<asp:ScriptManagerrunat="server"></asp:ScriptManager>
<br/><br/>
<asp:TextBoxID="Date1"runat="server"></asp:TextBox>
<asp:ImageButtonID="ImageButton1"runat="server"ImageUrl="~/Images/Calendar_scheduleHS.png"/>
<cc1:CalendarExtenderID="CalendarExtender1"runat="server"TargetControlID="Date1"PopupButtonID="ImageButton1">
<%--
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="Date1">
--%>
</cc1:CalendarExtender>

</asp:Content>

Why does this bloody thing insist on posting back to the server and is there anything I can do to prevent it from occurring?

TIA,

Allen

this is from another issue close to what you have because when you click the button a second time it does a post back as well. there is the solution from another post.

just to say, I've found this can be solved by creating a plain html img tag and assigning the popubbutton id to that instead of an asp imagebutton control


Did you make sure the CAUSESVALIDATION property of the Calendarextender is set to false? There is no problem using an asp:imagebutton control if you have that done. I mean that way when the Calendar control is clicked, all that happens is the control opens and selection is made.

Dollarjunkie

CalendarExtender positioning problem in wide gridview

Hey all, I place a textbox and a calendarextender within an edititemtemplate of a gridview. Everything works fine, but the calendar popup always appears in the same place regardless of the column. In other words, I have 23 columns in a gridview. If I have calendar extenders in there for columns 3, 9, and 23 the popups always appear at the same place instead of right next to their associated textbox. I can't figure out how to get them to stay put. There's no funky CSS issues here. I'm not absolute positioning anything. Thoughts?

Behold an example:

<asp:TemplateFieldHeaderText="Offload"SortExpression="OFFLOAD"HeaderStyle-BackColor="#87CEEB">

ItemTemplate>

<asp:LabelID="lblOFFLOAD"runat="server"Text='<%#Bind("OFFLOAD","{0:d}")%>'Width="70px"/></ItemTemplate><EditItemTemplate><asp:TextBoxID="txtOFFLOAD"runat="server"Text='<%#Bind("OFFLOAD","{0:d}")%>' /><cc1:CalendarExtenderID="CalOFFLOAD"runat="server"TargetControlID="txtOFFLOAD"/></EditItemTemplate></asp:TemplateField>Anyone? Help!
Anyone? Help! Please? :)

It seems I'm having the same problem you are. I guess we are the only ones with this problem because I can't seem to find an answer anywhere and no one has a solution. If you can find out anything please post a reply with the solution and I will do the same.

Thanks,

Mike

CalendarExtender positioning

When binding the CalendarExtender to an target textbox, the calendar will display immediatly below the textbox.
Is there a way to control the positioning of the calender so it will appear for example abowe the textbox?

Hi,

you can use

PopupPosition="TopRight" / TopLeft / BottomLeft/ BottomRight

in CalendarExtender tag property

hope it helps


Thanks, this answered my question.
Your answer made me realize that didn't have the latest release of the toolbox installed.
The one I had didn't support the PopupPosition attribute.Thanks

CalendarExtender Pops up below DropDownList - need help

Hi, I've used CalendarExtender with a TextBox. In the next row I had a dropdownList. Now, when I click the imagebutton, the Calender pops-up below the DropDownList.

Can any one help me with this?

Hi,

Please refer to this post: http://forums.asp.net/p/834115/834115.aspx#834115

CalendarExtender padding within Table

Hi,

I have a Textbox/CalendarExtender in a table, whose td style contains "padding:10px;". When I click in the textbox to open the calendar it appears to be all messed up. On further investigation, it appears to be inheriting the padding from my table. When I remove the "padding:10px;" line from my table style, the calendar displays fine. Has anyone any idea how to override this?

Many thanks,


Simon

What if you set the CssClass property for the CalendarExtender and in the class definition, you set the padding on td:s to 0?