?
Solved

dynamic textbox

Posted on 2011-02-11
2
Medium Priority
?
383 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Expert Comment

by:Praveen Kumar
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 2000 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

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

771 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