사용자가 파일을 선택하고 해당 파일을 여는 데 필요한 자격 증명을 제공하는 응용 프로그램을 만들고 있습니다. 이를 위해 gridview에 세 개의 열을 만들었습니다.
사용자가 암호 열에 암호를 입력합니다.
표시하고 싶습니다. 암호 유형의 텍스트 상자를 만들 수있는 것처럼 문자 대신에 *
을 표시하고 싶습니다.
나는 GridView_CellClick
이벤트에이 코드를 시도 : Gridview에서 암호 유형의 열을 만드는 방법은 무엇입니까?
if (GridView.Columns[e.ColumnIndex].HeaderText == "Password")
{
txtPassword[e.RowIndex] = new TextBox();
txtPassword[e.RowIndex].Name = "txtPassword"+e.RowIndex;
txtPassword[e.RowIndex].PasswordChar = '*';
txtPassword[e.RowIndex].Visible = true;
txtPassword[e.RowIndex].TextChanged += new
if (GridView.CurrentCell.Value == null)
txtPassword[e.RowIndex].Text = "";
else
txtPassword[e.RowIndex].Text = GridView.CurrentCell.Value.ToString();
txtPassword[e.RowIndex].Location = GridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex + 1, false).Location;
txtPassword[e.RowIndex].Size = GridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex + 1, false).Size;
txtPassword[e.RowIndex].Visible = true;
txtPassword[e.RowIndex].Focus();
}
그러나 위의 솔루션 문자
가 표시됩니다.이 문제를 어떻게 해결할 수 있습니까?
내가 기본적으로해야합니다 e.Control – Preeti
은'EditingControlShowing'의 핸들러를 찾는 있지 않다'DataGridViewEditingControlShowingEventArgs과 같이 e' 두 번째 매개 변수, 그 중 하나입니다. –
columnindex는 DataGridViewEditingControlShowingEventArgs의 멤버가 아닙니다. 확인할 수 있습니까? – Preeti