This documentation is archived and is not being maintained.

RepeaterCommandEventArgs.CommandSource Property

Gets the source of the command.

[Visual Basic]
Public ReadOnly Property CommandSource As Object
[C#]
public object CommandSource {get;}
[C++]
public: __property Object* get_CommandSource();
[JScript]
public function get CommandSource() : Object;

Property Value

The command source.

Remarks

Use this property to determine the source of the command.

Example

[Visual Basic, C#, C++] The following example demonstrates how to determine the command source from the CommandSource property.

[Visual Basic] 
Sub R1_ItemCommand(Sender As Object, e As RepeaterCommandEventArgs)
    Label2.Text = "The " & CType(e.CommandSource, Button).Text & _
       " button has just been clicked; <br>"
End Sub


[C#] 
void R1_ItemCommand(Object Sender, RepeaterCommandEventArgs e) {        
    Label2.Text = "The " + ((Button)e.CommandSource).Text + " button has just been clicked; <br>";
 }
    

[C++] 
void R1_ItemCommand(Object* /*Sender*/, RepeaterCommandEventArgs* e) {
    Label2->Text = String::Format( S"The {0} button has just been clicked; <br>", (dynamic_cast<Button*>(e->CommandSource))->Text );
 }
    

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

RepeaterCommandEventArgs Class | RepeaterCommandEventArgs Members | System.Web.UI.WebControls Namespace

Show: