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

Custom select/edit function

3 Answers 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 19 May 2015, 01:04 PM

Select button example

I am looking to do something similar to this example but instead, I want a button or link in a column to fire an event which opens up the record for editing.

Clicking the row fires a selected index changed which does something else.

 The closest thing I have found is something like this:

Event DataGridView1ButtonClick(sender As DataGridView, e As DataGridViewCellEventArgs)
 
Private Sub DataGridView1_CellContentClick(sender As System.Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
    Dim senderGrid = DirectCast(sender, DataGridView)
    If TypeOf senderGrid.Columns(e.ColumnIndex) Is DataGridViewButtonColumn AndAlso e.RowIndex >= 0 Then
        RaiseEvent DataGridView1ButtonClick(senderGrid, e)
    End If
End Sub
Is this possible with the RadGrid?

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 22 May 2015, 08:04 AM
Hello John,

I would suggest that you check the following samples:

1. PopUp edit mode provided by RadGrid:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/edit-form-types/defaultcs.aspx


2. RadWindow:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=window
http://demos.telerik.com/aspnet-ajax/window/examples/internalcontent/defaultcs.aspx


3. RadToolTip:
https://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx?product=tooltip

Based on your chosen controls integration we can proceed further with the requirement.


Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
John
Top achievements
Rank 1
answered on 22 May 2015, 03:25 PM

Very nice examples. In the end I got rid of the function using "onSelectIndexChanged" and used an ItemCommand event to catch the button clicked in the row.

 

    protected void RadGridPersons_ItemCommand(object sender, GridCommandEventArgs e)
        {

            switch (e.CommandName)
            {

                case "ViewPerson":

                    int ident = Convert.ToInt32(e.Item.Cells[2].Text);

 

// do other stuff like show a modal pop up div control

0
Viktor Tachev
Telerik team
answered on 27 May 2015, 10:03 AM
Hi John,

Thank you for sharing your solution with the community. This can help someone that would like to implement similar functionality.


Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Eyup
Telerik team
John
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or