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

RadButton element Not firing for the First Time

3 Answers 121 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nagaraju
Top achievements
Rank 1
Nagaraju asked on 24 Jan 2012, 01:30 PM
Hi, My requirement is to display the button in the Grid.So in the cellformatting i have added the below code to display button in the cell of the Grid.

RadButtonElement

 

 

radButtonElement = new RadButtonElement();

 

radButtonElement .Click +=

 

new EventHandler(radButtonElement _Click);

 

e.CellElement.Children.Add(radButtonElement );

The problem i am facing is when the Grid is getting filled it is displaying the Button in the Grid.But when i click on it for the first time it is not firing the radButtonElement _Click event. When i click second time it is firing.

Could you suggest me how to fire the click element for the first time only.

3 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 27 Jan 2012, 10:30 AM
Hello Nagaraju,

Thank you for writing.

If you want to have a column with buttons, I would suggest that you use the GridViewCommandColumn. Its purpose is exactly to show a column with buttons and make it easy to handle the button click event. 

I hope this will be useful for you. Should you have further questions I would be glad to assist.

Kind regards,
Ivan Petrov
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

0
Nagaraju
Top achievements
Rank 1
answered on 27 Jan 2012, 11:06 AM
Hai Ivan,

I have to display buttons in the columns based on the condition. For example in a column "X" if the cell value contains greater than 10 then i need to dsiplay a button beside the value in the cell. I dont want entire cell to be a button. Simlilary in other column "Y" if the value is greater than 100 i need to display the button beside the value in the cell.Lastly i need to display imagebutton in the column "Z". So i used  RadButtonElement, and RadImageButtonElement
I am able to display the button but i need to click on the button twice to make the button fire.
I hope U got the requirement. Can i do the same using the  GridViewCommandColumn


Thanks
Nagaraju.
0
Ivan Petrov
Telerik team
answered on 01 Feb 2012, 10:24 AM
Hi Nagaraju,

Thank you for your reply.

The GridViewCommandColumn only contains a button and does not display text next to it. To achieve your scenario, you will have to create a custom column with custom cells. You can read more on that topic on our online documentation under - Creating custom cells. I have also attached a sample project which demonstrates this for your case.

If you have any question on the example or the article, do not hesitate to write back. 

Kind regards,
Ivan Petrov
the Telerik team

SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

Tags
GridView
Asked by
Nagaraju
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Nagaraju
Top achievements
Rank 1
Share this question
or