Click here to Skip to main content
15,915,509 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: MVC - How are you scripting..? Pin
John-ph25-Sep-12 20:39
John-ph25-Sep-12 20:39 
GeneralRe: MVC - How are you scripting..? Pin
Dylan Morley26-Sep-12 3:08
Dylan Morley26-Sep-12 3:08 
GeneralRe: MVC - How are you scripting..? Pin
John-ph26-Sep-12 17:57
John-ph26-Sep-12 17:57 
QuestionHow to copy the content of textbox to the clipboard Pin
vinay_sinha23-Sep-12 21:25
vinay_sinha23-Sep-12 21:25 
QuestionCreating Textboxes Dynamically Pin
ASPnoob23-Sep-12 2:53
ASPnoob23-Sep-12 2:53 
AnswerRe: Creating Textboxes Dynamically Pin
Vani Kulkarni23-Sep-12 18:32
professionalVani Kulkarni23-Sep-12 18:32 
AnswerRe: Creating Textboxes Dynamically Pin
vinay_sinha23-Sep-12 20:59
vinay_sinha23-Sep-12 20:59 
AnswerRe: Creating Textboxes Dynamically Pin
ema2000_t24-Sep-12 11:55
ema2000_t24-Sep-12 11:55 
The problem u have is how to access the dynamically created textboxes, isn't it
ok
look, the code u had written actually creates a number of objects of type TextBox, and give every one a name that is 'TextBoxName1', 'TextBoxName2',.. etc

the problem here is how to access the objects created.
so, you must declare a generic dictionary of string and TextBox on the class level, means
C#
Dictionary<string,TextBox> AllTextBoxes = new
Dictionary<string,TextBox> ();


this code will be in the class level not inside any methods.

the second step is to add a line inside the loop to add items to this dictionary, each of them consists of a key and a value, the key is the name of textbox, while the value is the textbox object created in each loop, this line will be at the end of loop,
C#
AllTextBoxes.Items.Add("TextBoxName" + i.ToString(), tb);

now, u can access any textboxe through the dictionary when giving the name of textbox like this

C#
string aaa = AllTextBoxes["TextBoxName1"].Text;


I hope this is usefull
Dr Sayed Tohamy, Egypt
AnswerRe: Creating Textboxes Dynamically Pin
n.podbielski28-Sep-12 1:12
n.podbielski28-Sep-12 1:12 
AnswerRe: Creating Textboxes Dynamically Pin
RichardGrimmer28-Sep-12 4:11
RichardGrimmer28-Sep-12 4:11 
Questionasp.net web form or asp.net mvc ?? Pin
Mohamad Shahmardan22-Sep-12 13:04
Mohamad Shahmardan22-Sep-12 13:04 
AnswerRe: asp.net web form or asp.net mvc ?? Pin
Vani Kulkarni23-Sep-12 18:30
professionalVani Kulkarni23-Sep-12 18:30 
AnswerRe: asp.net web form or asp.net mvc ?? Pin
John-ph23-Sep-12 18:43
John-ph23-Sep-12 18:43 
GeneralRe: asp.net web form or asp.net mvc ?? Pin
Mohamad Shahmardan24-Sep-12 3:06
Mohamad Shahmardan24-Sep-12 3:06 
GeneralRe: asp.net web form or asp.net mvc ?? Pin
n.podbielski28-Sep-12 1:13
n.podbielski28-Sep-12 1:13 
Questionjquery ui autocomplete Pin
lokesh.developer21-Sep-12 18:19
lokesh.developer21-Sep-12 18:19 
AnswerRe: jquery ui autocomplete Pin
Sandeep Mewara21-Sep-12 19:34
mveSandeep Mewara21-Sep-12 19:34 
AnswerRe: jquery ui autocomplete Pin
jkirkerx22-Sep-12 14:03
professionaljkirkerx22-Sep-12 14:03 
AnswerRe: jquery ui autocomplete Pin
n.podbielski28-Sep-12 1:17
n.podbielski28-Sep-12 1:17 
QuestionHow to put line numbers in Textbox with multiline Pin
vinay_sinha21-Sep-12 2:28
vinay_sinha21-Sep-12 2:28 
AnswerRe: How to put line numbers in Textbox with multiline Pin
Shameel21-Sep-12 3:08
professionalShameel21-Sep-12 3:08 
AnswerRe: How to put line numbers in Textbox with multiline Pin
Sandeep Mewara21-Sep-12 6:28
mveSandeep Mewara21-Sep-12 6:28 
GeneralRe: How to put line numbers in Textbox with multiline Pin
vinay_sinha23-Sep-12 21:01
vinay_sinha23-Sep-12 21:01 
QuestionWCF / Single instance / multple concurrency question Pin
Luca Dominici20-Sep-12 5:58
Luca Dominici20-Sep-12 5:58 
AnswerRe: WCF / Single instance / multple concurrency question Pin
Expert Coming20-Sep-12 13:57
Expert Coming20-Sep-12 13:57 

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.