Showing posts with label popup. Show all posts
Showing posts with label popup. Show all posts

Wednesday, March 28, 2012

Very rich data to be presented in pushpin popup - how to?

Hello,

suppose we have a list of objects retrieved from a webservice which we want to present in Virtual Earth Map as a set of pushpins. And one of fields of the object (presented in one pushpin) is another list. For example consider object of the following class:

1public class Point2{3string city;4string lat;5string lon;6 List<Person> list;7}
 wherePerson is another class like:
 1public class Person2{3string firstname;4string lastname;5string about;6}  

Now, I need to make a pushpin from every Point object of the list retrieved from the webservice. That's the easy part. :)

My problem is how to present the list of - let say - lastnames from List<Person> list in pushpin popup. Any ideas how to do it in a declarative way?

I'm still using the Atlas, not ASP.NET AJAX.

Please! Any help! I'm so confused :)

Hi,

check the mashup in my signature, it performs something similar, but with a list of images. You can download the source code.


Wow. This is a very nice application. :)I'm studying it hard.

Maybe you know some good sources of information about xml-script?


Just wondering, is your demo updated for the Beta release?

Hi,

no, at the moment it works only with the July CTP.


So, any clues where to find information about programming Atlas in a declarative way (by XML-script)?

Your demo is excellent example, but still example and I would love to learn all of it :) The old Atlas documentation is not available. Maybe someone has it?

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

Virtual keyboard

Hello,

I'm wondering if AJAX has sample or thread about popup/virtual keyboard? I am trying to use it on a touchscreen project. Thanks for any suggestions.

RO

Hi,

Here is link to related article:

http://www.codeproject.com/jscript/jvk.asp

I hope this helps


Im not sure why you would need asynchronomous javascript for a virtual keyboard, were you just using AJAX synonymously to javascript? This can help either way.

http://www.codeproject.com/jscript/jvk.asp

I just posted and was beaten! LOL.. Hate it when that happens, but thats why there is a duplicate answer here.


Great, thanks mystery!

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 and popup cal inside update panel

Hi David Anson, want to know if the problem for watermark and popup cal have been sloved.
Thanks.

Not sure I know what issue you mean, but maybe the following blog posting helps?

http://blogs.msdn.com/delay/archive/2006/08/15/701848.aspx


Thanks, David. I try the code with AtlasControlToolkit-1064. It reports error
object does not support the property or method

the code for this error is:
$object("TextBoxWatermarkBehavior_TextBox1").set_text(favoriteColor);.

I try the apporach for my case as with textbox and popup calendar.
Code:
<script>
function commitScript() {
var mydate = $("TextBox1").mydate;
if("" == favoriteColor) {
favoriteColor = "";
}
$object("TextBoxWatermarkBehavior_TextBox1").set_text(mydate);
}
</script
<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="txtBatchDateTextBox" PopupControlID="Panel1"
Position="Bottom" ID="PopControlBehavior1" CommitProperty ="batchDate" CommitScript ="commitScript()"/>
</atlasToolkit:PopupControlExtender>
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Panel
<atlasToolkit:TextBoxWatermarkProperties ID="TextBoxWatermarkBehavior" TargetControlID="TextBox1"
WatermarkText="<DD/MM/YYYY>" WatermarkCssClass="watermarked" /
<asp:TextBox ID="TextBox1" runat="server" CssClass="TextBox" Width="152px"></asp:TextBox></td
The I got error:
Object Required

The code for this error is:
var mydate = $("TextBox1").mydate;

So questtions are:
Where to get the 60731 release of the Toolkit?
Only this release support custom expando property for targetControlID?
Sorry, the code is:

<script>
function commitScript() {
var mydate = $("TextBox1").mydate;
if("" == mydate) {
mydate = "";
}
$object("TextBoxWatermarkBehavior_TextBox1").set_text(mydate);
}
</script
<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:PopupControlPropertiesTargetControlID="txtBatchDateTextBox" PopupControlID="Panel1"
Position="Bottom" ID="PopControlBehavior1" CommitProperty ="mydate"CommitScript ="commitScript()"/>
</atlasToolkit:PopupControlExtender>
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Panel
<atlasToolkit:TextBoxWatermarkProperties ID="TextBoxWatermarkBehavior" TargetControlID="TextBox1"
WatermarkText="<DD/MM/YYYY>" WatermarkCssClass="watermarked" /
<asp:TextBox ID="TextBox1" runat="server" CssClass="TextBox" Width="152px"></asp:TextBox></td>
As I note in the blog post, the example is forToolkit release 60731.
Hi David, Thanks for your message. I download the release 60731 and try it for watermark and popcalendar, it is greate okay. But I have another prblem.

In my page, I use many other atlas toolkit controls. It works fine when I use AtlasControlToolkit-1064. But with the release 60731, it cause a lot of assertion errors. The following code cause assertion errors for ConfirmButton and errorMessage user control.

Any new release include 67031 and 1064 fixes?

<%@. Register src="http://pics.10026.com/?src=errormessage.ascx" TagName="errormessage" TagPrefix="uc2" %>
...
<atlasToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server">
<atlasToolkit:ConfirmButtonProperties TargetControlID="btnDelete" ConfirmText="Are you sure you want to delete?" />
</atlasToolkit:ConfirmButtonExtender>
<uc2:errormessage ID="ErrorMessage1" runat="server" />
More info about ConfirmButton:

For the ConfirmButton, its target control is a button. This button is visible or invisible dynamically. When It is invoisible, then there is a assertion error.
This visible attirbute is set in asp code.

With release 1064, it's okay. With release 60731, it report assertion error.

<atlasToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server">
<atlasToolkit:ConfirmButtonProperties TargetControlID="btnDelete"ConfirmText="Are you sure you want to delete?" />
</atlasToolkit:ConfirmButtonExtender>

Please post a simple page demonstrating the assertion you hit. Thanks!

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.