I have add the empty row for repeater using below code
protected void btnAddRow_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt = AddDataTable();
if (dt.Rows.Count >= 1)
{
dt.Rows.Add();
rptrReference.DataSource = dt;
rptrReference.DataBind();
}
btnSave.Focus();
}
protected DataTable AddDataTable()
{
DataTable dtReference = new DataTable("Project");
dtReference.Columns.Add("IN_ORGAN_CODE");
dtReference.Columns.Add("IN_COMP_REF_NO");
dtReference.Columns.Add("IN_REFERENCE_TYPE");
int rowID = 0;
dtle = dtReference.Clone();
TextBox tbxCode = new TextBox();
foreach (RepeaterItem dataItem in rptrReference.Items)
{
tbxCode = (TextBox)dataItem.FindControl("tbxCode");
dtle.Rows.Add();
dtle.Rows[rowID]["IN_ORGAN_CODE"] = 9212;
dtle.Rows[rowID]["IN_COMP_REF_NO"] = tbxLegacyCode.Text.Trim().ToUpper();
dtle.Rows[rowID]["IN_REFERENCE_TYPE"] = "PRF";
rowID++;
}
return dtle;
}
How to Delete using button click using particular row?