Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Onclick="" with with arguments


Message #1 by rashan@d... on Wed, 24 Oct 2001 11:43:53
You might make dbutil into a "user control" and
add to it properties for the parameters you want
to pass and arrange to have the properties set 
by code in default.aspx.cs before the user gets 
a chance to click the button.

Lou

-----Original Message-----
From: rashan@d... [mailto:rashan@d...] 
Sent: Wednesday, October 24, 2001 11:44 AM
To: ASPX_Professional
Subject: [aspx_professional] Onclick="" with with arguments


My application written in C# , code-behind and have 2 files
, no code in ASPX file.

default.aspx , dbutil.cs

First in DEFAULT.ASPX contain 
<asp:button Onclick="ABCDEF" ...> 

and DBUTIL.CS contain
Public void ABCDEF( Object sender, EventArgs e ) { ... }

this application run without problem , bu the problem is

I want to send arguments when my button is clicked , not just call. I
want to make it to re-usable code. Is it possible ??????

ABCDEF(...) is function of database connection and call stored-procedure
So I want to do like this

Onclick="ABCDEF( stored_proc_name, arg1, arg2, arg3, arg4)"

so ABCDEF() can use those arguments to call stored-procedure and

I try to cheat by using hidden server control in page and store those 
argument in simple text, then use ABCDEF( ) to read it from ASPX file.
It also work but I think it should have a better way. Thanks

  Return to Index