repeater 删除
<asp:LinkButton ID="lbtnDeleteNews" CausesValidation="false" CommandArgument='<%# Eval("FileID") %>'
runat="server" OnClick="lbtnDeleteNews_Click" OnClientClick="return confirm('是否要真的删除?')">删除</asp:LinkButton>
protected void lbtnDeleteNews_Click(object sender, EventArgs e)
{
try
{
LinkButton lb = (LinkButton)sender;
int id = Convert.ToInt32(lb.CommandArgument);
var model = db.GetModel(id);
string strPath = strNewsPath + model.Fid + "/" + model.FileName;
db.Delete(id);
if (File.Exists(Server.MapPath(strPath)))
{
File.Delete(Server.MapPath(strPath));
}
BindFile();
}
catch (Exception ex)
{
}
}