locked
Javascript in .cs file RRS feed

  • Question

  • i dont have aspx page in my project.

    In feature receiver.cs file i need to implement javascript in which i have to hide columns on selection of a redio button.

    please guide me how to implement the same.

    And generally how to write javascript in a .cs file ( i want the format)

     

    Thanks ,

    Deepika

    Monday, June 28, 2010 2:56 PM

Answers

  • Event Receiver .CS file is an assembly only which you use to write server side code. You can not generate some thing from server side to render at client to perform client operations etc. You need to understand the concepts of event handler in SharePoint that they are suppose to work only background works etc. I am sure you are aware of it but just writing to make sure this point does not get confused. In ASPX pages you can always send javascript from server side using LITERAL controls.

    If your situation is relevant to EditForm.aspx or NewForm.aspx pages that are used in Adding/modifying a list item etc, YOu can open such pages in sharepoint designer and write the javascript in them.


    Moonis Tahir MVP, MCPD, MCSD.net, MCTS BizTalk 2006/SQL 2005/SharePoint Server 2007 (Dev & Config)
    Monday, June 28, 2010 5:30 PM
  • Deepika,

    Following link will give u detailed examples for wht u need.

    http://www.codeproject.com/KB/aspnet/ClientServer.aspx


    Thanks & Regards
    Rakesh Narayan Lal
    Tuesday, June 29, 2010 6:19 PM

All replies

  • Event Receiver .CS file is an assembly only which you use to write server side code. You can not generate some thing from server side to render at client to perform client operations etc. You need to understand the concepts of event handler in SharePoint that they are suppose to work only background works etc. I am sure you are aware of it but just writing to make sure this point does not get confused. In ASPX pages you can always send javascript from server side using LITERAL controls.

    If your situation is relevant to EditForm.aspx or NewForm.aspx pages that are used in Adding/modifying a list item etc, YOu can open such pages in sharepoint designer and write the javascript in them.


    Moonis Tahir MVP, MCPD, MCSD.net, MCTS BizTalk 2006/SQL 2005/SharePoint Server 2007 (Dev & Config)
    Monday, June 28, 2010 5:30 PM
  • Thanks Moonis.

    Could you let me know how do i write javascript in .CS file then.

    What is the procedure need to be followed..

    Tuesday, June 29, 2010 4:07 AM
  • take a look at the ClientScriptManager.  To utilize the ClientScriptManager, you do need to have a reference to a System.Web.UI.Page variable.
    Tuesday, June 29, 2010 11:22 AM
  • Deepika,

    Following link will give u detailed examples for wht u need.

    http://www.codeproject.com/KB/aspnet/ClientServer.aspx


    Thanks & Regards
    Rakesh Narayan Lal
    Tuesday, June 29, 2010 6:19 PM