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

GridButtonColumn click runs a changegridsize command

2 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 2
Dan asked on 28 Mar 2014, 01:26 PM
I'm running Q1 2014 UI for ASP.NET.  I have a grid with a GridButtonColumn containing LinkButtons.  The page size is defaulted to 10 rows.
The issue is that if I change the Page Size to 20, and click on the LinkButton for a row greater than 10, the grid runs a changegridsize command setting the grid back to 10 rows instead of running the LinkButtton command.
Is this a bug or do I need to set an option on the grid for this to execute properly?
Dan

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 31 Mar 2014, 06:59 AM
Hi Dan,

I was not able to replicate such an issue at my end. Please have a look at the sample code snippet. Provide your code snippet if necessary.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand">
    <MasterTableView>
        <Columns>
            <telerik:GridButtonColumn HeaderText="ButtonColumn" Text="Button" UniqueName="ButtonColumn"CommandName="ButtonColumn" ButtonType="LinkButton">
            </telerik:GridButtonColumn>
            <telerik:GridBoundColumn UniqueName="ProductID" DataField="ProductID" HeaderText="ProductID">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ProductName" HeaderText="ProductName" UniqueName="ProductName">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

C#:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
  if (e.CommandName.ToString() == "ButtonColumn")
  {
      GridDataItem item = (GridDataItem)e.Item;
      Response.Write(item["ProductID"].Text);
  }
}

Thanks,
Princy

0
Dan
Top achievements
Rank 2
answered on 08 Apr 2014, 02:07 PM
Thanks. This was an old, old page that did not yet have a NeedDataSource method for the data source.  I wired that up, and it's working fine now.

Dan
Tags
Grid
Asked by
Dan
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Dan
Top achievements
Rank 2
Share this question
or