2017-05-03 5 views
1

나는 gridview 항목 템플릿을 텍스트 상자에, 그래서 내가 메모리에 datatable 만들고 gridview 할당 할 수 있지만 값을 텍스트 상자에 할당하지 않습니다 항목 템플릿에서어떻게 gridview 내에서 값으로 texbox as itemTemplate 값을 asign하려면

어떻게 내 데이터 테이블의 값을 그리드 내부의 컨트롤에 할당 할 수 있습니까?

grdNotas.Rows(numero).Cells(2).FindControl("txtf1") 

텍스트의 속성을 넣지 않습니다.

Dim tbnotasAlumnos As New DataTable 

    For Each fila As DataRow In tbAlumnnoCurso.Rows 
     tbnotasAlumnos = conexion.consultaNotaMateriaAQP(tbAlumnnoCurso.Rows(numero)(0).ToString, ddlmaterias.SelectedValue, txtQuimestre.Text, txtparcial.Text) 
     'fill the textboxes 
     grdNotas.Rows(numero).Cells(2).FindControl("txtf1") 
     numero = numero + 1 
    Next 

어떻게 할 수 있습니까?

감사합니다.

답변

0

컨트롤을 찾을 필요가있을뿐만 아니라 컨트롤을 특정 유형으로 캐스팅해야합니다. 그러면 텍스트 상자의 속성에 액세스 할 수 있습니다.

Dim txt As TextBox = CType(grdNotas.Rows(numero).Cells(2).FindControl("txtf1"), TextBox) 
txt.Text = "value" 
+0

감사합니다. –