Framework / Presentation Layer / Graphics / Interactivity Style / Postback

In This Topic
    Postback
    In This Topic

    Every object that has an interactivity style can generate postback when clicked. This allows you to create highly interactive web applications. To intercept the object click event in Web Forms you have to subscribe for the Click event of the control containing the object. Consult the documentation of the specific control on how to properly handle postback events.

    To tell the object that it should generate a postback you add an instance of the NPostbackAttribute class to the InteractivityAttributes collection. For example:

    C#
    Copy Code
    NPostbackAttribute postbackAttribute = new NPostbackAttribute();
    someObject.InteractivityStyle.InteractivityAttributes.Add(postbackAttribute);
    
    Visual Basic
    Copy Code
    Dim postbackAttribute As New NPostbackAttribute()
    someObject.InteractivityStyle.InteractivityAttributes.Add(postbackAttribute)
    

    You may also use the GeneratePostback property of the NInteractivityStyle to do that:

    C#
    Copy Code
    someObject.InteractivityStyle.GeneratePostback = true;
    
    Visual Basic
    Copy Code
    someObject.InteractivityStyle.GeneratePostback = True
    
    See Also