Hello,
I am trying to dynamically hide a button that is contained in a nested view contained in each row on a telerik grid.
The grid represents a series of transactions, each with a transaction date. Upon expanding a row on the grid the button should be hidden for that particular row if the transaction date for that row is older than today. If the transaction date for that record is = today, then the button should appear,
I have tried the ItemCommand method, checking for ExpandCollapse event
This gets me the event that is firing for row expand. At this point, however, my data is not bound to the nested view for that row on the grid so I can't involve logic to hide based on a date for this particular row.
I will note that I am setting a series of labels on the nested view for the row - and the transaction date is one of the values. I tried accessing that label's text for my date logic but it is not set at the time of the "Expand" in itemCommand. If I expand, collapse, and expand again the data is there - so there is a timing issue with my data in using itemCommand.
In general which event is preferred to access controls in a Nested View and what methods could I employ to get at the data associated with the nested view? Would a client side approach be easier?
Nested view settings:
<NestedViewSettings DataSourceID="SqlDataSourceInnerTable">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="TRAN_ID" MasterKeyField="TRAN_ID" />
</ParentTableRelation>
</NestedViewSettings>
Datasource:
<asp:SqlDataSource ID="SqlDataSourceInnerTable"
ConnectionString="<%$ ConnectionStrings:LAWConnectionString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM TRANS_HIST AS TH INNER JOIN
TRANS_TYPE AS TT ON TH.TRANS_TYPE_ID = TT.TRANS_TYPE_ID INNER JOIN
TRANS_STATUS ON TH.STATUS_ID = TRANS_STATUS.STATUS_ID LEFT OUTER JOIN
TRANS_SUBTYPE ON TH.TRANS_SUBTYPE_ID = TRANS_SUBTYPE.TRANS_SUBTYPE_ID
WHERE (TH.TRAN_ID = @TRAN_ID)"
runat="server">
<SelectParameters>
I am trying to dynamically hide a button that is contained in a nested view contained in each row on a telerik grid.
The grid represents a series of transactions, each with a transaction date. Upon expanding a row on the grid the button should be hidden for that particular row if the transaction date for that row is older than today. If the transaction date for that record is = today, then the button should appear,
I have tried the ItemCommand method, checking for ExpandCollapse event
if (e.CommandName == RadGrid.ExpandCollapseCommandName && !e.Item.Expanded)This gets me the event that is firing for row expand. At this point, however, my data is not bound to the nested view for that row on the grid so I can't involve logic to hide based on a date for this particular row.
I will note that I am setting a series of labels on the nested view for the row - and the transaction date is one of the values. I tried accessing that label's text for my date logic but it is not set at the time of the "Expand" in itemCommand. If I expand, collapse, and expand again the data is there - so there is a timing issue with my data in using itemCommand.
In general which event is preferred to access controls in a Nested View and what methods could I employ to get at the data associated with the nested view? Would a client side approach be easier?
Nested view settings:
<NestedViewSettings DataSourceID="SqlDataSourceInnerTable">
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField="TRAN_ID" MasterKeyField="TRAN_ID" />
</ParentTableRelation>
</NestedViewSettings>
Datasource:
<asp:SqlDataSource ID="SqlDataSourceInnerTable"
ConnectionString="<%$ ConnectionStrings:LAWConnectionString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM TRANS_HIST AS TH INNER JOIN
TRANS_TYPE AS TT ON TH.TRANS_TYPE_ID = TT.TRANS_TYPE_ID INNER JOIN
TRANS_STATUS ON TH.STATUS_ID = TRANS_STATUS.STATUS_ID LEFT OUTER JOIN
TRANS_SUBTYPE ON TH.TRANS_SUBTYPE_ID = TRANS_SUBTYPE.TRANS_SUBTYPE_ID
WHERE (TH.TRAN_ID = @TRAN_ID)"
runat="server">
<SelectParameters>