I have the field user_is_active in a table - 1 = active, 0 = inactive.
I have a GridView set up and I want it to display text "active/inactive" instead of 1/0. Easy right?
It seems to be passing the variable name "user_is_active" instead of the value 1 or 0 so all records are showing "inactive" in the status column.
------------------------------------
my Template field:
<asp:Label ID="lbl_getstatus" runat="server" Text='<%# GetStatus("user_is_active")%>'></asp:Label>
---
my C# Codebehind
protected string GetStatus(string program_status)
{
if (program_status == "1")
{
return "active";
}
else
{
return "inactive";
}
}
------------------------------------
I know it's passing the variable name since I put:
return program_status + "inactive";
for the if/else and got "user_is_activeinactive" in the status column.
I tried variations of "Container.DataItem" which I saw in so many examples but got errors.
Can anyone see what I'm doing wrong here??
I have a GridView set up and I want it to display text "active/inactive" instead of 1/0. Easy right?
It seems to be passing the variable name "user_is_active" instead of the value 1 or 0 so all records are showing "inactive" in the status column.
------------------------------------
my Template field:
<asp:Label ID="lbl_getstatus" runat="server" Text='<%# GetStatus("user_is_active")%>'></asp:Label>
---
my C# Codebehind
protected string GetStatus(string program_status)
{
if (program_status == "1")
{
return "active";
}
else
{
return "inactive";
}
}
------------------------------------
I know it's passing the variable name since I put:
return program_status + "inactive";
for the if/else and got "user_is_activeinactive" in the status column.
I tried variations of "Container.DataItem" which I saw in so many examples but got errors.
Can anyone see what I'm doing wrong here??