C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...









How to Add a Row in a table Dynamically


Posted Date: 25 May 2008    Resource Type: Code Snippets    Category: DataGridView

Posted By: Raju.M       Member Level: Gold
Rating:     Points: 10



The following code sample shows how to Add a Row in a table Dynamically.


DataTable ImageTable = new DataTable();

ImageTable.Columns.Add(new DataColumn("imageTitle", typeof(string)));
ImageTable.Columns.Add(new DataColumn("ImageUrl", typeof(string)));
ImageTable.Columns.Add(new DataColumn("postbackUrl", typeof(string)));
//DataRow drow = ImageTable.NewRow();
for (int i = 0; i < fInfo.Length; i++)
{
DataRow drow = ImageTable.NewRow();
drow["imageTitle"] = fInfo[i].ToString().Remove(fInfo[i].ToString().Length - 4);
drow["ImageUrl"] = "";
drow["postbackUrl"] = string.Format("url.aspx?temp={0}", Server.UrlEncode(fInfo[i].ToString()));
ImageTable.Rows.Add(drow);
}





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Dynamicrow  .  Add a Row in a table Dynamically in DataTable  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: adding dynamic row in a datagrid
Previous Resource: checkbox in a Datagrid2 which is inside the Datagrid1
Return to Discussion Resource Index
Post New Resource
Category: DataGridView


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

it outsourcing

Contact Us    Privacy Policy    Terms Of Use