TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
jignesh kadvani
NA
83
0
Dynamic TextBox Disappear when Page get refreshed and How to store and Read Values in Dynamic TextBox.
Nov 18 2008 1:57 AM
Hello friends...
i am generationg Dynmic TextBox in asp.net
<asp:TextBox ID="txtNo" Width="50px" runat="server"></asp:TextBox>
<asp:Button ID="btnNo" runat="server" Text="How Many TextBox..?" OnClick="btnNo_Click" />
<p>
</p>
<asp:Panel ID="Panel1" runat="server">
<asp:Button ID="btnSearch" runat="server" Text="Search"
onclick="btnSearch_Click" />
</asp:Panel>
below is my code to generate dynamic textboxes:
public partial class WebForm1 : System.Web.UI.Page
{
TextBox txt1 = new TextBox();
protected void Page_Load(object sender, EventArgs e)
{
}
public void createBox()
{
Int16 intTotalNo;
intTotalNo = Convert.ToInt16(txtNo.Text);
for (int i = 1; i <= intTotalNo; i++)
{
TextBox box = new TextBox();
box.ID = "txt1" + i;
box.Width = Unit.Pixel(20);
box.MaxLength = 1;
box.EnableViewState = true;
PlaceHolder1.Controls.Add(box);
PlaceHolder1.Controls.Add(new LiteralControl(" "));
}
}
protected void btnNo_Click(object sender, EventArgs e)
{
createBox();
}
protected void btnSearch_Click(object sender, EventArgs e)
{
}
now Above Code Generate TextBoxes. but when page get refreshed then all the Dynamic generated textBoxes may get disappeared...
so any one can help me how to resolve this problem and. how to store the value in dynamic generated textbox. and how to read that value from that TextBoxes...
Reply
Answers (
5
)
Standards in ASP.Net
what is generics?