473,566 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use a JavaScript in Silverlight Application to reset all the Controls

45 New Member
Hi All,
My application is in VS2010 coded in c#.Net,im using Silverlight for the first Time.I have a form where there are
combo boxes,textboxes ,rich TextBox,DTP.The data in all these controls are populated from database at the Loaded Event.
I hve a Cancel button on the same page.Now my requirement is that when the User click on Cancel all the controls should get reset and should be in the state as they were after the Loaded Event.
I want to do this using JavaScript.
I have the following code but im getting Error
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. formreset()
  3. {
  4. myform.reset(); 
  5. }
  6.  
The error im getting "The Type script was not found.Verify that you are not missing an assembly reference"
Im calling the Above code on Click of Cancel button.
Please guide me about how should i create Javascript for this and use in my Form.
Would be great if i gets the assistance by tomorow morning..
Aug 22 '11 #1
7 2456
Paul Johnson
97 New Member
Is this in the HTML? If it is, you could do with having a

Expand|Select|Wrap|Line Numbers
  1. </script>
at the end
Aug 22 '11 #2
SEhtesham
45 New Member
no its in XAML.
I want to include JavaScript in my XAML.Can i do this?
If yes please guide how.
Aug 22 '11 #3
Paul Johnson
97 New Member
This may help you

http://blogs.silverlight.net/blogs/m...lverlight.aspx

But from the looks of it, directly having JS in an XAML file is a no-no currently
Aug 22 '11 #4
SEhtesham
45 New Member
I have tried the Link mentioned above.
If u can please help out in how should i include a JavaScript or what is the process of Including JavaScript in my XAML.
Do i need to add any refernce or any header for this???
Aug 22 '11 #5
Paul Johnson
97 New Member
You can't directly put JS into XAML currently (from what I can see)
Aug 22 '11 #6
Plater
7,872 Recognized Expert Expert
If you are already in the server-side click function....why waste time with javascript, just clear it within your code.
Aug 24 '11 #7
SEhtesham
45 New Member
ya fine i got what you are saying.But Plater i also want to do validations and i want to do that on client side.I think JavaScript would be best option for that.So can u help me in Validations or if there is any other way i can better validate.
Aug 25 '11 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1978
by: psinyc | last post by:
this may be a simple thing ... I am trying to reset all the page controls to their original setting, in the first line of this method call (event). I want to dynamically change the days of month in a dropdownlist list depending on the users selected month in the month's dropdownlist ... i am using AutoPostBack on the dropdownlists ... can...
1
1299
by: Jim Heavey | last post by:
Hello, I was wondering how I would go about attaching some Java script code to a <asp:EditCommandColumn. If the user presses the "edit" link, then I want to test other controls to see if any information has been keyed into them. Is there a way to do that? How do I reference other controls in my JavaScript? Thanks in advance for your...
2
1151
by: Roh | last post by:
Hi, Can we use Javascript and .Net Validation controls on the same page. If yes how? Please provide some examples which will help me a lot....thanks.
1
2386
by: Chris | last post by:
Hi, I have a page with quite a few textboxes and dropdownlist controls. How can I clear the textboxes and reset the dropdownlist after the data is sent to the database? Do I have to perform textbox1.text = "" textbox2.text = "" .....
1
2147
by: CADD | last post by:
I've used http://www.bloglines.com to add RSS feeds to my sites there and setup javascript in my website to search bloglines for the input term. The code below works perfect, but I have 1 minor issue, hopefully someone more family with javascript can help me out with. 1) the variables do not reset, so any future searches return the same...
31
12182
imrosie
by: imrosie | last post by:
I have a form with a subform window. I have a command button on this form that clears only the controls on the form. However, if I enter data into the subform window, the cmd button won't clear it. Help please. Here's the code: Private Sub clrfrm_Click() Dim ctl As Control On Error Resume Next For Each ctl In...
3
3854
by: vpascuzzi | last post by:
Hi, I am currently working on a small Silverlight application, but cannot find out what is wrong in my HTML. <!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>
1
5183
LoanB
by: LoanB | last post by:
Hello team, I'm building a GIS Silverlight 4 application. I need to shut down the whole thing after a save event has taken place. So.. 1. User saves a new graphic to the SDE database, 2. Messagebox shows success or fail.. 3. User clicks OK 3. Application and browser shuts down..
0
1002
by: st mnmn | last post by:
I am in need of a "Transform" property on the "PerspectiveCamera" just like in the "System.Windows.Media.Media3D.Camera". Are there any plans to include this in silverlight?. If not, can anybody help with implementing this "Transform" property in my application?? Thanks
0
7666
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...
0
7584
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...
0
8108
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7644
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...
0
7951
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...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2083
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
1
1201
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.