Click here to Skip to main content
15,887,485 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Experience with BootMetro? Pin
Abhishek Pant25-Jan-13 10:28
professionalAbhishek Pant25-Jan-13 10:28 
Questionsignature capture from signature pad Pin
premaa36@gmail.com24-Jan-13 17:36
premaa36@gmail.com24-Jan-13 17:36 
AnswerRe: signature capture from signature pad Pin
Sandeep Mewara25-Jan-13 5:03
mveSandeep Mewara25-Jan-13 5:03 
AnswerRe: signature capture from signature pad Pin
Abhishek Pant25-Jan-13 9:51
professionalAbhishek Pant25-Jan-13 9:51 
QuestionHow to get the value of a dynamically created textBox in asp.net C#? Pin
susanna.floora24-Jan-13 2:46
susanna.floora24-Jan-13 2:46 
AnswerRe: How to get the value of a dynamically created textBox in asp.net C#? Pin
chester_it2124-Jan-13 14:50
chester_it2124-Jan-13 14:50 
GeneralRe: How to get the value of a dynamically created textBox in asp.net C#? Pin
susanna.floora24-Jan-13 17:54
susanna.floora24-Jan-13 17:54 
GeneralRe: How to get the value of a dynamically created textBox in asp.net C#? Pin
chester_it2129-Jan-13 4:47
chester_it2129-Jan-13 4:47 
sorry, long time to replay......

first,
The first,
you should know basic first Page Postback ...
every time you create dynamic controls in codebehind, even when you do click on a control button, the page is always postback, and automatically you will never get the value out of control, even control was not there at all when you try to use the event FinControl ...
so, you have to declare the event re-create control when page IsPostBack.

This sample code to start what you want .. this is just a beginning to open its forward your logic .. you can add it from the code sample I gave .....

C#
protected void Page_Load(object sender, EventArgs e)
        {
            if(!Page.IsPostBack) //this first time page Load/isPostback when call this page
            {
              GenerateControlSelf();//for generate custom control in holder(as PlaceHolder)
            }
            else //second Page.isPostback
            {
                // you must declare again your custom control in second Page.isPostback
                var txt = new TextBox { ID = "tbx", Text = DateTime.Now.ToString(CultureInfo.InvariantCulture), ClientIDMode = ClientIDMode.Static };
                holder.Controls.Add(txt);
                var ddl = new DropDownList { ID = "ddlx" };

                var nextYear = Convert.ToInt32(DateTime.Now.Year.ToString(CultureInfo.InvariantCulture)) + 1;
                var lastYear = Convert.ToInt32(DateTime.Now.Year.ToString(CultureInfo.InvariantCulture)) - 10;
                for (var n = lastYear; n < nextYear; n++)
                {
                    ddl.Items.Add(n.ToString(CultureInfo.InvariantCulture));
                }


                ddl.AutoPostBack = true;
                ddl.SelectedIndex = 0;
                ddl.DataBind();
                holder.Controls.Add(ddl);
            }

        }
        private void GenerateControlSelf()
        {
            
            var txt = new TextBox { ID = "tbx", Text = DateTime.Now.ToString(CultureInfo.InvariantCulture) ,ClientIDMode = ClientIDMode.Static};
            holder.Controls.Add(txt);            
            var ddl = new DropDownList {ID = "ddlx"};

            var nextYear = Convert.ToInt32(DateTime.Now.Year.ToString(CultureInfo.InvariantCulture)) + 1;
            var lastYear = Convert.ToInt32(DateTime.Now.Year.ToString(CultureInfo.InvariantCulture)) - 10;
            for (var n = lastYear; n < nextYear; n++)
            {
                ddl.Items.Add(n.ToString(CultureInfo.InvariantCulture));
            }


            ddl.AutoPostBack = true;
            ddl.SelectedIndex = 0;
            ddl.DataBind();
            holder.Controls.Add(ddl);
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //this for get custom control DropDownLost with id 'ddlx'
            foreach (Control ctl in holder.Controls)
            {
                if (ctl is DropDownList)
                {
                    DropDownList ddl = (DropDownList) ctl;
                    object x = ddl.SelectedItem;
                }

            }

            //this for get custom control textBox with id 'tbx'
            foreach (Control ctl in holder.Controls)
            {
                if (ctl is TextBox)
                {
                    TextBox tbx = (TextBox)ctl;
                    object x = tbx.Text;
                }

            }

        }

I remind you again, the sample code is just for starters only, to pave the way you are thinking ...
GeneralRe: How to get the value of a dynamically created textBox in asp.net C#? Pin
susanna.floora3-Feb-13 20:30
susanna.floora3-Feb-13 20:30 
GeneralRe: How to get the value of a dynamically created textBox in asp.net C#? Pin
chester_it216-Feb-13 6:22
chester_it216-Feb-13 6:22 
QuestionURL Rewriting Pin
MaheshPandian24-Jan-13 0:37
MaheshPandian24-Jan-13 0:37 
AnswerRe: URL Rewriting Pin
Shameel24-Jan-13 1:00
professionalShameel24-Jan-13 1:00 
GeneralRe: URL Rewriting Pin
MaheshPandian24-Jan-13 2:28
MaheshPandian24-Jan-13 2:28 
QuestionHow to create loocal SMTP server in windows Pin
sani_alam23-Jan-13 23:59
sani_alam23-Jan-13 23:59 
AnswerRe: How to create loocal SMTP server in windows Pin
Richard MacCutchan24-Jan-13 1:54
mveRichard MacCutchan24-Jan-13 1:54 
QuestionHow to extract data of a table. Pin
anubhaw.gupta23-Jan-13 20:06
anubhaw.gupta23-Jan-13 20:06 
Questionhow to use ckeditor in asp.net? Pin
Daxiii23-Jan-13 0:09
Daxiii23-Jan-13 0:09 
AnswerRe: how to use ckeditor in asp.net? Pin
R. Giskard Reventlov23-Jan-13 5:31
R. Giskard Reventlov23-Jan-13 5:31 
AnswerRe: how to use ckeditor in asp.net? Pin
Sandeep Mewara23-Jan-13 8:20
mveSandeep Mewara23-Jan-13 8:20 
Questionhow resize this image before uploading Pin
Jassim Rahma22-Jan-13 8:44
Jassim Rahma22-Jan-13 8:44 
AnswerRe: how resize this image before uploading Pin
jkirkerx22-Jan-13 12:25
professionaljkirkerx22-Jan-13 12:25 
AnswerRe: how resize this image before uploading Pin
Richard Deeming23-Jan-13 1:53
mveRichard Deeming23-Jan-13 1:53 
QuestionIssue in web farm scenario deployment ASP.NET Pin
mukeshgaharwar21-Jan-13 19:20
mukeshgaharwar21-Jan-13 19:20 
AnswerRe: Issue in web farm scenario deployment ASP.NET Pin
Sandeep Mewara22-Jan-13 2:41
mveSandeep Mewara22-Jan-13 2:41 
QuestionWebResponse Pin
pit's_world21-Jan-13 1:50
pit's_world21-Jan-13 1:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.