37 registered members About Us| Contact Us | Site Map 
Programming          
      E-mail :     Password :                 Lost your password?
Untitled Document

 


 
   Add Client functionlity from serverside Date Posted  : December 29th, 2009
  Date Edited   : December 29th, 2009
   
   Add Client functionlity from serverside
   Author: baranee dharan
   

Bookmark and Share print the article email the article
   

Hi friends,

Here I would like to explain a simple technique in asp.net. You can add javascript functionality from serverside to serverside controls. For that, you would require a new web application and choose C# or VB as your code behind.

Add a button control in the newly created appliation. In the form load event add the following code snippet,

        Dim str As New StringBuilder


        str.Append("alert('hi');")       
        str.Append("alert(document.getElementById('Button1').value);")
        str.Append("document.getElementById('Button1').value='this is a good change happening for a good thing';")


        Button1.Attributes.Add("onClick", str.ToString())

 

In the above code, we have used StringBuilder to append javascript functionality as string and added the functionality using the method

[Control].Attributes.Add("key","value")

Control1.Attributes.Add("onClick", str.ToString()) . Now If you test the application you will be getting the javascript functionality "onClick" event. Hope it helps.

 
 
Bookmark and Share print the article email the article
 

 
Add Client functionlity from serverside
No Comments
Post Comments
 
No Rating
Post Rating
 
Related Articles
     Basic C# Types
     Arrays in C#
     Forms Authentication
 
 
 
Tech Resources:Home| Post Articles| Tech News
The Programming Gallery:
About Us | Contact Us | Site Map
Copyright © 2008 programminggallery.com All Rights Reserved Programminggallery.
Republication or redissemination of the contents of this screen are expressly prohibited without the written consent of Programminggallery