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

ItemCommand event fired only once

5 Answers 374 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SKY
Top achievements
Rank 1
SKY asked on 13 Aug 2010, 08:11 PM
Hi...
i am new to Telerik, so in lots of trouble.

I need to implement one scneraio using telerik radgrid and update panel. Please guide me on this.

I am having 4 grid on my page. I have kept each of the grid under separate update panel. Each one contains select link button (as GridButtonColumn where i have given the commandName as Select); Now on click of every grid's link button, i have to load other grids which are there in other update panels.
I thought of writing the asynchronous trigger where the control name will be the link button and there is no other condition on which this will be updated. I am doing something in itemCommand event, but when i was running the application, the link button click for the first grid was working for the firt time.. then onwards it was not working. Is there any way i can implement this so that all the grid will not be loaded on selection of row for one of the grids.

its very urgent, so please guide me asap.

 

<asp:UpdatePanel runat="server" ID="upnlASMTClassAndPropertyUse" UpdateMode="Conditional" ChildrenAsTriggers="false">

 

 

<ContentTemplate>

<

 

telerik:RadGrid ID="grdTest" runat="server" EnableViewState="true" DataSourceID="odsTest" GridLines="Both" BorderWidth="0px" ShowHeader="true" CssClass="GridLayout" OnItemCommand="grdTest_ItemCommand" OnItemDataBound="grdTest_ItemDataBound">

 

 

<MasterTableView DataSourceID="odsTest" ShowHeader="true" AutoGenerateColumns="false" >

 

 

<Columns>

 

 

<telerik:GridButtonColumn Text="Select" UniqueName="lbtnSelect" CommandName="Select" ButtonType="LinkButton" >

 

 

 

 

</telerik:GridButtonColumn>

 

....... some columns


</
Columns>

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

 

 

</ContentTemplate>

 

 

</asp:UpdatePanel>

 

 

 

Similarly three other grids are there

when i tried using the triggers like this:

 

<Triggers>

<asp:AsyncPostBackTrigger ControlID="lbtnSelect" EventName="Click"/>

</Triggers>

 

 

Then, it was giving some error  ------ A control with ID 'lbtnSelect' could not be found for the trigger in UpdatePanel


Please guide me how to implement this approach using updatepanel?

5 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 13 Aug 2010, 08:47 PM
Hello Sky,

If set the CommandName to Select then you should be handling the SelectedIndexChanged event of the RadGrid, not the ItemCommand event. Also, you should change you postback trigger to something like this:

<asp:AsyncPostBackTrigger ControlID="grdTest" EventName="SelectedIndexChanged"/>

It uses the grid as the control since it raises the event, not the button.

I hope that helps.

0
SKY
Top achievements
Rank 1
answered on 13 Aug 2010, 10:10 PM
Hi Cori,

Thanks for your reply.
I tried with the same approach previously, but in that case also it was firing the selectedIndexChanged event only once.
I have kept my first grid in an update panel with mode set to conditional, but there are no triggers for this update panel.
For the second grid again, update panel with mode set to conditional, but this time asyncPostBackTrigger is there based on the first grid selectedindexchanged event.

Is it happening because there are no triggers set for the first grid even though mode is set to conditional?
All the events are working for the first time only, next time clicking inside the grid or on the select link button does nothing.
Please guide me.
0
Maria Ilieva
Telerik team
answered on 20 Aug 2010, 08:20 AM
Hi,

Could you please test to set triggers for the first grid and verify what the result is? Also I would suggest you to revise the option for using single RadAjaxManager on the page instead of several UpdatePanels.


Greetings,
Maria Ilieva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Neerav
Top achievements
Rank 1
answered on 02 Dec 2010, 12:19 PM

Dear Telerik staff,
I have a empty "RadGrid1" and hyper links "A","ALL"...  on default.aspx page.
 On click of "ALL" I have opened a new window pop up using  "RadWindow" with radopen = ("default.aspx", radwindowID) method. This will pop up the window on same(default.aspx) page. Now this radwindow is defined on default.aspx page with a another radgrid "radgrid2" in it using content template tags of radwindow. The radgrid2 also has a template column with command = "move to selected" which on click will move the corresponding row from radgrid2 to radgrid1 and hide that row in radgrid2. This process can fill up radgrid1(which was empty). The radgrid2 has "onitemcommand  = "radgrid1_itemcommand"" property set to handle click event from template column (command name = "move to selected"), this property  has logic for hiding row in radgrid2 and moving row to radgrid1.

Now I have been able to open the window on same page with radgrid2 in it with template column "+" in it.
The page get loads and all GUI gets displayed properly along with radgrid1 and links. WHen I click "ALL" the radwindow gets pop up with data filled radgrid2 with template column "+" in it.
 The problem is, when I click "+" i.e. template column for first time the "radgrid1_itemcommand" method does not get fired. But from second click onwards the command gets fired and all workds well (i.e. rows get move to radgrid1 from radgrid2).
On click of template column the radgrid1_itemcommand does not gets fired for first time and because of that, the row does not get move from radgrid2 to radgrid1  only for first time. BUt ll works on and after second click on template column.

PFA the images of my current scenario where "Radgrid_image1" is image where I click on "+" for first time and nothing happens and "radgrid_image2" is image where the row moves to radgrid1 and get hidden in radgrid2.

 Ihave used following

 

<telerik:RadAjaxManager runat="server" ID="radAjax" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid2">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid2"/>
<telerik:AjaxUpdatedControl ControlID="RadGridfirst" />

</UpdatedControls>
</telerik:AjaxSetting>
</telerik:RadAjaxManager>

Important thing that when I comment the above ajax setting code, all start to work well even for firts time i.e. rows gets shifted from from first click on template column. But this process closes the radwindow every time the template column getsclicked, so I have to click "ALL" again for opning the radwindow which is not at all my requirement.

Kindly reply

Thanks and Regards

 

0
Maria Ilieva
Telerik team
answered on 07 Dec 2010, 12:55 PM
Hi Neerav,

Could you please try setting the RadWindow as updated control into your RadAjaxManager settings? If this does not help please open a regular support ticket and send us sample runnable application along with the detailed steps for its replication. Thus we will be able to test it locally,  revise the Ajax setting and advise you further.


Best wishes,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
SKY
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
SKY
Top achievements
Rank 1
Maria Ilieva
Telerik team
Neerav
Top achievements
Rank 1
Share this question
or