calling function on button click event

Posted by Rickeybglr under ASP.NET on 7/13/2011 | Points: 10 | Views : 7283 | Status : [Member] | Replies : 6
.cs page code(code behind)

public void funct_name (arg)
{
/////
}


protected void Button1_Click(object sender, EventArgs e)
{
// i want to call upper function on this button click ...
}

how can i call a user define function which is taking argument from another function on button click event




Responses

Posted by: Jpchoudhari on: 7/13/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

If that a function is normal C# function den just call it like

type arg;
funct_name (arg) ;

Thanks and Regards,
Jaydeep choudhari

Kind Regards,
Jay

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 7/13/2011 [Member] Starter | Points: 25

Up
0
Down
onclilentclick="return functionname"


Thanks&Regards
LakshmiNarayana Nalluri.

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Syedshakeer on: 7/13/2011 [Member] Starter | Points: 25

Up
0
Down
protected void Button1_Click(object sender, EventArgs e)
{
funct_name (arg) ;
}

Syed Shakeer Hussain

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naimishforu on: 7/13/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Guyz, just a quick question, I think "Handles" works with VB.NET right and not C#.NET??

Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RaviRanjanKr on: 7/13/2011 [Member] Starter | Points: 25

Up
0
Down
Yeah! Naimish you are right as I know Handles work only with VB.net

take a look small review of Handles Keyword in Comparison with C# and VB.Net

Currently in C# we have to setup the signature for the event handler and and then provide the function elsewhere. This is like C for god's sake. Where as in VB, you provide the description of what the function handles right in the function via the Handles keyword

Thanks
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naimishforu on: 7/13/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
So how do you setup the signature? I mean If I want to acheive that in VB.NET, I would say,

Add Handler Button_click, Handles My_Button_Clicked


Public My_Button_Clicked(something, something) Handles Button_click


How would one do that in C#??

Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response