Hi!
This piece of code looks really bad. Basically I want to remove the option to press a button and instead show a message, if the value in the datasource is <> -1
This code looks bad, can someone find a better and nicer way to write it?
Code:Dim book As HiLibrary.BooksRow If (e.Row.DataItem IsNot Nothing) Then book = CType(CType(e.Row.DataItem, System.Data.DataRowView).Row, HiLibrary.BooksRow) ' Om boken är utlånad till denna användaren, då kan han inte låna den igen If (book.IS_LOANED <> -1) Then ' Dölj knappen CType(e.Row.FindControl("Button1"), Button).Visible = False Dim alert As New Literal alert.ID = "litAlert" alert.Text = "Book is already loaned" e.Row.Cells(5).Controls.Add(alert) End If End If
kind regards
Henrik




Reply With Quote