Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

How to read the dynamically created textbox value?

$
0
0
In a foreach loop i'm adding a textbox dynamically, I want to enter some text dynamically so that i can read and store the text into a variable ON BUTTON CLICK
private void tab_sub(DataTable dt2, Table tbl)
    {
        TableRow tr;
        TableCell tc;

        foreach (DataRow dr in dt2.Select("", ""))
        {
                tr = new TableRow();
                tc = new TableCell();
                tc.Text = dr["DNAME"].ToString();
                tr.Controls.Add(tc);


                tc = new TableCell();
                tc.Text = dr["MNAME"].ToString();
                tr.Controls.Add(tc);

            tc = new TableCell();
            tc.Text = dr["ID"].ToString();
            tr.Controls.Add(tc);

             Textbox tb = new TextBox();
             tc = new TableCell();
            tb.Text = "";
            tb.ID = "T" + county;
            tc.Controls.Add(tb);
            tr.Controls.Add(tc);

            tbl.controls.add(tr);
}


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>