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

user control pop up on gridview

4 Answers 360 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lily
Top achievements
Rank 1
Veteran
Lily asked on 03 Oct 2019, 09:07 PM

Hi I'm trying to figure out how to get a messagebox or dialog to popup which I click on a cell in my gridview. Inside the popup will be 3 radiobutton to change which is what will determine what is show in that cell and a save button to save the change.  I've been looking online, and I came across a recommendation to use user control. I've created a user control with the layout done, but I'm not sure how to bind it to cell on my gridview and how to control the function of the clicks inside the user control.  I've attached what I would like it to look like below:

 

 

 

4 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Oct 2019, 12:27 PM
Hello, Lily,    

According to the provided information I suppose that the following KB article will fit perfectly to your scenario: https://www.telerik.com/support/kb/winforms/gridview/details/create-pop-up-user-control-for-row-editing

You can use a similar approach for achieving your goal.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Lily
Top achievements
Rank 1
Veteran
answered on 04 Oct 2019, 01:03 PM

So in this example, its telling me to use a RadDropDownButton.  If I want to have it popup when I click the already gridview existing process row cell or the text in that cell.  What do I need to replace the RadDropDownButton part below with? My column for the the process column was created thru the PropertyBuilder with data source to the table view in my sql server as GridViewTextBoxColumn.

Their example:

            protected override void CreateChildElements()
            {
                base.CreateChildElements();
                this.button = new RadDropDownButtonElement();
                this.button.Text = "Click For Edit";
                this.Children.Add(button);
                this.button.Items.Add(CreateDropDownButton());

                //subscribe for RadDropDownButtonClick event
                this.button.Click += new EventHandler(button_Click);

                //subscribe for UserControl's saveButton click event
                RadButton saveButton = (RadButton)userControl.Controls["saveButton"];
                saveButton.Click += new EventHandler(saveButton_Click);
            }

0
Lily
Top achievements
Rank 1
Veteran
answered on 04 Oct 2019, 01:08 PM

Oops...

missed some... 

Their example should be:

 public class CustomCell : GridDataCellElement
        {
            private RadDropDownButtonElement button;
            private UserControl1 userControl;

            public CustomCell(GridViewColumn column, GridRowElement row) : base(column, row)
            {
            }

            protected override void CreateChildElements()
            {
                base.CreateChildElements();
                this.button = new RadDropDownButtonElement();
                this.button.Text = "Click For Edit";
                this.Children.Add(button);
                this.button.Items.Add(CreateDropDownButton());

                //subscribe for RadDropDownButtonClick event
                this.button.Click += new EventHandler(button_Click);

                //subscribe for UserControl's saveButton click event
                RadButton saveButton = (RadButton)userControl.Controls["saveButton"];
                saveButton.Click += new EventHandler(saveButton_Click);
            }

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Oct 2019, 01:51 PM
Hello, Lily,    

The provided approach uses a custom GridDataCellElement which is created in the RadGridView.CreateCell event. You can subscribe to this event at design time as well via the Properties section in Visual Studio. Otherwise, you can add the column programatically at run time after subscribing t the event. 

If you are still experiencing any further difficulties, feel free to submit a support ticket from your Telerik account and provide a sample project demonstrating the undesired behavior that you are facing. Thus, our support staff would be able to further investigate the precise case and gladly assist you.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Lily
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Lily
Top achievements
Rank 1
Veteran
Share this question
or