Just looking for someone to confirm that what I have is correct or not.
I have an asp:label field for and expire date that should either display "Never" if the database field ([msDS-UserDontExpirePassword] this is a bit - true/false - field) is True, or otherwise display a date (pwdExpireDate).
My code doesn't throw any errors but I can' fully test it without putting it into production. Can someone tell me if this is correct? Also, there is no code-behind and I can't use code behind for this.
Here's the code:
The label: <asp:Label ID="lbUserPWExpireDate" Text='<%# ((bool)(Eval("[msDS-UserDontExpirePassword]"))==true ? "Never" : Eval("pwdExpireDate", "{0:M/dd/yyyy}")) %>' Runat="Server"/>
The query: <asp:SqlDataSource ID="GetUserExpireDate" runat="server"
ConnectionString="<%$ ConnectionStrings:USER_PREFERENCESConnectionString %>"
SelectCommand="SELECT DATEADD(day, 59, pwdLastSetDateGMT) AS pwdExpireDate, [msDS-UserDontExpirePassword]
FROM LDAP_Users
WHERE mail = @USER_EMAIL_ADDRESS" OnSelecting="GetUserExpireDate_Selecting">
<SelectParameters>
<asp:SessionParameter Name="USER_EMAIL_ADDRESS" SessionField="USER_EMAIL_ADDRESS" />
</SelectParameters>
</asp:SqlDataSource>
Thanks for any help!
I have an asp:label field for and expire date that should either display "Never" if the database field ([msDS-UserDontExpirePassword] this is a bit - true/false - field) is True, or otherwise display a date (pwdExpireDate).
My code doesn't throw any errors but I can' fully test it without putting it into production. Can someone tell me if this is correct? Also, there is no code-behind and I can't use code behind for this.
Here's the code:
The label: <asp:Label ID="lbUserPWExpireDate" Text='<%# ((bool)(Eval("[msDS-UserDontExpirePassword]"))==true ? "Never" : Eval("pwdExpireDate", "{0:M/dd/yyyy}")) %>' Runat="Server"/>
The query: <asp:SqlDataSource ID="GetUserExpireDate" runat="server"
ConnectionString="<%$ ConnectionStrings:USER_PREFERENCESConnectionString %>"
SelectCommand="SELECT DATEADD(day, 59, pwdLastSetDateGMT) AS pwdExpireDate, [msDS-UserDontExpirePassword]
FROM LDAP_Users
WHERE mail = @USER_EMAIL_ADDRESS" OnSelecting="GetUserExpireDate_Selecting">
<SelectParameters>
<asp:SessionParameter Name="USER_EMAIL_ADDRESS" SessionField="USER_EMAIL_ADDRESS" />
</SelectParameters>
</asp:SqlDataSource>
Thanks for any help!