This is a migrated thread and some comments may be shown as answers.
RadAlert Mutliple Alerts with Buttons
1 Answer 9 Views
This is a migrated thread and some comments may be shown as answers.
Danny
Top achievements
Rank 1
Danny asked on 08 Aug 2017, 01:00 AM

I am trialing RadDesktopAlert for a new system I am developing, and considering purchasing radcontrol for WinForms. I have used RadControls for the web before. 

 

I have created a RadDesktopAlert and it appears to work quit well. I create the RadDesktopAlert in code and added 2 buttons behind it. I can run code from those buttons without any issues. However I need to pass an ID into the RadDesktopAlert , that I can access when pressing these buttons. 

 

Is there a way I can pass a variable, does as a unique string into the RadDesktopAlert that I can read when pressing one of these buttons?

 

Many Thanks

 

 

 

        private void rbeRequest_Click(object sender, EventArgs e)
        {
            Console.WriteLine("code test here");
            // I need to get a value specific to the rad alert here. 
        }

 

 

 

      // create the RadDesktopAlert
            RadDesktopAlert radDA = new RadDesktopAlert();
           

                //declare the buttons. 
                RadButtonElement rbeRequest = new RadButtonElement();
                RadButtonElement rbeAdministrator = new RadButtonElement();

                rbeRequest.Name = "test1";
              
                //assign code to each button that runs. 
                rbeRequest.Click += rbeRequest_Click;
                rbeAdministrator.Click += rbeAdministrator_Click;

               
                
                //set padding around the buttons to make them a little bigger. 
                rbeAdministrator.Padding = new System.Windows.Forms.Padding(5);
                rbeRequest.Padding = new System.Windows.Forms.Padding(5);

                //apply a lable to the buttons
                rbeAdministrator.Text = "My Administrator is Present";
                rbeRequest.Text = "Request Permission";

                //add the buttons to the DesktopAlert component. 
                radDA.ButtonItems.AddRange(new Telerik.WinControls.RadItem[] {
                rbeRequest,
                rbeAdministrator});
            }

            //apply text. 
            radDA.CaptionText = "caption text goes here";
            radDA.ContentText = "content text goes here"   ;
        
            //show the alert. 
            radDA.Show();
        }

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 08 Aug 2017, 06:13 AM
Hello Danny,

You can use the Tag property of the alert's popup. For example, you can set it like this:
RadDesktopAlert radDA = new RadDesktopAlert();
radDA.Popup.Tag = "MyID";

Then you can get in in the event handler:
private void rbeRequest_Click(object sender, EventArgs e)
{
    var button = sender as RadButtonElement;
    var popup  = button.ElementTree.Control as DesktopAlertPopup;
    var id = popup.Tag;
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Asked by
Danny
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or