aspnet-js-aspxclientgridview-dot-performcallback-x28-args-x29.md
Sends a callback to the server and generates the server-side event, passing the specified argument to it.
PerformCallback(
args: string,
onSuccess?: (arg: string) => void
): void
| Name | Type | Description |
|---|---|---|
| args | string |
A string value that represents any information that needs to be sent to the server-side event.
| | onSuccess | (arg: string) => void |
A client action to perform if the server round-trip completed successfully.
|
Use the PerformCallback method if you need to asynchronously go to the server and perform server-side processing using AJAX-based callback technology. You can pass the required information which can be collected on the client side as a string of arguments using the PerformCallback method args parameter. The onSuccess parameter allows you to specify a client function that should be executed after the server round-trip completed successfully.
The following example illustrates how to use two grid views to display master-detail data.
<dx:ASPxGridView ID="masterGrid" runat="server" ...>
<SettingsBehavior AllowFocusedRow="True" />
<Columns>
<dx:GridViewDataTextColumn FieldName="CategoryID" ReadOnly="True" VisibleIndex="0">
<EditFormSettings Visible="False" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="CategoryName" VisibleIndex="1">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Description" VisibleIndex="2">
</dx:GridViewDataTextColumn>
</Columns>
<ClientSideEvents FocusedRowChanged="function(s, e) {
dGrid.PerformCallback(s.GetFocusedRowIndex());
}" />
</dx:ASPxGridView>
<dx:ASPxGridView ID="detailGrid" runat="server" ClientInstanceName="dGrid" OnCustomCallback="detailGrid_CustomCallback" ...>
<Columns>
<dx:GridViewDataTextColumn FieldName="ProductID" ReadOnly="True" Visible="False"
VisibleIndex="0">
<EditFormSettings Visible="False" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="0">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="UnitPrice" VisibleIndex="1">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="UnitsInStock" VisibleIndex="2">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="QuantityPerUnit" VisibleIndex="3">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="CategoryID" Visible="False" VisibleIndex="5">
</dx:GridViewDataTextColumn>
</Columns>
</dx:ASPxGridView>
protected void Page_Load(object sender, EventArgs e) {
if (Session["CategoryID"] != null) {
detailGrid.DataSource = dsProducts;
detailGrid.DataBind();
}
}
protected void detailGrid_CustomCallback(object sender,
DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e) {
object masterKeyValue = masterGrid.GetRowValues(Convert.ToInt32(e.Parameters), "CategoryID");
Session["CategoryID"] = masterKeyValue;
detailGrid.DataSource = dsProducts;
detailGrid.PageIndex = 0;
detailGrid.DataBind();
}
See Also