I have a gridview with columns Action, Sigin Date and Signout date. The "Action Column" is a button field column. For every cell in the Signout date column, i want the button in the same row with the signout date to be enabled. If there is signout date, i want the button to be disabled. How do i do this?
Asked
Active
Viewed 224 times
1 Answers
1
Example code before i have used in My project
<asp:Button CommandName="del" ID="btnDisable" runat="server" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>'
CssClass="btn btn-danger btn-xs disable" />
if (e.Row.RowType == DataControlRowType.DataRow)
{
// HIGHTLIGHT ACTIVE/INACTIVE USERS
Label lblStatus = (Label)e.Row.FindControl("lblStatus");
Button del = (Button)e.Row.FindControl("btnDisable");
if (lblStatus.Text == "False")
{
lblStatus.CssClass = "label label-success disabled";
lblStatus.Text = "Active";
del.Text = "Disable";
}
else
{
lblStatus.CssClass = "label label-danger disabled";
lblStatus.ToolTip = "User is inactive.";
lblStatus.Text = "Inactive";
del.Text = "Enable";
}

Aamir
- 269
- 4
- 21