freelanceprogrammers.org Forum Index » ASP

datarow...indexdoesnt change


View user's profile Post To page top
devicekid Posted: Tue Jan 11, 2005 9:25 pm


Joined: 04 Jan 2005

Posts: 6
datarow...indexdoesnt change
hi,
here is my problem....i want to add new rows to the
datatabe...but i wana do it on the click event of a button


code goes somethin like this:

DataTable dt = new DataTable();
DataRow dr = dt.NewRow();
dr[0]=TextBox1.Text.ToString();
dr[1]=TextBox2.Text.ToString();
dr[2]=TextBox3.Text.ToString();
dt.Rows.Add(dr);
DataGrid1.DataSource=dt;
this.DataGrid1.DataBind();

this code works fine but it adds only one new row(ie. only for the
first time when it is clicked).....hence forth when u click the
button the data same row value gets changed ratehr than adding a new
row....can someone plz help
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help