protected Dictionary
{
get
{
if (dicSelectedDissections == null)
{
if (Session["SelectedDissectionIds"] != null)
{
dicSelectedDissections = (Dictionary
}
else
{
dicSelectedDissections = new Dictionary
}
}
return dicSelectedDissections;
}
set
{
dicSelectedDissections = value;
Session["SelectedDissectionIds"] = value;
}
}
//Handle area
private void UpdateSeletedtoDissectionList()
{
try
{
foreach (GridViewRow row in gvDissections.Rows)
{
if (((CheckBox)row.Cells[0].Controls[1]).Checked)
{
if (!DicSelectedDissections.ContainsKey(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString())))
{
DicSelectedDissections.Add(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString()), "");
}
if (DicSelectedDissections.ContainsKey(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString())))
{
DicSelectedDissections.Remove(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString()));
DicSelectedDissections.Add(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString()), "");
}
if (DicDeletedDissection.ContainsKey(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString())))
{
DicDeletedDissection.Remove(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString()));
}
}
else
{
if (!DicDeletedDissection.ContainsKey(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString()))
&& DicSelectedDissections.ContainsKey(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString())))
{
DicDeletedDissection.Add(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString()),"");
}
if (DicSelectedDissections.ContainsKey(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString())))
{
DicSelectedDissections.Remove(Int32.Parse(gvDissections.DataKeys[row.RowIndex]["DissectionId"].ToString()));
}
}
}
Session["SelectedDissectionIds"] = DicSelectedDissections;
Session["DeletedDissectionIds"] = DicDeletedDissection;
}
No comments:
Post a Comment