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

[Solved] GridButtonColumn

6 Answers 179 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 16 Jan 2008, 12:46 PM
I use as "GridButtonColumn" to show a column for edit and delete. I want to execute my own actions on clicking on the buttons. The same for build in "Add new record" button. How can I do that?

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 16 Jan 2008, 01:58 PM
Hello Markus,

You can set CommandName to "InitInsert" to achieve this.

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 16 Jan 2008, 02:19 PM
Im sorry but this is not what I want to know. May be my explanation of not so well. I just want to have the"Add new item", "Edit" and "Delete" buttons to execute my own actions instead of the build in ones.
0
Vlad
Telerik team
answered on 16 Jan 2008, 02:44 PM
Hi Markus,

Sorry for this miscommunication.

If you change the CommandName for desired GridButtonColumn you can handle this command in ItemCommand. Here is an example:

<telerik:GridButtonColumn CommandName="MyDelete" ...

ItemCommand:

if(e.CommandName == "MyDelete")
{
    //
}

For the "Add new record" you can define your own CommandItemTemplate where you can add a Button with desired CommandName and again using ItemCommand you can handle this.

Regards,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 17 Jan 2008, 02:16 PM
Thanks! Thas what I need. But now I have another problem. I use follwoing code to hide command in "ButtonCollumn" for special records (rows in grid). This is no more working if I press one of the commands once. Where is the problem?

        If TypeOf e.Item Is GridDataItem Then 
            objDataItem = CType(e.Item, GridDataItem)  
            If CType(objDataItem("CancellationInd").Controls(1), Image).ImageUrl.IndexOf("empty") = -1 Then 
                objDataItem("EditDataColumn").Controls.Clear()  
                objDataItem("CancelDataColumn").Controls.Clear()  
            End If 
 
        End If 
 
0
Vlad
Telerik team
answered on 18 Jan 2008, 12:28 PM
Hi Markus,

Can you try to Rebind() the current table view to see what will be the result? Here is an example:

e.Item.OnwerTableView.Rebind()

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 18 Jan 2008, 01:14 PM
Hello Vlad,

now it is working, thanks for great support!

Regards Markus
Tags
Grid
Asked by
Markus
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Markus
Top achievements
Rank 1
Share this question
or