Showing posts with label calendar. Show all posts
Showing posts with label calendar. Show all posts

Wednesday, March 28, 2012

Very slow and unresponsive AJAX (Calendar + Tabs)

i just installed the toolkit into Visual Studio 2005, and managed to create some sample projects

I've implemented the Tabs and Calendar onto an existing project, in the believe that Ajax would provide faster (or as fast) access then the existing solution.

in order to make the Ajax work in the project, I've copied nearly all needed elements into the web.config ( http://codebetter.com/blogs/jay.kimble/archive/2006/10/26/How-To_3A00_-Enable-Microsoft-Ajax-Beta-over-on-an-existing-site.aspx )

now - the Ajax Calendar and Tabs works, the old server side asp.net have been fitted to the new controls...

but very very slow !?!? - the calendar takes 3-4 seconds to show and a single action in it takes 1-2 seconds ?

code:

1<%@dotnet.itags.org. Control Language='vb' AutoEventWireup='false' Codebehind='ctlQuizEdit.ascx.vb'2 Inherits='SurveyFactory.ctlQuizEdit' TargetSchema='http://schemas.microsoft.com/intellisense/ie3-2nav3-0' %>3<%@dotnet.itags.org. Register TagPrefix='fcke' TagName='FckHeader' src='ctlImportDefLangHeader.ascx' %>4<%@dotnet.itags.org. Register TagPrefix='fcke' TagName='FckFooter' src='ctlImportDefLangFooter.ascx' %>5<%@dotnet.itags.org. Register TagPrefix='cc1' TagName='HeaderFooter' src='ctlHeaderFooter.ascx' %>6<%@dotnet.itags.org. Register TagPrefix="cc1" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>789<cc1:TabContainer Height="250px" Width="600px" ID="TabContainer1" runat="server">10 <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Survey">11 <ContentTemplate>12 <table id="editQuizData" runat="server" width="100%" cellspacing="1" cellpadding="2" border="0" height="10">13 <tr>14 <td align="left" colspan="2">15 <asp:Label ID="lblQuizAction" Text="Edit" Font-Bold="True" runat="server" /><br>16 <asp:Label ID="lblError" runat="server" />17 </td>18 </tr>19 <tr>20 <td align="left">Title</td>21 <td align="left"><asp:TextBox ID="txtQuizTitle" Columns="80" runat="server"></asp:TextBox></td>22 </tr>23 <tr>24 <td align="left">Description</td>25 <td align="left"><asp:TextBox ID="txtQuizDescription" Columns="80" Rows="2" TextMode="MultiLine" runat="server"></asp:TextBox>26 </td>27 </tr>28 <tr>29 <td align="left">Created by</td>30 <td align="left"><asp:Label ID="lblCreatedBy" runat="server" />31 </td>32 </tr>33 <tr>34 <td align="left" valign="top">Interval</td>35 <td align="left">36 <table id="Table1" runat="server" width="100%" cellpadding="0" cellspacing="0" border="0">37 <tr>38 <td align="left" valign="top">From</td>39 <td align="left" valign="top">To</td>40 </tr>41 <tr>42 <td align="left">43 <asp:TextBox ID="CalendarQuizFrom" runat="server"></asp:TextBox>44 <cc1:CalendarExtender ID="CalendarExtender1" runat="server"45 TargetControlID="CalendarQuizFrom" Format="dd-MM-yyyy" />46 </td>47 <td align="left">48 <asp:TextBox ID="CalendarQuizTo" runat="server"></asp:TextBox>49 <cc1:CalendarExtender ID="CalendarExtender2" runat="server"50 TargetControlID="CalendarQuizTo" Format="dd-MM-yyyy" />51 </td>52 </tr>53 </table>54 </td>55 </tr>56 </table>57 </ContentTemplate>58 </cc1:TabPanel>59 <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Header">60 <ContentTemplate>61 <fcke:FckHeader runat="server" ID="FckHeader" />62 </ContentTemplate>63 </cc1:TabPanel>64 <cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="Footer">65 <ContentTemplate>66 <fcke:FckFooter runat="server" ID="FckFooter" />67 </ContentTemplate>68 </cc1:TabPanel>69</cc1:TabContainer>7071<center>72 <asp:Button ID="btnSave" runat="server" Text="Save"></asp:Button> 73 <asp:Button ID="btnCancel" runat="server" Text="Cancel"></asp:Button>74</center>7576<input id="hiddenLangHeaderTxt" type="hidden" name="hiddenLangHeaderTxt">77<input id="hiddenLangFooterTxt" type="hidden" name="hiddenLangFooterTxt">78<input id="hiddenFooter" type="hidden" name="hiddenFooter" runat="server">79<input id="hiddenHeader" type="hidden" name="hiddenHeader" runat="server">80

Hi Montago,

Your program works pretty well after I removed all the UserControls. So we suggest that you should use an exclusive method that remove the controls one by one until find out the exact root cause. Also, Some helpful debugging tools will make your work easy. For example,IE WebDevelopment Helper,HttpWatch,Firebug etc.

If your problem cannot be resolved , please let me know with more information.

Best regards,

Joanthan

viewstate serialization and atlas

Just testing a little popup calendar user control making use of Atlas. I notice that when I serialize the viewstate unusually (I have a 'StorePage' class that stores the viewstate in the db, keyed on a GUID in a hidden field on the page), the atlas calendar popup fails.

Can I work around this? Do my Atlas pages need to be decended directly from the Page class, or is my GUID-keyed technique flawed?

The calendar uses an updatepanel.

Thanks,

John

Hi John,

Can you explain exactly what doesn't work? Are you registering the hidden field by using ClientScript.RegisterHiddenField?

All pages no matter what will derive from Page, and Atlas doesn't care if there are other intermediate classes in the way (almost all pages have intermediate classes anyway due to code-behind files).

I can't think of any specific reason why this wouldn't work off the top of my head.

Thanks,

Eilon

Saturday, March 24, 2012

Watermark and Popup Calendar issue

David, I download the lastest toolkit, and try the following code in aspx page. It is OK. But when I put it into a user control. It won't work!

The error is caused by code when clicked on popup calender:
var mydate = $("TextBox1").mydate;
The error message is Object is required

<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="false" CodeFile="test2.aspx.vb" Inherits="test2" %>
<%@dotnet.itags.org. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit" %>
<!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 runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<div>
<script type="text/javascript" language="javascript">
function commitScript1() {

var mydate = $("TextBox1").mydate;
if("" == mydate) {
mydate = "";
}
$object("TextBoxWatermarkBehavior_TextBox1").set_Text(mydate);
}
</script>
<asp:TextBox ID="TextBox1" runat="server" Width="150"></asp:TextBox>
<asp:Panel ID="Panel4" runat="server" CssClass="popupControl">
<atlas:UpdatePanel ID="UpdatePanel6" runat="server" Mode="Conditional" RenderMode="Block">
<ContentTemplate>
<center>
<asp:Calendar ID="Calendar3" runat="server" BackColor="White" BorderColor="#999999"
CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
ForeColor="Black" Width="160px" OnSelectionChanged="Calendar3_SelectionChanged">
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
<SelectorStyle BackColor="#CCCCCC" />
<WeekendDayStyle BackColor="#FFFFCC" />
<OtherMonthDayStyle ForeColor="#808080" />
<NextPrevStyle VerticalAlign="Bottom" />
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
</asp:Calendar>
</center>
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Panel>
<atlasToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender3" runat="server">
<atlasToolkit:TextBoxWatermarkProperties TargetControlID="TextBox1" WatermarkCssClass="watermarked"
WatermarkText="<DD/MM/YYYY>" ID="TextBoxWatermarkBehavior" />
</atlasToolkit:TextBoxWatermarkExtender>
<atlasToolkit:PopupControlExtender ID="PopupControlExtender3" runat="server">
<atlasToolkit:PopupControlProperties TargetControlID="TextBox1" PopupControlID="Panel4"
Position="Bottom" ID="PopControlBehavior1" CommitProperty="mydate" CommitScript="commitScript1()" />
</atlasToolkit:PopupControlExtender> </div>
</form>
</body>
</html
CodeFile:
Partial Class test2
Inherits System.Web.UI.Page
Protected Sub Calendar3_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs)
PopupControlExtender3.Commit(Calendar3.SelectedDate.ToShortDateString())
Calendar3.SelectedDate = Nothing
End Sub
End ClassI believe this thread addresses the issue you're seeing (hard-coded ID changed by inclusion in a different naming container):http://forums.asp.net/thread/1368445.aspx

Watermark Extender and Calendar extender do not work together?

Hi,

I'm wondering if anyone has come up with a solution for this problem. I have a textbox with a Watermark Extender attached to it. I also have a calendar extender attached to that same textbox.

When the page loads the watermark is there as it should. When I click on the textbox the watermark disappears and the calendar launches. So far so good. It seems as though when I click on a calendar date it flashes the date in the textbox then goes back to the watermark.

Are these two controls not able to work together?

Thank you

Vear

We have a bug tracking changes in textbox watermark so that it plays well with other extenders like calendar, masked edit and validators. This should be fixed when that issue is resolved.

Thanks kirtid,

I look forward to the update. I thought I was perhaps doing something wrong.

Vear

Watermark issue

Case: 2 textboxes connect to popup calendar and watermark.

If there are more than one watermark ccontrol in one user control, there is problem as following:

If you input data for textbox1 using popup calendar, it will clean data in textbox2.
If you input data for textbox2 using popup calendar, it will clean data in textbox1.

But if you type the data in textbox, no this problem.

<atlasToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server">
<atlasToolkit:TextBoxWatermarkProperties ID="WaterMark1" TargetControlID="textbox1"
WatermarkText="<Type Batch Name Here>" WatermarkCssClass="watermarked" />
<atlasToolkit:TextBoxWatermarkProperties ID="WaterMark2" TargetControlID="textbox2"
WatermarkText="<DD/MM/YYYY>" WatermarkCssClass="watermarked" />
</atlasToolkit:TextBoxWatermarkExtender>Could you please post a simple, complete sample page that demonstrates the problem?
Sample code here:

<%@. Control Language="VB" AutoEventWireup="false" CodeFile="Edit.ascx.vb" Inherits="Common_Edit" %>
<%@. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit" %
<asp:Panel ID="Panel1" runat="server" CssClass="popupControl">
<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional" RenderMode="Inline">
<ContentTemplate>
<center>
<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="#999999"
CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
ForeColor="Black" Width="160px" OnSelectionChanged="Calendar1_SelectionChanged">
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
<SelectorStyle BackColor="#CCCCCC" />
<WeekendDayStyle BackColor="#FFFFCC" />
<OtherMonthDayStyle ForeColor="#808080" />
<NextPrevStyle VerticalAlign="Bottom" />
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
</asp:Calendar>
</center>
<atlasToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server">
<atlasToolkit:PopupControlProperties TargetControlID="textbox1" PopupControlID="Panel1"
Position="Bottom" />
</atlasToolkit:PopupControlExtender>
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Panel>
<asp:Panel ID="Panel2" runat="server" CssClass="popupControl">
<atlas:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<center>
<asp:Calendar ID="Calendar2" runat="server" BackColor="White" BorderColor="#999999"
CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
ForeColor="Black" Width="160px" OnSelectionChanged="Calendar2_SelectionChanged">
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
<SelectorStyle BackColor="#CCCCCC" />
<WeekendDayStyle BackColor="#FFFFCC" />
<OtherMonthDayStyle ForeColor="#808080" />
<NextPrevStyle VerticalAlign="Bottom" />
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
</asp:Calendar>
</center>
<atlasToolkit:PopupControlExtender ID="PopupControlExtender2" runat="server">
<atlasToolkit:PopupControlProperties TargetControlID="textbox2" PopupControlID="Panel2"
Position="Bottom" />
</atlasToolkit:PopupControlExtender>
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Panel
<atlasToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server">
<atlasToolkit:TextBoxWatermarkProperties ID="WaterMark1" TargetControlID="textbox1"
WatermarkText="<DD/MM/YYYY>" WatermarkCssClass="watermarked" />
<atlasToolkit:TextBoxWatermarkProperties ID="WaterMark2" TargetControlID="textbox2"
WatermarkText="<DD/MM/YYYY>" WatermarkCssClass="watermarked" />
</atlasToolkit:TextBoxWatermarkExtender
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<atlas:UpdatePanel ID="EditUpdatePanel" RenderMode="Inline" Mode="Conditional" runat="Server">
<ContentTemplate>
<table id="Table11" cellspacing="0" cellpadding="0" border="0"
style="width: 752px">
<tr>
<td>
</td>
<td align="right">
Batch Date:</td>
<td>
<asp:TextBox ID="textbox1" runat="server" CssClass="TextBox" Width="152px"></asp:TextBox></td>
<td align="right">
Deposit Date:</td>
<td>
<asp:TextBox ID="textbox2" runat="server" CssClass="TextBox" Width="152px"></asp:TextBox></td>
</tr>
</table>
</ContentTemplate>
</atlas:UpdatePanel>
</td>
</tr>
</table
This also sounds like the problem I found yesterday with 3 textboxes in a DetailsView InsertItemTemplate. One is connected to a calendar popup, another a plain textbox, and the third is my custom auto complete extender. Clicking in the textbox with the popup calendar clears the watermark in the other 2 textboxes.
Kent, the problem you're hitting seems to be because the PopupControl and TextBoxWatermark that are both pointed to the same TextBox are conflicting. If you remove the TBW, the scenario seems to work fine. I don't currently have a good suggestion for making the two controls work together due to the way that UpdatePanels get involved here. Hope this helps.

Watermarked Popup textbox (Calendar)

I searched few hours today on the forum about multiple problems I had and was successful. Unfortunately I come to a point where I have more than one problem which are talked on the forum but where solutions don't rain.

I'm trying to make a search control in ASP.net 2.0. The search is pretty simple :

1. Start date
2. End Date
3. Card number
4. Ref number

3-4 are no challenge...
But for 1-2 I want a textbox watermarked with the correct format and a popup calendar.

I also have 2 buttons :
First one reset the form ideally asynchronously
Second one actually search

What happens with updatepanel1

    When selecting a date nothing happens in the textboxClearing the form works great no problems
What happens without updatepanel1:
    When selecting a date the date appear in the textbox with the watermarked CSS style (color gray)
    When selecting the second textbox the first one disappear.Clearing the form do nothing
I tried to set the ComitProperty of the popupextender to "Text" ; unsuccessful

Code:

<%@dotnet.itags.org. Control Language="C#" AutoEventWireup="true" CodeFile="c_BusinessReport.ascx.cs"
Inherits="controls_c_BusinessReport" %>
<%@dotnet.itags.org. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="atlasToolkit" %>
<atlas:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true" />
<asp:Label ID="lblFruitReport" runat="server" Font-Bold="True" Font-Size="XX-Large"
Text="Fruit Report" Width="285px"></asp:Label>
<br />
<br />
<atlas:UpdatePanel ID="UpdatePanel1" Mode="Always" runat="server">
<ContentTemplate>
<asp:Panel ID="pnlOption" runat="server" GroupingText="Options">
<table width="100%">
<tr>
<td>
<table width="100%">
<tr>
<td style="text-align: right; width: 85px;">
<asp:Label ID="lblStartDate" runat="server" Text="Start date:"></asp:Label></td>
<td>
<asp:TextBox ID="txtStartDate" runat="server" CssClass="unwatermarked"></asp:TextBox>
</td>
</tr>
<tr>
<td style="text-align: right; width: 85px;">
<asp:Label ID="lblEndDate" runat="server" Text="End date:"></asp:Label></td>
<td>
<asp:TextBox ID="txtEndDate" runat="server" CssClass="unwatermarked"></asp:TextBox>
</td>
</tr>
<tr>
<td style="text-align: right; width: 85px;">
<asp:Label ID="lblCard" runat="server" Text="Card number:"></asp:Label></td>
<td>
<asp:TextBox ID="txtCard" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="text-align: right; width: 85px;">
<asp:Label ID="Label1" runat="server" Text="Ref number:"></asp:Label></td>
<td>
<asp:TextBox ID="txtRef" runat="server"></asp:TextBox></td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="border-top-width: thick">
<asp:RadioButtonList ID="radRender" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Value="screen" Selected="True">Show on screen</asp:ListItem>
<asp:ListItem Value="pdf">Show in pdf</asp:ListItem>
<asp:ListItem Value="excel">Show in Excel</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td style="text-align: right">
<asp:Button ID="Clear" Text="Clear" OnClick="Clear_Click" runat="server" />
<asp:Button ID="GetReport" runat="server" Text="Get Report" /></td>
</tr>
</table>
</asp:Panel>
</ContentTemplate>
</atlas:UpdatePanel>
<asp:Panel ID="Panel1" runat="server" CssClass="popupControl">
<atlas:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<center>
<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="#999999"
CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
ForeColor="Black" Width="160px" OnSelectionChanged="Calendar1_SelectionChanged">
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
<SelectorStyle BackColor="#CCCCCC" />
<WeekendDayStyle BackColor="#FFFFCC" />
<OtherMonthDayStyle ForeColor="#808080" />
<NextPrevStyle VerticalAlign="Bottom" />
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
</asp:Calendar>
</center>
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Panel>
<atlasToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server">
<atlasToolkit:TextBoxWatermarkProperties TargetControlID="txtStartDate" WatermarkText="dd/mm/yyyy"
WatermarkCssClass="watermarked" />
<atlasToolkit:TextBoxWatermarkProperties TargetControlID="txtEndDate" WatermarkText="dd/mm/yyyy"
WatermarkCssClass="watermarked" />
</atlasToolkit:TextBoxWatermarkExtender>
<atlasToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server">
<atlasToolkit:FilteredTextBoxProperties TargetControlID="txtStartDate" FilterType="Custom, Numbers"
ValidChars="/" />
<atlasToolkit:FilteredTextBoxProperties TargetControlID="txtEndDate" FilterType="Custom, Numbers"
ValidChars="/" />
<atlasToolkit:FilteredTextBoxProperties TargetControlID="txtCard" FilterType="Numbers" />
<atlasToolkit:FilteredTextBoxProperties TargetControlID="txtRef" FilterType="Numbers" />
</atlasToolkit:FilteredTextBoxExtender>
<atlasToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server">
<atlasToolkit:PopupControlProperties ID="Cal1" TargetControlID="txtStartDate" PopupControlID="Panel1"
Position="Bottom" />
<atlasToolkit:PopupControlProperties ID="Cal2" TargetControlID="txtEndDate" PopupControlID="Panel1"
Position="Bottom" />
</atlasToolkit:PopupControlExtender>

Code-Behind
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using AtlasControlToolkit;

public partialclass controls_c_BusinessReport : System.Web.UI.UserControl
{
protected void Clear_Click(object sender, EventArgs e)
{
foreach(Control controlin this.pnlOption.Controls)
{
if (controlis TextBox)
((TextBox)control).Text ="";
radRender.SelectedIndex = 0;
}
}

/// <summary>
/// Handler for calendar changes
/// </summary>
/// <param name="sender">source</param>
/// <param name="e">arguments</param>
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
// Popup result is the selected date
PopupControlExtender.GetCurrent(this.Page).Commit(Calendar1.SelectedDate.ToShortDateString());
}
}


CSS (partial)
.watermarked{color:gray;}.unwatermarked{color:Black;} 

You're running into a few different issues here. I could work around most of them, but ultimately you're going to get stuck because ofwork item 711, I think. We hope to fix that by the next release, so maybe if you can wait till then?

PS - One of the problems you're hitting is fixable now thatwork item 1053 has been fixed (for 60731). You'll want to use PopupControl's CommitScript to call a little helper that uses this method to set the text box text instead of letting PopupControl do so as it is now. One of the things that's happening is that the watermark state is getting confused.


David Anson:

You're running into a few different issues here. I could work around most of them, but ultimately you're going to get stuck because ofwork item 711, I think. We hope to fix that by the next release, so maybe if you can wait till then?

Thx for answering !
Do you have any idea when will be the next release?

David Anson:

PS - One of the problems you're hitting is fixable now thatwork item 1053 has been fixed (for 60731). You'll want to use PopupControl's CommitScript to call a little helper that uses this method to set the text box text instead of letting PopupControl do so as it is now. One of the things that's happening is that the watermark state is getting confused.

Excuse me for this second post but I have tried this :

<atlasToolkit:PopupControlProperties ID="Cal1" TargetControlID="txtStartDate" PopupControlID="Panel1"
Position="Bottom" CommitScript="_ctl00_ContentPlaceHolder1_C_BusinessReport1_txtStartDate.set_Text(ctl00_ContentPlaceHolder1_C_BusinessReport1_txtStartDate.value);

And it says : _ctl00_ContentPlaceHolder1_C_BusinessReport1_txtStartDate is undefined

I am not used to javascript and not even sure the syntax is coorect. I have checked in the source of the page and the name I have entered is the ID of my textbox... don't know why it says it is not defined.

Any help on the script I must make to use the set_text method?

The correct form will look a little more like (just typing from memory here):

<WatermarkProperties ID="watpropid" ...

<PopupProperties ID="poppropid" CommitProperty="rawvalue" CommitScript="$object('watpropid').set_Text($('txtStartDate').rawvalue);" ...

Basically, have Popup stuff the value in an expando property on the target textbox, then find the Watermark behavior and use its set_Text method to apply the value from the expando property.


I receive that error : 'undefined' is null or not an object

Code

<atlasToolkit:TextBoxWatermarkProperties Id="startDateWatermarked" TargetControlID="txtStartDate" WatermarkText="dd/mm/yyyy" WatermarkCssClass="watermarked" /
<atlasToolkit:PopupControlProperties ID="Cal1" TargetControlID="txtStartDate" PopupControlID="Panel1" Position="Bottom" CommitScript="$object('startDateWatermarked').set_Text($('txtStartDate').rawvalue);"/>

You didn't set CommitProperty.

David Anson:

You didn't set CommitProperty.

I added it and the same error occur.
I plan to blog a sample of using PC+TBW together in the next couple of days. I'll update this thread once I've done so. I'm thinking a simple example may help clear things up all around. :)

David Anson:

I plan to blog a sample of using PC+TBW together in the next couple of days. I'll update this thread once I've done so. I'm thinking a simple example may help clear things up all around. :)

That would be great

Thx David
I've just postedhttp://blogs.msdn.com/delay/archive/2006/08/15/701848.aspx. Hope this helps!!
Thx for tutorial,

I have created the sample in atlasControlToolkit project and it works well. I adapt it with calendar variable names, etc and it work as I need it to work in the atlas project.

But when I copy and paste the whole page into my project to test it, it still gives me the object undefined error. For what I can understand, since I do this into a control and place it in a contentplaceholder, it cannot find the variable into the contentPlaceholder.

Is it possible that their is an issue with the control toolkit with the content placeholder?
I made sone test and it is defenatly the fact the control is in a content place holder.

the problem is in the javascript function :

Original (modified for calendar but working):

 <script type="text/javascript"> // Called when PopupControl has been dismissed (registerd via CommitScript property on // PopupControlProperties) function commitScript() { // Get the comitted property from the specified expando property on the TargetControlID // (CommitProperty above) var date = $("TextBox1").date; } // Call into the TextBoxWatermark behavior to set the desired text $object("TextBoxWatermarkBehavior_TextBox1").set_Text(date); } </script>

Modified to work in my content placeholder :

 function commitScript() { // Get the comitted property from the specified expando property on the TargetControlID // (CommitProperty above) var date = $("ctl00_ContentPlaceHolder1_C_calendar1_TextBox1").date; // If it's the magic value "[Clear]", then set empty text into the textbox (which // restores the watermark) if("[Clear]" == date) { date = ""; } // Call into the TextBoxWatermark behavior to set the desired text $object("TextBoxWatermarkBehavior_ctl00_ContentPlaceHolder1_C_calendar1_TextBox1").set_Text(date); }

Any idea how I could make it dynamic cause If I want to build a user control named calendar I need it to be dynamic...

Thx

Solution :

<

asp:PanelID="pn1"runat="server"CssClass="popupControl">
<atlas:UpdatePanelID="up2"runat="server">
<ContentTemplate>
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTriggerControlID="Calendar1"EventName="SelectionChanged"/>
</Triggers>
</atlas:UpdatePanel>

</asp:Panel>
<asp:PanelID="pn2"runat="server"CssClass="popupControl">
<atlas:UpdatePanelID="up3"runat="server">
<ContentTemplate>
<center>
<asp:CalendarID="Calendar1"runat="server"BackColor="White"BorderColor="#999999"CellPadding="1"DayNameFormat="Shortest"Font-Names="Verdana"Font-Size="8pt"ForeColor="Black"Width="160px"OnSelectionChanged="Calendar1_SelectionChanged">
<SelectedDayStyleBackColor="#666666"Font-Bold="True"ForeColor="White"/>
<TodayDayStyleBackColor="#CCCCCC"ForeColor="Black"/>
<SelectorStyleBackColor="#CCCCCC"/>
<WeekendDayStyleBackColor="#FFFFCC"/>
<OtherMonthDayStyleForeColor="#808080"/>
<NextPrevStyleVerticalAlign="Bottom"/>
<DayHeaderStyleBackColor="#CCCCCC"Font-Bold="True"Font-Size="7pt"/>
<TitleStyleBackColor="#999999"BorderColor="Black"Font-Bold="True"/>
</asp:Calendar>
</center>
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Panel>

<cc1:TextBoxWatermarkExtenderID="TextBoxWatermarkExtender1"runat="server">
<cc1:TextBoxWatermarkPropertiesid="TextBoxWatermarkProperties1"TargetControlID="TextBox1"WatermarkCssClass="toto"WatermarkText="Select date"/>
</cc1:TextBoxWatermarkExtender>

<cc1:PopupControlExtenderID="PopupControlExtender1"runat="server">
<cc1:PopupControlPropertiesid="PopupControlProperties1"PopupControlID="pn2"Position="Bottom"TargetControlID="TextBox1"/>
</cc1:PopupControlExtender>

Protected

Sub Calendar1_SelectionChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)
TextBox1.Text = Calendar1.SelectedDate.ToShortDateString()
EndSub
You can render the commitScript on the server where the TextBox1.ClientID will get you the necessary client ID. Then just pass that text down to the client and it'll be as though you coded in the right ID from the start.