本文介绍了如何编写linqdatasource _inserting(对象发送者,linqDatasourceInsertEvent args)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何编写linqdatasource _inserting (object sender,linqDatasourceInsertEvent args)
?
我使用详细视图(已经从masterview中选择),但是当我写回sql时,我将采用session[userid]
或master gridview1.[userId]
选定的值.
还是只是简单地用LinquDataSourceInsertEvent
要求Linqdatasoure的插入功能?
How to write a linqdatasource _inserting (object sender,linqDatasourceInsertEvent args)
?
I use a detail view (select from masterview already), but when i write back to sql i will take either a session[userid]
or master gridview1.[userId]
selected value.
Or just simply ask for Inserting function for Linqdatasoure with LinquDataSourceInsertEvent
?
推荐答案
protected void LinqDataSource_Inserting(object sender, LinqDataSourceInsertEventArgs e)
{
Product product = (Product)e.NewObject;
product.DateModified = DateTime.Now;
}
protected void LinqDataSource_Inserting(object sender,
LinqDataSourceInsertEventArgs e)
{
if (e.Exception != null)
{
foreach (KeyValuePair<string, Exception> innerException in
e.Exception.InnerExceptions)
{
Label1.Text += innerException.Key + ": " +
innerException.Value.Message + "<br />";
}
e.ExceptionHandled = true;
}
}
这篇关于如何编写linqdatasource _inserting(对象发送者,linqDatasourceInsertEvent args)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!