aspnet-devexpress-dot-web-dot-aspxgridview-dot-findrowcelltemplatecontrolbykey-x28-system-dot-object-devexpress-dot-web-dot-gridviewdatacolumn-system-dot-string-x29.md
Searches for the server control contained within the specified data cell‘s template.
Namespace : DevExpress.Web
Assembly : DevExpress.Web.v25.2.dll
NuGet Package : DevExpress.Web
public Control FindRowCellTemplateControlByKey(
object rowKey,
GridViewDataColumn gridViewDataColumn,
string id
)
Public Function FindRowCellTemplateControlByKey(
rowKey As Object,
gridViewDataColumn As GridViewDataColumn,
id As String
) As Control
| Name | Type | Description |
|---|---|---|
| rowKey | Object |
An object that uniquely identifies the row.
| | gridViewDataColumn | GridViewDataColumn |
A GridViewDataColumn descendant that represents the data column where the requested cell resides. If null ( Nothing in Visual Basic), the search is performed within all cells in the specified row.
| | id | String |
A String value that identifies the control within the specified cell.
|
| Type | Description |
|---|---|
| Control |
A Control object that represents the control contained within the specified data cell’s template.
|
For more information, see Templates.
<dx:ASPxGridView ID="Grid" runat="server" OnHtmlRowPrepared="Grid_HtmlRowPrepared" ...>
<Columns>
<dx:GridViewDataTextColumn FieldName="Name">
<DataItemTemplate>
<dx:ASPxButtonEdit ID="ButtonEdit" runat="server">
<!-- ... -->
</dx:ASPxButtonEdit>
</DataItemTemplate>
</dx:GridViewDataTextColumn>
</Columns>
<!-- ... -->
</dx:ASPxGridView>
protected void Grid_HtmlRowPrepared(object sender, ASPxGridViewTableRowEventArgs e) {
ASPxButtonEdit buttonEdit = Grid.FindRowCellTemplateControlByKey(e.rowKey,
Grid.Columns["Name"] as GridViewDataColumn, "ButtonEdit") as ASPxButtonEdit;
// ...
}
Protected Sub Grid_HtmlRowPrepared(ByVal sender As Object, ByVal e As ASPxGridViewTableRowEventArgs)
Dim buttonEdit As ASPxButtonEdit = TryCast(Grid.FindRowCellTemplateControlByKey(e.rowKey, TryCast(Grid.Columns("Name"), GridViewDataColumn), "ButtonEdit"), ASPxButtonEdit)
' ...
End Sub
See Also