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

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

8 Answers 350 Views
Quick Fixes
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ravi
Top achievements
Rank 1
Ravi asked on 08 Mar 2011, 09:47 PM
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>

 

 

8 Answers, 1 is accepted

Sort by
0
Ravi
Top achievements
Rank 1
answered on 09 Mar 2011, 02:36 PM
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.

0
Pavlina
Telerik team
answered on 11 Mar 2011, 02:04 PM
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!
0
Ravi
Top achievements
Rank 1
answered on 11 Mar 2011, 04:13 PM
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
0
Pavlina
Telerik team
answered on 11 Mar 2011, 04:34 PM
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!
0
Ravi
Top achievements
Rank 1
answered on 11 Mar 2011, 04:43 PM
If you see from html code it has set to True

<ClientSettings EnablePostBackOnRowClick="true"
</ClientSettings>

0
Iana Tsolova
Telerik team
answered on 17 Mar 2011, 12:09 PM
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
0
answered on 24 Jul 2013, 11:13 AM
The same problem is for me also.. Can anyone help me..?

Thanks
--Rk.MooRthy
0
Pavlina
Telerik team
answered on 29 Jul 2013, 08:31 AM
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.
Tags
Quick Fixes
Asked by
Ravi
Top achievements
Rank 1
Answers by
Ravi
Top achievements
Rank 1
Pavlina
Telerik team
Iana Tsolova
Telerik team
Share this question
or