Solved

dynamic textbox

Posted on 2011-02-11
2
381 Views
Last Modified: 2012-08-14
i cant create dynamic textboxes with html commands.
How do i do this?

 For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
       
            strResults.Append("<tr>")
            strResults.Append("<td>")
            strResults.Append("<input type=text value=" & ds.Tables(0).Rows(i).Item(8) & "/>")
            strResults.Append(" <asp:TextBox  ></asp:TextBox>")
       
0
Comment
Question by:jagguy
2 Comments
 
LVL 12

Expert Comment

by:Mamtha1982
ID: 34870359
You have to provide name attribute for it:

Ex:
 <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
0
 
LVL 11

Accepted Solution

by:
SAMIR BHOGAYTA earned 500 total points
ID: 34870394
Hi, use this code

//On Button Click
TextBox txt = new TextBox();
txt.Name = "a1" + i.ToString();

txt.Location = new Point(367, y);
txt.Size = new Size(127, 20);
panel2.Controls.Add(txt);
TextBox txt1 = new TextBox();
txt1.Name = "a2" + i.ToString();

txt1.Location = new Point(520, y);
txt1.Size = new Size(59,20);
panel2.Controls.Add(txt1);

TextBox txt2 = new TextBox();
txt2.Name = "a3" + i.ToString();

txt2.Location = new Point(602, y);
txt2.Size = new Size(59,20);
panel2.Controls.Add(txt2);
y += 25;
i++;
rowcount++;


//To Retrive TexBoxes

for(int p=0; p
{
foreach (Control tempc in panel2.Controls)
{
if(tempc is TextBox)
{
if (tempc.Name == "a1"+ p.ToString())
{
medicine = tempc.Text;
}
else if (tempc.Name == "a2" +p.ToString())
{
time = tempc.Text;
}
else if (tempc.Name == "a3" + p.ToString())
{
day = tempc.Text;
}
}
}
obj.insertdata("INSERT INTO.... ");
}
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question