简体   繁体   English

如何防止在回发后在gridview中动态添加的文本框得到处理

[英]how to prevent dynamically added textbox in gridview to get dispose after postback

I am able to add unlimited textbox column in a row of gridview. 我能够在gridview的一行中添加无限的文本框列。 but after postback these textboxes get disposed. 但回发后,这些文本框将被处理掉。 So how to retain these textboxes and their values after postback? 那么如何在回发后保留这些文本框及其值?

Code: 码:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    int i = 3;
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        crcl = (List<string>)ViewState["bdi2"];
        foreach(string a in crcl)
        {
            TextBox TextBox101 = new TextBox();
            TextBox101.ID=a;
            TextBox101.Width = 60;
            TextBox101.Text = (e.Row.DataItem as DataRowView).Row[a].ToString();
            e.Row.Cells[i].Controls.Add(TextBox101);
            //TextBox101.AutoPostBack = true;
            i++;
        }            
    }       
} 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将数据从文本框复制到另一个文本框,在GridView中动态添加,而无需回发 - How to copy data from textbox to another textbox, added dynamically in gridview, without postback 如何防止gridview上的回发 - How to prevent postback on gridview 防止在回发时丢失GridView的TextBox的值 - Prevent losing the value of the TextBox of the GridView on PostBack 在asp.net中回发后,GridView(复选框)中动态添加的控件消失 - Dynamically added controls in gridview (checkbox) disappear after postback in asp.net 从textchange事件回发后如何将焦点设置到当前gridview行中的特定文本框 - how to set focus to specific textbox in current gridview row after postback from textchange event 如何获取动态添加(值)的文本框值? - How to get the textbox value which is added(value) dynamically? 如何从使用JavaScript动态添加的文本框中获取价值-C# - How to get value from textbox dynamically added with javascript - c# 如何在回发中将文本框保留在网格视图中的单元格内 - How to keep the textbox inside of a cell from gridview, in a postback 回发后如何保留文本框值? - How to retain Textbox values after a Postback? 为什么在动态创建的TextBox上执行PostBack后,FilteredTextBoxExtender无法正常工作? - Why FilteredTextBoxExtender is not working after PostBack on dynamically created TextBox?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM