This is a migrated thread and some comments may be shown as answers.

Displaying checked items as alert.

1 Answer 22 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Anly
Top achievements
Rank 1
Anly asked on 04 Apr 2013, 08:17 AM
Hello,

There is a RadCombobox with check-boxes enabled in my project. There is another RadButton and on server side clicking the button, I want to display an alert that contains the checked item text from the RadCombobox for ex "You have selected Item1, Item2". Please help me with any sample solution.

Thanks in advance,
Anly.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 04 Apr 2013, 11:55 AM
Hi Anly,

Please check the following sample C# code.

C#:
protected void RadButton1_Click(object sender, EventArgs e)
{
    string selectedItems=string.Empty;
    string alert;
    foreach (var items in RadComboBox1.CheckedItems)
    {
        selectedItems = selectedItems + items.Text + ", ";   
    }
    alert = "You have Checked " + selectedItems;
    Page.ClientScript.RegisterStartupScript(this.GetType(), "click", "alert('"+alert+"');", true);
}

Thanks,
Princy.
Tags
ComboBox
Asked by
Anly
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or