0
Reply

How to disable button in a listView

Omar

Omar

11 years ago
1.6k
I have a list view that displays all the classes  a student is in.  The second column is the class ID in which I have a tool tip that displays the class end date.  Here is the function for the toolTip...

public string GetClassEndDate(object eval)
{
        string retVal = ""
        if(Convert.IsDBNull(eval)) return retval;
        int classID = Convert.ToInt32(eval);

        Datatable data = GetData("SELECT classID, EndDate FROM classes where classId = " + classID);
        List<DataRow> list = data.AsEnumerable().ToList();
        var result = list.Where(row=> row["ClassID"].Equals(classID));
        foreach ( var datarow in result){
                retVal = dataRow["EndDate"].ToString();
                }
        return Convert.ToDateTime(retVal).ToShortDateTime();
}




How can I call the result (end date value) of this function to use in another function where I disable the EDIT button if the class end date is 3 days previous from today.  In other words, if it has been 3 days since the class end date, I need to disable that EDIT button for that row in the listview.  I am stuck, any help please! Thanks.