Posts

Showing posts with the label CommandArgument

ASP.net Passing Parameters in Button Click EventHandler

The Parameters can be passed by ASP.Net buttons by using CommandName and CommandArgument. Below is the code that demonstrates that how to pass Arguments using Asp.Net button in its event Handler. Just Specify CommandName and CommandArgument in the button and set the OnClick Event to your specified function. public void ButtonEventHandler( Object sender, EventArgs e) { //Cast sender to Button Button oButton = ( Button )sender; //Check for the appropriate arguments switch (oButton.CommandName) { case "SelectData": //Below would be your Logic to SelectData SelectData(oButton.CommandArgument.ToString()); break ; case "SaveData": //Below would be your Logic to SaveData SaveData(oButton.CommandArgument.ToString()); break ; case "DeleteData...