public string GetCallbackResult()
{
StringBuilder SB = new StringBuilder();
bool bFrom;
int iSelected;
string sSplit = _Split;
Array arrReturn;
char[] cIndexOf = { '!' };
StringWriter sWriteTo = new System.IO.StringWriter();
HtmlTextWriter htmlWriterTo = new HtmlTextWriter(sWriteTo);
StringWriter sWriteFrom = new System.IO.StringWriter();
HtmlTextWriter htmlWriterFrom = new HtmlTextWriter(sWriteFrom);
arrReturn = _cb_Return.Split(cIndexOf);
iSelected = Convert.ToInt32(arrReturn.GetValue(0).ToString().Trim());
bFrom = Convert.ToBoolean(arrReturn.GetValue(1).ToString().Trim());
getDT_Hidden(arrReturn.GetValue(2).ToString().Trim(),
arrReturn.GetValue(3).ToString().Trim(),
arrReturn.GetValue(4).ToString().Trim(),
arrReturn.GetValue(5).ToString().Trim());
onClickFromTo(bFrom,iSelected );
ListBoxTo.RenderControl(htmlWriterTo);
ListBoxFrom.RenderControl(htmlWriterFrom);
SB.Append(FindControl(divListBoxTo.ID).ClientID);
SB.Append(sSplit);
SB.Append(sWriteTo.ToString());
SB.Append(sSplit);
SB.Append(FindControl(divListBoxFrom.ID).ClientID);
SB.Append(sSplit);
SB.Append(sWriteFrom.ToString());
SB.Append(sSplit);
SB.Append(this.Parent.ID + "." +
FindControl(ListBoxFrom.ID).ClientID);
SB.Append(sSplit);
SB.Append(this.Parent.ID + "." +
FindControl(ListBoxTo.ID).ClientID);
SB.Append(sSplit);
SB.Append(this.Parent.ID + "." +
FindControl(HiddenFromText.ID).ClientID);
SB.Append(sSplit);
SB.Append(this.Parent.ID + "." +
FindControl(HiddenFromValue.ID).ClientID);
SB.Append(sSplit);
SB.Append(this.Parent.ID + "." +
FindControl(HiddenToText.ID).ClientID);
SB.Append(sSplit);
SB.Append(this.Parent.ID + "." +
FindControl(HiddenToValue.ID).ClientID);
return SB.ToString();
}
private void onClickFromTo(bool clickFrom,int iSelected)
{
ListBox lb;
DataTable dtFrom;
DataTable dtTo;
int iItemsList = 0;
int iCount = 0;
int iCountHelp = 0;
if (clickFrom)
{
lb = ListBoxFrom;
dtFrom = _DT_In;
dtTo = _DT_Out;
}
else
{
lb = ListBoxTo;
dtFrom = _DT_Out;
dtTo = _DT_In;
}
iItemsList = dtFrom.Rows.Count;
for (iCount = 0; iCount < iItemsList; iCount++)
{
if (iCount == iSelected)
{
DataRow dr;
dr = dtTo.NewRow();
dr[0] = dtFrom.Rows[iCount - iCountHelp][0];
dr[1] = dtFrom.Rows[iCount - iCountHelp][1];
dtTo.Rows.Add(dr);
dtFrom.Rows[iCount - iCountHelp].Delete();
iCountHelp = iCountHelp + 1;
}
}
if (clickFrom)
{
_DT_In = dataTable_Sort(dtFrom.Copy());
_DT_Out = dataTable_Sort(dtTo.Copy());
}
else
{
_DT_Out = dataTable_Sort(dtFrom.Copy());
_DT_In = dataTable_Sort(dtTo.Copy());
}
buildListBox(ListBoxFrom, _DT_In);
buildListBox(ListBoxTo, _DT_Out);
}