问题描述
hi如何使用存储过程从数据列表中删除所选项目... ???
谁能帮忙???
hi how to delete selected items from datalist using stored procedure...???
can any one help???
推荐答案
foreach (RepeaterItem rept in rptbom.Items)
{
CheckBox chkSelect = (CheckBox)rept.FindControl("chkSelect");
Int64 fg_id = Convert.ToInt64(((HiddenField)rept.FindControl("hdnfg_id")).Value);
if (chkSelect.Checked == true)
{
//Delete Procedure working here
}
}
对于转发器,对于gridview一样
foreach(grdDetail.Rows中的GridviewRow grd)
{
CheckBox chkSelect =(CheckBox)grd.FindControl("chkSelect");
现在,像上面一样更改您的代码.
如果有任何问题,可以与我联系.
It is for repeater same is for gridview
foreach (GridviewRow grd in grdDetail.Rows)
{
CheckBox chkSelect = (CheckBox)grd.FindControl("chkSelect");
Now Change your code same as above.
if you have any problem then you can contact with me.
protected void DeleteAll_Click(object sender, System.EventArgs e)
{
bool isDeleted;
// Check each box and see if the item should be deleted.
foreach (DataListItem anItem in DataList1.Items)
{
isDeleted =
((CheckBox)anItem.FindControl("Delete")).Checked;
if (isDeleted)
{
// Add code here to delete the item, using anItem.ItemIndex.
}
}
DataList1.DataBind();
}
有关更多详细信息:
http://msdn.microsoft.com/en-us/library/b7y72882%28v = vs.71%29.aspx [ ^ ]
希望对您有帮助.
并且,如果有帮助,别忘了将其标记为答案. :)
for more in detail :
http://msdn.microsoft.com/en-us/library/b7y72882%28v=vs.71%29.aspx[^]
Hope this will help you.
And don''t forget to mark as answer if it helps. :)
这篇关于如何使用存储过程从数据列表中删除所选项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!