Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to apply custom logic to databound controls in formview

Status
Not open for further replies.

jgd123456

Programmer
Nov 3, 2006
19
GB
Hi, i have a formview on my page which has a password field. I encrypt the password when i store it in the database so what i need to do is decrypt it on the display before they edit. I have tried doing:

<asp:TextBox ID="txtPassword" runat="server" Text='<%# Encryption.Decrypt(Bind("Password")) %>'></asp:TextBox>

but this returned the error:

"The name 'Bind' does not exist in the current context"

Even when i try doing:

<asp:TextBox ID="txtPassword" runat="server" Text='<%# Encryption.Decrypt(Eval("Password")) %>'></asp:TextBox>

I get the error:

The best overloaded method match for 'Encryption.Decrypt(string)' has some invalid arguments

Argument '1': cannot convert from 'object' to 'string'

but the second method wouldn't help anyway because i need to pass it back to the objectdatasource to do the update.

Appreciate if someone could help.

Thanks
 
The TextBox has a DataBinding event so I imagine you could do it in there


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Textboxes in 2.0 are not considered bindable objects.. go figure. another wonderful change from MS
However there is a databinding method as ca8msm said.. for what, I don't know.. weird
Have a look at this article in the VS2005 help files

ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref13/html/E_System_Web_UI_Control_DataBinding.htm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top