2016-06-03 4 views
1

일부 셀에 텍스트 상자가있는 동적 테이블을 개발했습니다.동적 컨트롤이있는 텍스트를 ASP : 테이블에 추가하려면 어떻게합니까?

enter image description here

가 지금은 백분율 기호를 원하는 (: 여기

chk = (CheckBox)tbl_fundtype.Rows[0].Cells[i].FindControl(DynamicChkID); 
TableCell td = new TableCell(); 
if (chk.Checked == true) 
{ 
    TextBox txt = new TextBox(); 
    txt.ID = "txt_" + dt_fundtype.Rows[i]["fund_type_cd"].ToString(); 
    txt.Attributes.Add("Placeholder", "Enter Share Percent..."); 
    td.Controls.Add(txt); 
} 
else 
{ 
    td.Text = "  "; 
} 
tr.Cells.Add(td); 
} 
tbl_fundtype.Rows.Add(tr); 

는 TD에서 텍스트 상자를 추가 한 후 스냅 샷입니다 :

텍스트 상자도 같은 백엔드에서 추가되는 동적 컨트롤입니다 %)를 입력하십시오. td.Text를 시도했지만 텍스트가 인쇄되지 않았습니다.

어떻게하면됩니까?

미리 도움을 주셔서 감사합니다.

편집 : 나는이 시도

: 당신은 TD에 textboxlabel을 추가 할 수 있습니다

if (chk.Checked == true) 
       { 
        TextBox txt = new TextBox(); 
        txt.ID = "txt_" + dt_fundtype.Rows[i]["fund_type_cd"].ToString(); 
        txt.Attributes.Add("Placeholder", "Enter Share Percent..."); 
        td.Controls.Add(txt); 
        Label lbl = new Label(); 
        lbl.Text = "%"; 
        td.Controls.Add(lbl); 
       } 

여전히 change.didn't 인쇄 어떤 일

답변

1

Label lbl = new Label(); 
lbl.Text = "%"; 
td.Controls.Add(lbl); 
+0

아니요, 아무 것도 인쇄하지 않았습니다. thing :( –

+0

그냥 기존 코드와 함께 위의 코드를 추가하십시오 – Mairaj

+0

예 시도 : –

관련 문제