WebGrid.GetContainerUpdateScript Method

Returns a JavaScript statement that can be used to update the HTML element that is associated with the WebGrid instance on the specified web page.

Namespace:  System.Web.Helpers
Assembly:  System.Web.Helpers (in System.Web.Helpers.dll)

Syntax

'Declaration
Public Function GetContainerUpdateScript ( _
    path As String _
) As IHtmlString
'Usage
Dim instance As WebGrid 
Dim path As String 
Dim returnValue As IHtmlString 

returnValue = instance.GetContainerUpdateScript(path)
public IHtmlString GetContainerUpdateScript(
    string path
)
public:
IHtmlString^ GetContainerUpdateScript(
    String^ path
)
member GetContainerUpdateScript : 
        path:string -> IHtmlString
public function GetContainerUpdateScript(
    path : String
) : IHtmlString

Parameters

  • path
    Type: System.String
    The URL of the web page that contains the WebGrid instance that is being updated. The URL can include query-string arguments.

Return Value

Type: System.Web.IHtmlString
A JavaScript statement that can be used to update the HTML element in a web page that is associated with the WebGrid instance.

Remarks

This method can be used to update the grid on the web page in the browser. For example, if the grid displays books or movies, and the user selects an option to change from books to movies, you can update the grid to reflect the user's choice.

Important

When you call the GetContainerUpdateScript method, make sure that the AjaxUpdateContainerId property has been assigned a non-empty string value. If the AjaxUpdateContainerId property is null reference (Nothing in Visual Basic) or empty, the returned JavaScript statement is not valid. The value of the AjaxUpdateContainerId property is set using the WebGrid(IEnumerable<Object>, IEnumerable<String>, String, Int32, Boolean, Boolean, String, String, String, String, String, String, String) constructor.

The HTML element that is associated with the WebGrid instance is specified by setting the HTML id attribute of the element to the value of the AjaxUpdateContainerId property. The specified element can be any HTML element that contains the HTML markup that represents the WebGrid instance on the web page.

If the value of the AjaxUpdateCallback property is not null reference (Nothing in Visual Basic) or empty, the JavaScript function specified by the value of the property is called after the associated HTML element has been updated. If the value is null reference (Nothing in Visual Basic) or empty, no function is called.

See Also

Reference

WebGrid Class

System.Web.Helpers Namespace