|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Show ***** only if have a passwordHi;
When displaying a record, I want to show ***** if they entered a password and nothing if they did not. Is there a way to do this in the aspx file or do I need to add a property to the data called ViewPassword? <asp:TextBox ID="txtPassword" runat="server"
TextMode="Password"></asp:TextBox> Hello;
This is for viewing a record, not for creating/editing it. So I don't want to use a textbox unless there is a way to mark a text box as read-only (is there?) Show quoteHide quote "agape***@gmail.com" wrote: > <asp:TextBox ID="txtPassword" runat="server" > TextMode="Password"></asp:TextBox> > > If you are databinding within a templated server control, try conditional
evaluation in the databinding expression, e.g. <asp:Label id="lblPassword" runat="Server" Text='<%#Eval("Password").ToString().Equals(String.Empty)?"":"******"%>'/> Show quoteHide quote "David Thielen" wrote: > Hello; > > This is for viewing a record, not for creating/editing it. So I don't want > to use a textbox unless there is a way to mark a text box as read-only (is > there?) > > -- > thanks - dave > david_at_windward_dot_net > http://www.windwardreports.com > > > > "agape***@gmail.com" wrote: > > > <asp:TextBox ID="txtPassword" runat="server" > > TextMode="Password"></asp:TextBox> > > > > That sounds perfect - thank you.
Follow on question, is there a reason to use a label? ie, is this: <asp:Label id="lblPassword" runat="Server" Text='<%#Eval("Password").ToString().Equals(String.Empty)?"":"******"%>'/> better than: <%#Eval("Password").ToString().Equals(String.Empty)?"":"******"%> Show quoteHide quote "Phillip Williams" wrote: > If you are databinding within a templated server control, try conditional > evaluation in the databinding expression, e.g. > <asp:Label id="lblPassword" runat="Server" > Text='<%#Eval("Password").ToString().Equals(String.Empty)?"":"******"%>'/> > -- > HTH, > Phillip Williams > http://www.societopia.net > http://www.webswapp.com > > > "David Thielen" wrote: > > > Hello; > > > > This is for viewing a record, not for creating/editing it. So I don't want > > to use a textbox unless there is a way to mark a text box as read-only (is > > there?) > > > > -- > > thanks - dave > > david_at_windward_dot_net > > http://www.windwardreports.com > > > > > > > > "agape***@gmail.com" wrote: > > > > > <asp:TextBox ID="txtPassword" runat="server" > > > TextMode="Password"></asp:TextBox> > > > > > > I would use the label to be able to style it using CSS or SkinIDs, but if you
do not need a separate style for this field then the second options would work just as fine. Show quoteHide quote "David Thielen" wrote: > That sounds perfect - thank you. > > Follow on question, is there a reason to use a label? ie, is this: > <asp:Label id="lblPassword" runat="Server" > Text='<%#Eval("Password").ToString().Equals(String.Empty)?"":"******"%>'/> > > better than: > <%#Eval("Password").ToString().Equals(String.Empty)?"":"******"%> > > -- > thanks - dave > david_at_windward_dot_net > http://www.windwardreports.com > > > > "Phillip Williams" wrote: > > > If you are databinding within a templated server control, try conditional > > evaluation in the databinding expression, e.g. > > <asp:Label id="lblPassword" runat="Server" > > Text='<%#Eval("Password").ToString().Equals(String.Empty)?"":"******"%>'/> > > -- > > HTH, > > Phillip Williams > > http://www.societopia.net > > http://www.webswapp.com > > > > > > "David Thielen" wrote: > > > > > Hello; > > > > > > This is for viewing a record, not for creating/editing it. So I don't want > > > to use a textbox unless there is a way to mark a text box as read-only (is > > > there?) > > > > > > -- > > > thanks - dave > > > david_at_windward_dot_net > > > http://www.windwardreports.com > > > > > > > > > > > > "agape***@gmail.com" wrote: > > > > > > > <asp:TextBox ID="txtPassword" runat="server" > > > > TextMode="Password"></asp:TextBox> > > > > > > > > good point - thanks
Show quoteHide quote "Phillip Williams" wrote: > I would use the label to be able to style it using CSS or SkinIDs, but if you > do not need a separate style for this field then the second options would > work just as fine. > -- > HTH, > Phillip Williams > http://www.societopia.net > http://www.webswapp.com > > > "David Thielen" wrote: > > > That sounds perfect - thank you. > > > > Follow on question, is there a reason to use a label? ie, is this: > > <asp:Label id="lblPassword" runat="Server" > > Text='<%#Eval("Password").ToString().Equals(String.Empty)?"":"******"%>'/> > > > > better than: > > <%#Eval("Password").ToString().Equals(String.Empty)?"":"******"%> > > > > -- > > thanks - dave > > david_at_windward_dot_net > > http://www.windwardreports.com > > > > > > > > "Phillip Williams" wrote: > > > > > If you are databinding within a templated server control, try conditional > > > evaluation in the databinding expression, e.g. > > > <asp:Label id="lblPassword" runat="Server" > > > Text='<%#Eval("Password").ToString().Equals(String.Empty)?"":"******"%>'/> > > > -- > > > HTH, > > > Phillip Williams > > > http://www.societopia.net > > > http://www.webswapp.com > > > > > > > > > "David Thielen" wrote: > > > > > > > Hello; > > > > > > > > This is for viewing a record, not for creating/editing it. So I don't want > > > > to use a textbox unless there is a way to mark a text box as read-only (is > > > > there?) > > > > > > > > -- > > > > thanks - dave > > > > david_at_windward_dot_net > > > > http://www.windwardreports.com > > > > > > > > > > > > > > > > "agape***@gmail.com" wrote: > > > > > > > > > <asp:TextBox ID="txtPassword" runat="server" > > > > > TextMode="Password"></asp:TextBox> > > > > > > > > > > |
|||||||||||||||||||||||