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

[Solved] ButtonColumn Click event doesnt fire in RadGrid with WCF DataBinding

2 Answers 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 14 May 2013, 09:42 AM
Hi,

I have a ButtonColumn into a RadGrid with WCF client binding and I have activated the EnablePostBackOnRowClick, but the event doesn't fire when I click the button. What am i doing wrong? Thank you.

This is the event handler into the .cs file:
protected void ColEditar_Click(object sender, EventArgs e)
        {
            //Event code goes here
        }


I also got a RadAjaxManager:
<telerik:RadAjaxManager ID="RadAjaxManager" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RgNoticias">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RgNoticias"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>


And finally, my grid code:
<telerik:RadGrid ID="RgNoticias" runat="server" AllowPaging="True" AllowSorting="True"
    PageSize="10"  AutoGenerateColumns="False"
    GridLines="None"    
        EnableViewState="False">
        <MasterTableView >
            <Columns>
                <telerik:GridButtonColumn UniqueName="ColEditar" CommandName="ColEditar_Click" Text="Editar">
                </telerik:GridButtonColumn>               
            </Columns>
            <SortExpressions >
                <telerik:GridSortExpression FieldName="FechaAlta" SortOrder="Descending" />
            </SortExpressions>
        </MasterTableView>
 
    <ClientSettings EnablePostBackOnRowClick="true">
        <DataBinding SelectMethod="ObtenerNoticias"  Location="http://localhost/service.svc/rest/"
        sortparametertype="Linq" filterparametertype="Linq">
        </DataBinding>
    </ClientSettings>
    </telerik:RadGrid>

2 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 17 May 2013, 02:45 PM
Hello Daniel,

This is not an expected behavior when the button is clicked the server-side event should fire. In order to resolve the problem I suggest that you disable the AJAX and test whether the event gets fired. Also since you are using client-side data-binding I suggest that you handle the button click by subscribing to the OnCommand client event:

ASPX
<ClientSettings>
             <ClientEvents OnCommand="GridCommandHandler" />
         </ClientSettings>

JavaScript
function GridCommandHandler(sender,args) {
 
        }

If the given suggestions do not prove helpful please elaborate more on your requirements and scenario so we could advice you with the best possible option.

All the best,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Daniel
Top achievements
Rank 1
answered on 20 May 2013, 07:05 AM
Hello Angel,

Thank you for your help, but I've changed my code in order to use Server-Side Binding and my problems are gone. Thanks again.

Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or