hi iam using asp.net with c#
in my gridview 1st column is templatefield which contains check box control,
default i set to check, iam displaying data at page load event
but when i unchecked the checkbox then that row should be remove from gridview .
can you give me example which helps me
Loading
VasanthPosted Apr 6, 2010, 6:28 AM
before delete the records , just show the confirmation message "Are you sure to delete ? " using javascript in onChange event.
[ Code Behind - C# ]
void Page_Load(Object sender, EventArgs e)
{
if(!IsPostBack)
{
//bind the records
BindData();
}
}
protected void chkSelect_CheckedChanged(object sender, EventArgs e)
{
CheckBox checkbox = (CheckBox)sender;
if (checkbox.Checked)
{
GridViewRow row = (GridViewRow)checkbox.NamingContainer;
string ID = row.Cells[1].Text;
//By using the ID , just delete the records in the database
//Call again and bind the records
BindData();
}
}
public void BindData()
{
//Bind the records from the database to the gridview.
}
If it helps out , please mark as answer.