Custom select/edit function

4 posts, 0 answers
  1. John
    John avatar
    11 posts
    Member since:
    Mar 2015

    Posted 19 May 2015 Link to this post

    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?

  2. Eyup
    Admin
    Eyup avatar
    3320 posts

    Posted 22 May 2015 Link to this post

    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
  3. John
    John avatar
    11 posts
    Member since:
    Mar 2015

    Posted 22 May 2015 in reply to Eyup Link to this post

    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

  4. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1784 posts

    Posted 27 May 2015 Link to this post

    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
Back to Top