i had loaded data into datagrid dynamically and binded it without connecting to 
database.

I have checkboxes in template column.The user can select one or more item in 
datagrid by selecting these checkboxes.There is a delete button outside 
datagrid.If i click delete the selected rows must be removed the code is 
here:Plz help me on that.There is no Tool tip for template column checkboxes.

 

private void Btn_addlist_Click(object sender, System.EventArgs e)

{

DataView dvView=new DataView();

dvView= CreateDataSource(); 

ItemsGrid.DataSource =dvView;

// Response.Write(i);

ItemsGrid.DataBind();

Session["ItemData"]= dvView;

 

}

public DataView CreateDataSource() 

{

DataTable dt = new DataTable();

DataRow dr; 



DataView dvView=new DataView();

if(Session["ItemData"]==null)

{



dt.Columns.Add(new DataColumn("Answers", typeof(string)));

dt.Columns.Add(new DataColumn("Value", typeof(string)));

} 

else

{

dvView=(DataView)Session["ItemData"];

dt=dvView.Table;

}

int i=dt.Rows.Count+1;

if(i<=1)

{

dr=dt.NewRow();

dr[0]=Tbx_ans.Text;

dr[1]=Tbx_defans.Text;

dt.Rows.Add(dr);

DataView dv = new DataView(dt); 

return dv; 

}

else

{

dr=dt.NewRow();

dr[0]=Tbx_ans.Text;

dr[1]=Tbx_defans.Text;

dt.Rows.Add(dr);

DataView dv = new DataView(dt);

return dv;

}

}

private void Btn_remlist_Click(object sender, System.EventArgs e)

{



 

bool flag = false;

foreach (DataGridItem CurRow in ItemsGrid.Items) 

{

CheckBox deleteChkBxItem = (CheckBox) CurRow.FindControl("del"); 

if(deleteChkBxItem.Checked == true )

{

flag = true; 





}

}





Yahoo! India Matrimony: Find your life partneronline.

[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to