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

Monday, March 26, 2012

Visibility problem with ajax control

hi,

I have a textbox and required field validator control.when the page is 1st loaded the Textbox is invisible and after clicking a button it becomes visible but

the problem is that the validator control is not working though the text box is visible now? why any idea pls?

Hi,

Can you post sample code to illustratete problem? I cannot get the same problem just by placing textbox and required validator in update panel and makeing TextBox invisible initially.

-yuriy


If you are using Validators inside UpdatePanel, then it is not compatible with it

http://weblogs.asp.net/scottgu/archive/2007/01/25/links-to-asp-net-ajax-1-0-resources-and-answers-to-some-common-questions.aspx

You can download compatible validators control from here

http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx


hi,

I have used the usual asp validators.Now I have add the tag mapping required in web.config file and add reference to validation.dll.But when I run the program it shows error in my user controls which are in another folder with a custom namespace.any idea pls? the pages are not showing error but the user controls are showing error.By the By the Pages where these user controls are imported are also in a folder.

pls reply...


I have put the error messags given in my User Controls below:

pls see this and reply quickly............

Error 150 Could not load file or assembly 'Validators, Version=1.0.0.0' or one of its dependencies. The system cannot find the file specified. (D:\SSDTracker\Tracker\web.config line 92) D:\SSDTracker\Tracker\User Controls\CompetencyDatabase\CompetencySectionUI.ascx 32


Hi,

I think the error message explained the issue clear.Make sure Validators.dll is in the right folder and the version of it is right. Make sure you made the right setting in the config file.

Good luck!

Visual verification extender

Hi,

Are there any plans for a visual verification extender that would be linked to a textbox control and that would show an obscured code that has to be entered by the user to protect against automated registrations?

Would be a nice control for the toolkit.

Thanks,

Jason

As far as I know there is currently no one working on a CAPTCHA extender, but we do have the NoBot extender which is designed to prevent many cases of automated posting that a turing test like CAPTCHA is supposed to block. Take a look athttp://ajax.asp.net/ajaxtoolkit/NoBot/NoBot.aspx

Cool...that should do the trick. Thanks.

VSHTMLGenericElement minor issue

Not a major issue but is very easy to produce. For example, if you add a textbox watermark extender and link it to a textbox then delete the extender. The textbox will only be displayed as a "VSHTMLGenericElement" without any properties. The fix is to save your page. Then close and reopen the ASPX page you are working on. Then the textbox will be labeled as a textbox again.

Like I said not a major issue but seems like something doesn't get reset after the delete.

Yes.This is not a major issue for web application development.You should save current web files when you make some changes to them.Otherwise maybe you will get some issues for not saving them.

Saturday, March 24, 2012

Watermark and Atlas Client Side Code issue

If I connect a textbox to a watermark control and write client side code like
obj = new Sys.UI.TextBox($('<%=textbox1.ClientID%>'));

it will report Assertion Failed error even if I set ID property for watermark control.

Myabe it is a bug of Atlas.

You're missing a getElementByID. The following works for me:

function foo() {
obj = new Sys.UI.TextBox(document.getElementById('<%= TextBox1.ClientID %>'));
alert(obj);
}
foo();


Hi David, Thanks for your help.
After changing
obj = new Sys.UI.TextBox('<%= TextBox1.ClientID %>');
to
obj = new Sys.UI.TextBox(document.getElementById('<%= TextBox1.ClientID %>'));

I still get same Assertion Failed error.

With my case, this textbox1 is inside an UpdatePanel. In this Updatepanel, I have a button with some ASP.NET code. when Clicking on this button, it only cause partial rendering.

The javascript here only get a string from a popup window. After the code
obj = new Sys.UI.TextBox('<%= TextBox1.ClientID %>');
is executed, and then click on the button inside the Updatepanel, the error came out.

But if code
obj = new Sys.UI.TextBox('<%= TextBox1.ClientID %>');
never executed, everything is OK.

I think the issue here is that the wrapper for hte textbox has already been created, that's why you're getting the assert (for future issues, please paste in the test of the assertion as well, it's usually helpful).

try this code instead:

obj = $object('<%= TextBox1.ClientID %>');


Is there any way to disable the Watermark? I'm getting an assertion error following a postback when I've set the Watermark's target textbox's visible property to false. The error message is:

Assertion Failed: Could not find an HTML element with ID "ctl00_CH_NewFeedTextBox" for control of type "Sys.UI.TextBox".

My code is just a click handler that is setting the visible property of the textbox to false. I'd be happy to set the Enabled property of the Watermark to false as well... if it had such a property.


When you set the Visible property to false, the control isn't rendered at all to the client. Thus, there is no ctl00_CH_NewFeedTextBox control in your client-side page. try NewFeedTextVox.style.display="none" to hide it. This will make it render to the page, but not be visible in the browser.
Hi sburke_msft, If I change the code to
obj = $object('<%= TextBox1.ClientID %>');
then it will report error obj is null.

Here question is I want to use Atlas code and make things simply. If I do not use Atlas code here, just use javascript directly, no this problem.
It means watermark combine orginal javascript, no this problem.

I certainly *could* do that and get past this error, but the point is that the extenders are supposed to add functionality to other controls without requiring me to change how I'm using those controls. Since it is perfectly normal for developers to set the Visible property to false for TextBox controls (and since this is more efficient in terms of rendering time and bandwidth, etc.), the better solution would be to fix the Extender so that it can detect whether the Control it is associated with is Visible, and if not, disable itself. Or, barring that, expose an Enabled property that I can manually set to false when I disable/invisible the control it is targeting.


Agreed. However to be overly blunt, before a fix comes out, you have only ( as far as I know, correct me if wrong ) 2 options: write your own extender, or use the display property.

This has come up several times. As pointed out here, Visible=false means that the control isn't rendered, so there's no way the client side code can handle it.

We've talked about possible solutions, but none of them are automagic and still reasonable:

1) We could flip the visible bit and add display:none via the extender - this could expose security issues by rendering code that wasn't intended to be

2) We could throw an exception - this means you still need to make this change to your HTML

3) We could do nothing - this makes it pretty hard to debug and people waste time trying to figure out why X isn't working.

So at the end of the day, yes, you need to make a markup change here. Our goal with extenders is to allow you to do as much as possible without modifying the original page but there are many, many scenarios when this just simply isn't possible.

Hope that helps.


In my scenario, the request I would have is that the extender expose an Enabled property (or Visible, but since most of them aren't really visible to begin with, Enabled is more intuitive). If I *know* that I'm writing some code that is going to take the target of the extender away, then that gives me the developer to option of turning off the extender in that same chunk of code. Meanwhile, everything else works as before.

I know I'm going to have to write code for this situation to work out. That's ok - that's not my point. What I'm going for is the best implementation for the Extender controls.

The question is, would I rather

A) Write some CSS code to hide my textbox when I have years of experience, best practices, and thousands of lines of code showing me that to do this I set Visible to False.

or

B) Modify the control that I've just added to the page, the one that I'm already having to touch anyway, the one that is bombing out, and the one that has as one of its core advantages the lack of necessity to touch its target control.

My vote is B. The code for this should be simple -- wrap the control's inner workings in a big if(this.Enabled) statement.

Thanks - I hope that clearly makes my point/recommendation.


I guess my underlying question, which I'll make explicit here, is:

Whynot have an Enabled property on Extender controls to enable/disable their behavior?


Actually this has been solved - I forgot that we did make a change here. Make sure you have a new Toolkit build.

If the target control isn't Visible, we simply don't emit the hookup, so nothing happens. Once it becomes visible, we'll generate the hookup and it'll start working.

Watermark + Textbox Issue

I have a web form with a text box with an associated watermarktextbox extender and a button. The goal is to have the user input a name into the the textbox and then use that value when the button is clicked as parameter to a new web page. This works if i remove the watermarktextbox extender. Any assistance would be appreciated.


Do you want a watermark? What exactly do you want to do? Are you receiving errors?


Sorry for the vague original post. Yes, the goal is to have a watermarked textbox. The user enters data into the textbox and I want to use that data as a parameter to a redirection to a new webpage. The problem is that when I use the watermarked textbox the textbox text is not captured (i.e., my parameter is empty). If I use a standard textbox, I'm able to retrieve the textbox text and use it as I intend. I receive no errors I just get an empty value. I'm guessing I need to change the way I get the value of the textbox (client-side script?) but I have no idea how to do this.

Thanks.


OK. Post the script that your using.


Hi,

It's hard to tell without knowing how do you pass value? Are you using queryString? Or PostBackURL?

Please be more specific, a simple repro is preferred.

Watermark Extender Validation error

I have a textbox with an ajax watermark extender attached to it. As well as a required feild validator. One button on my page is "CauseValidation = true". Before i applyed the watermark extender the validation check worked perfectly, but now the validation check doesnt work as i think it see`s the watermarktext as text in the textbox, is there any way around this? si!

Hi blink18jew,

Would you mind posting your simple source code here?


sure its like this :

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TestBox" ErrorMessage="ERROR"></asp:RequiredFieldValidator>
<asp:TextBox ID="TestBox" runat="server"></asp:TextBox>
<ajaxToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" TargetControlID="TestBox" WatermarkText="Watermarked..." WatermarkCssClass="water" runat="server">
</ajaxToolkit:TextBoxWatermarkExtender>

the watermark seems to ruin the validation checks...si!


Hi blink18jew,

I'm afraid that I cannot reproduce your problem.Here is my test sampe based on yours. It works fine locally.

Aspx:

<%@. Page Language="VB" %><!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Water Mark</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TestBox" ErrorMessage="ERROR"></asp:RequiredFieldValidator> <asp:TextBox ID="TestBox" runat="server" CausesValidation="true"></asp:TextBox> <ajaxToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" TargetControlID="TestBox" WatermarkText="Watermarked..." WatermarkCssClass="water" runat="server"> </ajaxToolkit:TextBoxWatermarkExtender> <asp:Button ID="Button1" runat="server" Text="Button" /> </form></body></html>

So would you give us more details including source code or error information? If you can help us reproducing your problem step by step, it will be greatly appreciated.

By the way, did you use your Validator in a UpdatePanel? If yes, maybe you can benefit from this thread: http://forums.asp.net/t/1066821.aspx

Hope it helps.


no worries it was only to get it looking a bit more professional im just not guna use it, but thanks for your time! si!


Hi blink18jew,

Would you do a test with my sample code to find out the exact root cause for this problem ? If we can find the solution, our community members will benefit from our work then.Thanks, Surprise


Tongue Tied it worked... lol, i duno what was going on cos i tryed my olde code and that still didnt work... haha, oh well, ill mark it as answer! thanks.

watermark extender and javascript?

Hi, i have a textbox on the page. When the user clicks on a username in the list to the right i use this javascript to insert their username into the textbox.

function

setTextBoxText(text)
{
var textbox = window.document.getElementById("<%=touser.ClientID%>");
textbox.value ='';
textbox.value = text;
textbox.focus();
}

This works perfectly.

Then i tried to add a TextboxWatermarkExtender and now it does not work anymore, the initial text in the textbox (set by the watermark extender) gets erased, but the username does not show up, it just turns blank and focus is set on the textbox. Is there anyway to fix that?

Patrick

any idea?

I tested this out yesterday and found out that when you use WaterMarked on your textbox, all of the changes to the textbox through javascript will be written to watermarked's layer.

e.g. you have a textbox with onchange or onfocus command to call a javascript function; and the textbox also has a watermarked "Enter Name Here"

Your JavaScript function will insert the user's name into the textbox.

document.getElementById('" & Me.textbox1.ClientID & "').value = 'John Smith';

Problem: What happen is, "Enter Name Here" will be replaced with "John Smith", and the textbox is still empty.


Question, is this a bug or is it as design?

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 disappears after partial postback on another update panel

I have two update panels on page. One of them has an watermark toolkit control which just displays a piece of text in a textbox.

When the page loads the watermark is visible. But if there is a partial postback on the other updatepanel then the watermark disappears.

I am on beta 2 of ajax, and the most recent version of the toolkit.

Is this a known issue, a bug, or are there workarounds?

This scenario should work (and does in at least some circumstances) - please reply with acomplete, self-contained sample page that demonstrates the problem so that we can investigate the specific behavior you're seeing. Thank you!

Watermark issue

Hi all,

I just installed Atlas and tried to make a text box with watermark. I select new Atlas website, add a textbox and a TextBoxWatermarkExtender. When I go to properties of the textbox and click the + before TextBoxWatermarkExtender nothing happenes. The + disapears and I don't get the css and text option. I use Visual Studio 2005 and have no IIS installed. Someone has had this issue before?

Regards,

Stijn

Nobody had this before? This seems to be a bug...
The problem and its resolution are discussed in this thread:http://forums.asp.net/thread/1359451.aspx

WatermarkCssClass has no effect when the textmode set to multiline

If I set the textbox control to multiline mode the I get no css applied to the control using the WatermarkCssClass. It works fine for me in singleline mode. Anyone have any ideas on how I can get around this?

Thanks

After a little more research I noticed I'm actually not seeing any CSS applied to anything in the page that is defined in my themes. What's very odd is that FireFox and Opera show the page as I indended it to work, IE7 does not pick up any of the CSS in my theme CSS file. Is there a security setting of some type in IE7?


OK I'm an idiot. Any changes done to just the css file is not noticed evidently by the browser and it uses the web page in the cache instead of a fresh one. I clicked the refresh on the browser and it showed the changes. Wasted a whole day on this.Angry I don't understand why this would do this though, you would think that everytime you run a debug on the application it would start as a completely fresh and new browser as if you never been there before. Maybe its just my system or are others seeing this also? Let me know if you are.

Thanks


remove the gaps between the attributes u have used in the css files

Watermark text

I created a practice atlas website, put a textbox on the form, dragged the script manager and watermark control to the form. Went to the properties of the textbox and the watermark referance was there with a plus sign. Clicked on the + sign and nothing was there, I could not insert any text. What am I missing? Thank you.I got it working locally but receive this error on the remote server.

Unknown server tag 'atlas:ScriptManager'.
It seems like maybe the remote server's not seeing the Atlas DLL as registered? Maybe check that there's an @.Register for it or a corresponding entry for it in the web.config on that machine.

WatermarkExtender and Password-formatted textbox

Hi,

Is i possible to show the text from a WatermarkExtender in a password-formatted textbox?

Respectfully,

Christopher de Haas

Discussed in closedwork item 20.

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.

Wednesday, March 21, 2012

Web Parts menu/dragging disabled after partial update

I have a:

UpdatePanel. Inside it is a WebPartZone. Inside it is a web part.

It really simple. Button click and change the textbox to something. My problem is that as soon as I execute this the web part "verb" menu goes away and you can't drag and drop the web part after the first time it does the partial update. When you first load the page menu/dragging and dropping works fine.

Is this is a bug?

I have the same problem with asp.net ajax RC!!!!

It seems there is a big bug!!!!

It seems there is no tester in the asp.net ajax development team!!!Confused


To get around that problem can you on the postback set the webpartzone to enable again?