473,666 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UserControl with Javascript disappears after ENTER

I have a UserControl that builds a Tree-View Menu using Javascript. This UC does not run as a ServerControl
Then, in every aspx page I include this UC. Everything works perfect, except that if I press ENTER on a aspx, the "Menu" (means, the UserControl) disappears. Of course I can prevent pressing Enter - but the same problem still happens when I try to initialize all Textboxes using this code
private void ClearTextBoxes( Control parent)

foreach (Control c in parent.Controls )

TextBox tb = c as TextBox
if (tb != null)
tb.Text=""
if (c.HasControls( )
ClearTextBoxes( c)

I should be able to make UC loaded (and the Javascript that it contains runing) again. Is there a way to do this ?
Nov 18 '05 #1
2 1446
Hi,

Thanks for posting in the community!
From your description, you have a custom UserControl( a javascript based
treeview menu). You include it in many ASP.NET web pages. However, you
found that when you press "enter" key, the menu will disappear, yes?

As for this problem, I'd like to confirm some further things on it:
1. Is the UserControl you mean the "ASCX" usercontrol?

2. If is a ascx usercontrol. How do you add it into page. Add it statically
in the page's source template or use Page.LoadContro l to dynamically add it?

3. Does the problem occur on other UserControls? Or is it possible that you
generate a simple page to repro this problem? If so, we can try repro on my
side and do some further research on the issue.

Please check out the above things. If you feel anything unclear or have any
new findings, please feel free to post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #2
Steven
1) yes, it is a ascx user contro
2) I loaded it statically, means "dragging" the control into my aspx page during desig
3) I don't use other ascx controls at the moment (it is still a very small app)
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
5838
by: Kate | last post by:
Hi: I have a form with a picture box and some command buttons to make certain shapes appear in the picture box. The shapes are drawn on blank UserControls added like this: 'at top of form module Dim WithEvents tc As testControl 'button1_click (for example)
0
1184
by: chris | last post by:
Hi there I want to create a UserControl which simply uses a textbox and a calendar. The calendar's visibility is set to false. If I click the ImageButton the Calendar is visible. When you select a date, the date is written into the textbox. But when I just want to change the Month the calendar disappears. (When you reopen the calendar is a month further) How can I avoid this?
1
314
by: al | last post by:
Greetings, I included a UserControl (UC)on webpage. It works fine except when I change document direction to 'rtl', UC doesn't resize with the rest of document. It just disappears behinde rest of document(textbox, labesl...etc)? Any idea/s?? Usually, what is the best way of placing UC in a webpage? In a
2
2243
by: Eric Maia | last post by:
I have two UserControls I am using in a form. These are each also used separately in two other forms. The structure is essentially this: CourseUserControl.ascx - select or enter a course SessionUserControl.ascx - select or enter a course session CourseDetails.aspx - a form which contains just CourseUserControl CourseSessionDetails.aspx - a form which contains just SessionUserControl TrainingRequestDetails.aspx - a form which includes...
1
1481
by: DonR | last post by:
History: In VB6 I could create an OCX that had the ability to accept paramenters from a web page <object> tag, do some work, then fire an event back to VBScript or JavaScript on the web page where addition work may have been done. This web page usercontol interaction was easy in VB6. Using VB.Net I have been able to create the usercontrol for the web page and have also been able to pass parameters in via the <object> tag. I have not...
2
5371
by: Simon Verona | last post by:
I have a usercontrol with code in the "leave" event which updates the final data back into a database. This works fine except if I have a default "accept" button on a form and invoke it by pressing the ENTER key on the keyboard. In this case, it would appear that whilst the code on the button is executing and therefore presumably the button actually has focus, the leave event in the user control is not fired. Should I be interfacing...
0
2089
by: oliver | last post by:
QUESTION: How to access an object embedded in a UserControl through Javascript file? Another way to ask this question: How to execute script from a UserControl, accessing other objects in that UserControl? (Script attached to, and executed by, a UserControl embedded server control can ‘see’ the UserControl through the root document architecture. How to get the script to execute and ‘see’ other server controls in the...
1
4857
by: James | last post by:
CWinFormsDialog in .net 2.0 lets you host a .Net UserControl as a dialog in a managed C++ MDI application. I.e. in the sample: ----------------------------------------------- #include <afxwinforms.h> #using <WinFormUserControl1.dll> using namespace WinFormUserControl1;
5
3681
by: tshad | last post by:
I get an error when running my Javascript inside my UserControl. It works fine if I put the UserControl Data directly in my Web Page. The stripped down code is: <script language=javascript> function CheckQuestion() { var checkBox = document.getElementById('SecurityStandard'); alert("checkBox.checked = " + checkBox.checked);
0
8443
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.