Jump to content

Datagrid in vs2003


soona

Recommended Posts

Hi,Now i work vs2003 asp.net c# datagrid...fotter i include delete button... header include chekbox1 ,itemtemplate include checkbox2... select header template checkbox all itemtemplate checkbox are selected.....it's work fine...1.now i need directly click the delete button give the error messagebox or alert message "select any one or more checkbox is must ".....2.after select the checkbox.checked=true the alert message "are you sure delete this record"...how to do it....my delete code as follows:private void DataGrid1_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e){CheckBox cm=new CheckBox();string str="";if(e.CommandName=="cmddel"){foreach(DataGridItem objItem in DataGrid1.Items){if(((CheckBox)objItem.Cells[6].FindControl("CheckBox1")).Checked == true){str+=((Label)objItem.Cells[0].FindControl("lbl_id")).Text+",";}}conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=E:/test/New Proposal Management 2003.mdb");conn.Open();com=new OleDbCommand("delete from Clients where ID in("+ str+ ")",conn);com.ExecuteNonQuery();conn.Close();//DataGrid1.EditItemIndex=-1;Label1.Text="Deleted ..!";}this.display();str="";} Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...