Could I set TextMode = "Password" ind Editing-Mode of the DataGrid?

A

Andreas Semmelmann

Hello Folks.

I have a DataGrid displaying the conten of a SQL-Database. In this table
exist a Field wich contains Passwords. Firstly I´d liked to change the
Password over the DataGrid. Secondly I´d like to hide the Input of the PW to
the User. I´ve tried the following:

Sub dg_ItemCreated(Sender As Object, E As DataGridItemEventArgs)
Response.Write("<h1>Test</h1>")
If E.Item.ItemType = ListItemType.EditItem Then
Dim tb_pwd As TextBox = CType(E.Item.Cells(2).Controls(0), TextBox)
tb_pwd.Textmode = "Password"

BindData()
End If

End Sub

But this would´nt work. The Event was not fired at all. How can I hide the
Password while the User is typing it in? (like asp:textbox
textmode="Password"). It would be more helpful for me, if the solutions are
in VB.NET, because I`m very new to .NET.
Thanks for your help.
 
S

Svetlin Grancharov

Hi,

for doing that in code you should use TextBoxMode
enumeration. So change the line
tb_pwd.Textmode = "Password"
to
tb_pwd.Textmode = TextBoxMode.Password

Best,

Svetlin Grancharov
Frontline System
 
A

Andreas Semmelmann

Hello Svetlin.

Thanks for your fast reply. But your solution doesn`t work. The event
"ItemCreated" was not fired! I don`t now why! Have you any hints why this
could happen?


Hi,

for doing that in code you should use TextBoxMode
enumeration. So change the line
tb_pwd.Textmode = "Password"
to
tb_pwd.Textmode = TextBoxMode.Password

Best,

Svetlin Grancharov
Frontline System
 
A

Andreas Semmelmann

Hello Svetlin.

I´ve found my error. I've forgotten to set the onItemCreated-Popertie of the
DataGrid!!!! (folish error!) Thanks for your help.
Hi,

for doing that in code you should use TextBoxMode
enumeration. So change the line
tb_pwd.Textmode = "Password"
to
tb_pwd.Textmode = TextBoxMode.Password

Best,

Svetlin Grancharov
Frontline System
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top