Hi Brij
I used a combination of your code and something to handle if it is a postback.
Seems to do the job but there might be a slicker way.
Thanks anyway.
Cheers
Peter
if (!IsPostBack)
{
DropDownList3.Items.Add(new ListItem("-", "-"));
if (callDetails.DataKey["SOURCE_REFERENCE"] != "")
{
DropDownList3.Items.Add(new ListItem("Source", callDetails.DataKey["SOURCE_REFERENCE"].ToString()));
Label10.Text = DropDownList3.SelectedValue.ToString();
}
if (callDetails.DataKey["SUBJECT_REFERENCE"] != "")
{
DropDownList3.Items.Add(new ListItem("Subject", callDetails.DataKey["SUBJECT_REFERENCE"].ToString()));
Label10.Text = DropDownList3.SelectedValue.ToString();
}
if (callDetails.DataKey["REFERENCE"] != "")
{
DropDownList3.Items.Add(new ListItem("3rd Party", callDetails.DataKey["REFERENCE"].ToString()));
Label10.Text = DropDownList3.SelectedValue.ToString();
}
}
if (IsPostBack)
{
if (callDetails.DataKey["SOURCE_REFERENCE"] != "")
{
Label10.Text = DropDownList3.SelectedValue.ToString();
}
if (callDetails.DataKey["SUBJECT_REFERENCE"] != "")
{
Label10.Text = DropDownList3.SelectedValue.ToString();
}
if (callDetails.DataKey["REFERENCE"] != "")
{
Label10.Text = DropDownList3.SelectedValue.ToString();
}
}