Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 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 August 31st, 2004, 01:52 AM
Registered User
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to register a server c# script with c#?

I want to let a button execute a event,but event content is dynamic.
My code is:
////////////////////////////////////////////////////////////////////
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
string script="<script language=\"C#\" runat=\"server\">";
script+="void ClickHandler(object sender, System.EventArgs e)"; script+="{\n";
script+=" Response.Write(\"ok\");";
script+="}</script>";
this.RegisterStartupScript("myevent",script);

this.Button1.Attributes.Add("OnClick","ClickHandle r");
}
//////////////////////////////////////////////////////////////
But when I click button1 then error:ClickHandler undefined!
How to get it? Could you help me? Please write a C# code to achieve this purpose.
My email is shenliujun79@hotmail.com.
Thanks!


 
Old September 8th, 2004, 08:00 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

Registering C# server script with c# cannot be done.
RegisterStartupScript is used to register client side scripts.






Similar Threads
Thread Thread Starter Forum Replies Last Post
how to register servlets with Tomcat 5.59 server urstruly90 Apache Tomcat 0 July 21st, 2005 03:50 AM
How to register a server_side script with C#? shenliujun C# 3 August 31st, 2004 07:28 PM
Script Injection in Sql Server farhan_iac Classic ASP Professional 6 August 20th, 2004 03:41 AM
register JDBC for sql server macarong J2EE 1 July 26th, 2003 04:24 AM





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