private void Button_Click(object sender, CommandEventArgs e) { string argumentValue = e.GetString("ArgumentName"); // Do something with argumentValue }
private void MenuItem_Click(object sender, CommandEventArgs e) { string fileName = e.GetString("FileName"); using (FileStream fileStream = new FileStream(fileName, FileMode.Open)) { // Read data from the file } }In this example, we use the GetString method to retrieve a file name that has been associated with a command argument. We then use this file name to create a FileStream object and read data from the file. The package library that CommandEventArgs belongs to is the System.Web.UI.WebControls namespace in the .NET Framework.