Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 13th, 2005, 08:00 AM
Authorized User
 
Join Date: Feb 2004
Location: Rawalpindi, Punjab, Pakistan.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sajid_pk Send a message via Yahoo to sajid_pk
Default writing client-side script in code-behind asp .net

Hi,

Could anyone know how can we place client side script in Code-behind ASP .NET at our own place of choice in HTML page. Microsoft gave RegisterClientScriptBlock and RegisterStartupScript methods but they write code at start and end of form tags. How can we write client side script at our own choice of place in HTML form. (not at start or end of <form> tag). Is there any method of doing that.

Thanks.
 
Old January 13th, 2005, 08:11 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Chennai, Tamil Nadu, India.
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

yes you can achieve this task by placing

       <asp:literal runat="server" id="ltscript">
in your page.

in your code behind 1st find the literal and then write your script in the Text Property

   Literal ltScript = (Literal) Page.FindControl("ltScript");
   ltScript.Text = "alert('Hi Sajid!!!')";

Regards
Ganesh




Similar Threads
Thread Thread Starter Forum Replies Last Post
In ASP,Client side javaScript code casimir Classic ASP XML 0 October 24th, 2005 12:24 AM
How to add client-side script to an ASP button BrianWren VB.NET 1 March 30th, 2005 05:27 PM
Writing Client side script in code-behind asp.net sajid_pk ASP.NET 2.0 Basics 1 February 11th, 2005 04:22 AM
Writing Client Side Script from Code-Behind code sajid_pk Classic ASP Databases 1 January 18th, 2005 12:53 AM
Writing client side script in code-behind asp.net sajid_pk ADO.NET 1 January 13th, 2005 08:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.