How to fire an ItemCommand event when a linkbutton clicked in RadGrid

9 posts, 0 answers
  1. Ravi
    Ravi avatar
    6 posts
    Member since:
    Mar 2011

    Posted 08 Mar 2011 Link to this post

    HI, i tried using ItemCommand but it fires for first time and second time no response of the page. I guess i am missing some thing. I have radgrid  shown below. But the item command fires once, i guess i am missing some property.

    Can some one help on this

     

     

     

     

     

    <

     

     

    telerik:RadGrid ID="RadGridEBOList" runat="server" AllowPaging="true" AllowSorting = "true"

     

     

     

    PageSize="15" width="100%" Skin="Office2007" OnItemCommand="RadGridEBOList_ItemCommand" >

     

     

     

    <mastertableview width="100%" autogeneratecolumns="False" ClientDataKeyNames="EBO_ID" >

     

     

     

    <Columns>

     

     

     

    <telerik:GridBoundColumn DataField="EBO_Number" HeaderText="EBO Number" SortExpression="ETI_Number"

     

     

     

    UniqueName="EBO_Number" HeaderStyle-Width="60px">

     

     

     

    <ItemStyle Wrap="False" />

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridBoundColumn DataField="Description" HeaderText="Descriptione" SortExpression="TestProcedure"

     

     

     

    UniqueName="Description" HeaderStyle-Width="80px">

     

     

     

    <ItemStyle Wrap="False" />

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridBoundColumn DataField="Engine_Owner" HeaderText="Engine Owner" SortExpression="Engine_Type"

     

     

     

    UniqueName="Engine_Owner" HeaderStyle-Width="60px">

     

     

     

    <ItemStyle Wrap="False" />

     

     

     

    </telerik:GridBoundColumn>

     

     

     

    <telerik:GridButtonColumn Text="Click here" UniqueName="DownloadColumn" CommandName="Download" HeaderStyle-Width="60px">

     

     

     

    <ItemStyle Wrap="False" />

     

     

     

    </telerik:GridButtonColumn>

     

     

     

    </Columns>

     

     

     

    </mastertableview>

     

     

     

    <PagerStyle Mode="NumericPages"></PagerStyle>

     

     

     

    <ClientSettings EnablePostBackOnRowClick="true" >

     

     

     

     

    </ClientSettings>

     

     

     

     

    </telerik:RadGrid>

     

     

  2. Ravi
    Ravi avatar
    6 posts
    Member since:
    Mar 2011

    Posted 09 Mar 2011 Link to this post

    i Hook the code for Radgrid_itemcommand but it fires once. What i need to do to fire for every click of the link button.

  3. DevCraft banner
  4. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 11 Mar 2011 Link to this post

    Hi Ravi,

    I could not reproduce the described issue. I followed your scenario and prepared a simple project which is working properly. Please check it out and let me know if it helps.

    Best wishes,
    Pavlina
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  5. Ravi
    Ravi avatar
    6 posts
    Member since:
    Mar 2011

    Posted 11 Mar 2011 Link to this post

    The issue is if i do a ExporttoExcel from the ItemCommand Event, first time the excel file downloads but for the next row links i am not able to download the files. In general the itemcommand event happens but if i use the grid exporttoexcel i have problem.

    Below the the CodeBehind

    if

     

     

    (e.CommandName == "Download")

     

     

    {

     

     

     

    GridDataItem item = (GridDataItem)e.Item;

     

     

    RadGridDownloadEBOPart.Visible =

     

    true;

     

     

    RadGridDownloadEBOPart.DataSource = _invEboData.GetEBODetailsToExport(item[

     

    "EBO_Number"].Text);

     

     

    RadGridDownloadEBOPart.DataBind();

     

    RadGridDownloadEBOPart.ExportSettings.ExportOnlyData =

     

    true;

     

     

    RadGridDownloadEBOPart.ExportSettings.IgnorePaging =

     

    true;

     

     

    RadGridDownloadEBOPart.ExportSettings.FileName = item[

     

    "EBO_Number"].Text;

     

     

    RadGridDownloadEBOPart.MasterTableView.ExportToExcel();


    }
    --Ravi
  6. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 11 Mar 2011 Link to this post

    Hello Ravi,

    Try setting the EnablePostBackOnRowClick property to true and see if it makes any difference:
    <ClientSettings EnablePostBackOnRowClick="true">

    All the best,
    Pavlina
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  7. Ravi
    Ravi avatar
    6 posts
    Member since:
    Mar 2011

    Posted 11 Mar 2011 Link to this post

    If you see from html code it has set to True

    <ClientSettings EnablePostBackOnRowClick="true"
    </ClientSettings>

  8. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 17 Mar 2011 Link to this post

    Hello Ravi,

    Can you try replicating the issue in the attached sample? Let me know if I missed something from your logic there.

    All the best,
    Iana
    the Telerik team
  9. Rk.MooRthy(DLL Version : 2008.3.1314.35)
    Rk.MooRthy(DLL Version : 2008.3.1314.35) avatar
    21 posts
    Member since:
    Jun 2013

    Posted 24 Jul 2013 Link to this post

    The same problem is for me also.. Can anyone help me..?

    Thanks
    --Rk.MooRthy
  10. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 29 Jul 2013 Link to this post

    Hello Rk.MooRthy,

    As my colleague Iana asked in the previous post - Can you replicate the issue in the sample she attached?

    Regards,
    Pavlina
    Telerik
    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 the blog feed now.
Back to Top
DevCraft banner