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

[Solved] EditCommandColumn

3 Answers 164 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 04 Nov 2009, 02:22 PM
Hi,

I would like to run my own code in the OnEditCommand event for my Grid, but it always seems to
run the InPlace default form editing as well.  I am using GridButtonColumn, CommandName=Edit

I would like HeaderText = Edit, Link = Edit, and run my code in OnEditCommand event.

Eg.

Protected

 

Sub doEdit(ByVal Sender As Object, ByVal E As Telerik.Web.UI.GridCommandEventArgs)

 

 

If E.CommandName.ToUpper = "EDIT" Then

 

' -- run my code here

End If

 

 

End Sub

But as I said, the InPlace grid editing runs as well.  How do I disable this?

Cheers,
DGL

 

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 04 Nov 2009, 03:17 PM
Hello David,

Could you please provide more information about the desired functionality? If I understand you properly, you can either use your own command name or set e.Canceled="true" to cancel the default edit mode.

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
David
Top achievements
Rank 1
answered on 04 Nov 2009, 03:38 PM
Hi Daniel,

I have the following column defined:

 

<telerik:GridButtonColumn HeaderText="Edit" CommandName="Edit" Reorderable="False" Resizable="False" Text="Edit">

 

 

 

</telerik:GridButtonColumn>

And the event:

 

Protected

 

Sub doEdit(ByVal Sender As Object, ByVal E As Telerik.Web.UI.GridCommandEventArgs)

 

 

 

If E.CommandName.ToUpper = "EDIT" Then

 

 

 

 

 

 

 

    'E.Canceled = True

 

 

 

 

 

 

 

    Dim itm As Telerik.Web.UI.GridDataItem = DirectCast(E.Item, Telerik.Web.UI.GridDataItem)

 

    lblDebug.Text =

 

String.Format("Command Name: {0} -- {1}", E.CommandName, itm.OwnerTableView.DataKeyValues(itm.ItemIndex) ("CODE").ToString())

 

 

 

End If
End Sub

It runs the code in doEdit, but it also puts the Grid in the default edit mode (InPlace or EditForms, I don't know which it is) as well.  I do NOT want this, I only want to run the code in doEdit.  E.Canceled=True works, but it still runs the edit then immediately cancels it.  I know this because my columns become squeezed when I press the Edit link.

I hope I am making myself clear this time.  If I were to use just the asp.net GridView control, the behaviour would be exactly what I want.

Cheers,
DGL

*** EDIT ***

I think I solved the edit mode problem.  I should have been using OnItemCommand instead of OnEditCommand.  However, I still have the problem of the columns condensing when I click the link.  Any idea what the issue could be?  The Grid's width is set to 100%, columns expand to fit, but when I click the link, columns squeeze to about 60% and just a bunch of space after the last column.







 

 

 

 

 

0
Martin
Telerik team
answered on 11 Nov 2009, 12:39 PM
Hello David,

I tried to reproduce the "column condensing" issue using a RadGrid from our latest release (Q3 2009) but without success. You can facilitate us by sending the markup declaration of your RadGrid. Additionally please verify whether you can reproduce the issue under different browsers.

Regards,
Martin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Daniel
Telerik team
David
Top achievements
Rank 1
Martin
Telerik team
Share this question
or