C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

data row


Posted Date: 29 Feb 2008      Posted By: shubha s.y      Member Level: Bronze     Points: 2   Responses: 2



hi i have created data table nd inserted the contents to it using data row and data column....
datatabledt=new datatable;
dt.columns.add(new datacolumn(name);
dt.columns.add(new datacolumn(age);
datarow dr=dt.newrow()
dr[0]=textbox1.text;
dr[1]=textbox2.text;
dt.rows.add(dr);
gridview1.datasourse=dt;
gridview1.databind();


the problem is every time i submit the form it will take only one row...if u submit another set of values the previous will me replaced by new one....how to solve this.........i m usin asp.net 2.0 and c#..please help me......as soon as possible





Responses

Author: Satish Kumar J    29 Feb 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Store DataTable in Session Variable, Please try following


datatable dt;
if(Session["dtTable"] == null)
{
dt = new DataTable();
}
else
{
dt = (DataTable)Session["dtTable"];
}
dt.columns.add(new datacolumn(name);
dt.columns.add(new datacolumn(age);
datarow dr=dt.newrow()
dr[0]=textbox1.text;
dr[1]=textbox2.text;
dt.rows.add(dr);
gridview1.datasourse=dt;
gridview1.databind();
Session["dtTable"] = dt;


HTH

Regards,
Satish.

Regards,
Satish
My Blog



Author: Jins Philip    29 Feb 2008Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

 & 



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Please guide to me.
Previous : combo box binding with database
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use