Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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, 04:42 AM
Registered User
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to register a server_side script with C#?

How to register a server_side script with C#?
I know to register a client_side script use Page.RegisterStartupScript method. But how to register a server_side C# script?I don't know ,can you help me? My email is shenliujun79@hotmail.com.
I want to make a ASP Button execute a onclik event,normally to do two step:
step 1 this.Button1.Click += new System.EventHandler(this.Button2_Click);
step 2 private void Button2_Click(object sender, System.EventArgs e)
        {
                      //Code behinde here;
                      //I want here code is dynamic.
        }
But I don't want to do that.I want to make a button to execute dynamic event script in server side.How to do it?
Help me!!!!!!!!!
My email is shenliujun79@hotmail.com
Thanks!


 
Old August 31st, 2004, 11:18 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

I dont know if its possible or not but certainly there are other better ways so that you could implement it better ....
i.e you could work with CommandName of the button,everytime you need a new script
you can change the CommandName of the button and fire Button_Command,then this event execute the suitable script(through switch/case)according to the CommandName of the button
(work with Button_Command instead of Button_Click)
Code:
private void Button_Command(object sender,CommandEventArgs e)
{
       switch(e.CommandName)
       {
        case "script1":
            //...
            break;
        case "script2":
            //...
            break;
        default:
            //..
            break;
    }
}
HtH.

--------------------------------------------
Mehdi.:)
 
Old August 31st, 2004, 04:19 PM
Authorized User
 
Join Date: Jul 2004
Posts: 69
Thanks: 0
Thanked 1 Time in 1 Post
Default

The Microsoft Scripting control may help you out if you are trying to allow users to enter there own code that you execute. How you display that infomation back to the user may be tricky however.

www.CoderForRent.com
Get A Computer Job!
 
Old August 31st, 2004, 07:28 PM
Registered User
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks!
Reply delay.
I want to let the button execute srever_side onclick event.And the event detail save in a database,the detail is dynamic.It perhaps is "Response.Write("ok");" or "this.button1.Text="Hello";",etc.How to do it?
Notice serve_rside onclick event.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Cash Register arcadium Java GUI 0 August 2nd, 2008 10:24 PM
Help with register.asp tagaroe Classic ASP Databases 29 March 12th, 2007 06:50 AM
How to register a server c# script with c#? shenliujun VS.NET 2002/2003 1 September 8th, 2004 08:00 AM
Call and run CGI script from a PHP script ... how? dbruins BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 June 10th, 2003 03:09 PM





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