I am attempting to hide a button in a radgrid template column based on a value selected from a sql query. Here is what I am attempting to accomplish.
I have two grids on a page (rgd_Authorizers) and (rgd_Approvals)
The rgd_Authorizers is a list of managers, each of whom must approve the page's information by clicking btn_approve contained in a template column. When they click btn_approve, I add a record to the approval table.
This record is then displayed in rgd_Approvals showing that that manager has approved the page.
The goal is to have the btn_approve to no longer be visible next to that manager's name in rgd_Authorizers so that they cannot re-approve the page.
Here is what I have attempted so far. I get no errors, however, the button is still visible. Any help much appreciated.
I have two grids on a page (rgd_Authorizers) and (rgd_Approvals)
The rgd_Authorizers is a list of managers, each of whom must approve the page's information by clicking btn_approve contained in a template column. When they click btn_approve, I add a record to the approval table.
This record is then displayed in rgd_Approvals showing that that manager has approved the page.
The goal is to have the btn_approve to no longer be visible next to that manager's name in rgd_Authorizers so that they cannot re-approve the page.
Protected Sub rgd_Authorizers_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgd_Authorizers.ItemCreated Dim IDPurchaseRequisition = Request.QueryString("IDPurchaseRequisition") Dim connectionString As String = DirectCast(ConfigurationManager.ConnectionStrings("Purchasing_PRS_ConnectionString").ConnectionString, String) Dim conn As New SqlConnection(connectionString) Dim comm As New SqlCommand("SELECT * FROM [PRS_PurchaseRequisitionsApprovals] WHERE IDPurchaseRequisition = @IDPurchaseRequisition", conn) comm.Connection.Open() comm.Parameters.Add("@IDPurchaseRequisition", SqlDbType.Int).Value = IDPurchaseRequisition Dim myDataAdapter As New SqlDataAdapter(comm) Dim myDataSet As New DataSet Dim dtData As New DataTable Dim dtRow As DataRow myDataAdapter.Fill(myDataSet) conn.Close() For Each dtRow In myDataSet.Tables(0).Rows Dim IDAuthorizer = dtRow.Item("IDAuthorizer") If TypeOf e.Item Is GridDataItem Then Dim item As GridDataItem = TryCast(e.Item, GridDataItem) Dim value1 As String = item("IDAuthorizer").Text If value1 = IDAuthorizer Then Dim btn_Approve As Button = DirectCast(item("TemplateColumn").Controls(0), Button) btn_Approve.Visible = False End If End If NextEnd SubHere is what I have attempted so far. I get no errors, however, the button is still visible. Any help much appreciated.