对于使用ASP.NET C锐利为例回调示例关闭,因为这篇文章是不是一个问题,或尚未在措辞的方式,允许将提供一个合理的答案。 报告2011年10月24日(星期一),上午02:56。
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack && !IsCallback)
{
PageLoad();
Session["dsnarration"] = ds;
}
else
{
ds = (DataSet)Session["dsnarration"];
}
grdnarration.DataSource = ds.Tables[0];
grdnarration.DataBind();
}
public void PageLoad()
{
ds = new DataSet();
ds = ON.GetNarration(0);
Session["DS"]= ds;
}
protected void txtremarks_TextChanged(object sender, EventArgs e)
{
try
{
if (!string.IsNullOrEmpty(txtnarration.Text))
{
_txtnarration = Convert.ToString(txtnarration.Text.ToString());
}
else
{
_txtnarration = txtnarration.Text;
}
if (!string.IsNullOrEmpty(txtremarks.Text))
{
_txtremarks = Convert.ToString(txtremarks.Text.ToString());
}
else
{
_txtremarks = txtremarks.Text;
}
Qry = Qry + " Begin ";
Qry = Qry + " Begin Tran";
Qry = Qry + " Begin Try";
Qry = Qry + " Insert into Mas_Narration(Narration,Remarks)";
Qry = Qry + " Values('" + _txtnarration + "','" + _txtremarks + "')";
Qry = Qry + "Commit Transaction End Try Begin Catch Rollback End Catch END";
S.Execute(Qry);
Alert.AlertSaved(this, "Mas_Narration.aspx");
}
catch
{
Alert.AlertBox(this, "Please check Your all Inputs");
}
}
protected void ASPxCallbackPanel2_Callback(object sender, CallbackEventArgsBase e)
{
int NarrationId = 0;
int Id = 0;
if (grdnarration.FocusedRowIndex != -1)
{ // int32 NarrationID =convert.toint32(ds.tables[0].rows[0]["id"].tostring();
NarrationId = Convert.ToInt32(grdnarration.GetRowValues(grdnarration.FocusedRowIndex, "NarrationId").ToString());
}
Id = Convert.ToInt32(NarrationId);
ds = ON.GetNarration(Id);
Session["dsnarration"] = ds;
if (ds.Tables[0].Rows[0]["Narration"] != DBNull.Value)
{
txtnarration.Text = Convert.ToString(ds.Tables[0].Rows[0]["Narration"]);
}
if (ds.Tables[0].Rows[0]["Remarks"] != DBNull.Value)
{
txtremarks.Text = Convert.ToString(ds.Tables[0].Rows[0]["Remarks"]);
}
if (ds.Tables[0].Rows.Count > 0 && ds != null)
{
grdnarration.DataSource = ds.Tables[0];
grdnarration.DataBind();
}
}
}