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

Discussion in 'ASP .Net Datagrid Control' started by Andreas Semmelmann, Dec 23, 2003.

  1. 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.
    Andreas Semmelmann, Dec 23, 2003
    #1
    1. Advertising

  2. 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
    >-----Original Message-----
    >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.
    >
    >
    >.
    >
    Svetlin Grancharov, Dec 27, 2003
    #2
    1. Advertising

  3. 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?


    "Svetlin Grancharov" <> schrieb im Newsbeitrag
    news:044101c3cc64$0abb0350$...
    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
    >-----Original Message-----
    >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.
    >
    >
    >.
    >
    Andreas Semmelmann, Dec 28, 2003
    #3
  4. Hello Svetlin.

    I´ve found my error. I've forgotten to set the onItemCreated-Popertie of the
    DataGrid!!!! (folish error!) Thanks for your help.
    "Svetlin Grancharov" <> schrieb im Newsbeitrag
    news:044101c3cc64$0abb0350$...
    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
    >-----Original Message-----
    >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.
    >
    >
    >.
    >
    Andreas Semmelmann, Dec 28, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex
    Replies:
    1
    Views:
    524
    Colt [MVP]
    Jul 11, 2003
  2. Kumar

    asp:TextBox TextMode='Password'

    Kumar, Jul 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    619
    Kumar
    Jul 12, 2003
  3. Kerri
    Replies:
    2
    Views:
    4,503
    Kerri
    Aug 11, 2003
  4. Jonathan Dienst

    Problem with Password TextMode

    Jonathan Dienst, Nov 16, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    4,484
    Steve C. Orr [MVP, MCSD]
    Nov 17, 2003
  5. Ather Ali Shaikh

    About TextMode = Password

    Ather Ali Shaikh, Dec 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,106
    Steve C. Orr [MVP, MCSD]
    Dec 28, 2003
Loading...

Share This Page