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

RadMessageBox Details Button

2 Answers 299 Views
MessageBox
This is a migrated thread and some comments may be shown as answers.
eusouleon
Top achievements
Rank 1
eusouleon asked on 11 Aug 2017, 07:33 PM
In C#, how can I show the Details text of the RadMessageBox control without requiring user to click the Details button (to drop down the details). Thank you.

2 Answers, 1 is accepted

Sort by
0
eusouleon
Top achievements
Rank 1
answered on 11 Aug 2017, 10:44 PM
I just want it to show the details right away. No need click 'Details' dropdown button... anyone? thanks!
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 14 Aug 2017, 06:40 AM
Hello Rene, 

Thank you for writing.  

Here is a sample code snippet demonstrating how to show the message details immediately after the RadMessageBox is shown: 
private void radButton1_Click(object sender, EventArgs e)
{
    RadMessageBox.Instance.Shown -= Instance_Shown;
    RadMessageBox.Instance.Shown += Instance_Shown;
    RadMessageBox.Show("Message", "Caption", MessageBoxButtons.OKCancel, RadMessageIcon.Info, "Details");
}
 
private void Instance_Shown(object sender, EventArgs e)
{
    MethodInfo mi = typeof(RadMessageBoxForm).GetMethod("ShowDetails", BindingFlags.NonPublic | BindingFlags.Instance);
    mi.Invoke(RadMessageBox.Instance, null);
}

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
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.
Mark
Top achievements
Rank 2
Bronze
Iron
Veteran
commented on 13 Jun 2023, 11:53 AM

I have basically done as explained above, but my details pain never opens automatically. 


MethodInfo mi = typeof(RadMessageBoxForm).GetMethod("ShowDetails", BindingFlags.NonPublic | BindingFlags.Instance);
mi is always NULL, so it is not finding the "ShowDetails" method.  Has the method name changed since this was sugguestion was made?
Mark
Top achievements
Rank 2
Bronze
Iron
Veteran
commented on 13 Jun 2023, 12:06 PM

It looks as it has changed, I had to make change to the Event Handler. This is how I got it to work.

      private void HandleRadMessageBoxInstanceShown(object sender, EventArgs e)
      {
         if (sender is RadMessageBoxForm mb)
         {
            if (!string.IsNullOrEmpty(mb.DetailsText))
            {
               mb.ShowDetails();
            }
         }
      }

Dess | Tech Support Engineer, Principal
Telerik team
commented on 16 Jun 2023, 05:48 AM

Hi, Mark,

I am glad that you succeeded to get the message box working in the desired way. Indeed, there was in improvement during the 6 years versions gap and now the ShowDetails method is public. 

Tags
MessageBox
Asked by
eusouleon
Top achievements
Rank 1
Answers by
eusouleon
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or