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
Praveen Mathi
NA
8
2.2k
gridview
Aug 27 2013 7:28 AM
private void AddNewRow()
{
int rowIndex = 0;
if (ViewState["CurrentTable"] != null)
{
DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"];
DataRow drCurrentRow = null;
if (dtCurrentTable.Rows.Count > 0)
{
for (int i = 1; i <= dtCurrentTable.Rows.Count; i++)
{
TextBox TextBoxItem =
(TextBox)gvCheckList.Rows[rowIndex].Cells[1].FindControl("txtItem");
TextBox TextBoxSspSpec =
(TextBox)gvCheckList.Rows[rowIndex].Cells[2].FindControl("txtSspspec");
drCurrentRow = dtCurrentTable.NewRow();
drCurrentRow["RowNumber"] = i + 1;
dtCurrentTable.Rows[i - 1]["Col1"] = TextBoxItem.Text;
dtCurrentTable.Rows[i - 1]["Col2"] = TextBoxSspSpec.Text;
rowIndex++;
}
dtCurrentTable.Rows.Add(drCurrentRow);
ViewState["CurrentTable"] = dtCurrentTable;
gvCheckList.DataSource = dtCurrentTable;
gvCheckList.DataBind();
}
}
else
{
Response.Write("ViewState is null");
}
SetPreviousData();
}
for example i have 6 rows in a gridview in tat every rows having a insertbutton named new. If i Click tat Button i want a new row, below the existing one... but here am getting a new row below the grid view
Reply
Answers (
5
)
error
Tab Index in ASP.Net