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

[Solved] problem refreshing Grid after Update command

2 Answers 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
K
Top achievements
Rank 1
K asked on 11 Aug 2009, 09:34 PM
Hello,
I am using Radgrid to edit data. The Editmode is set to 'Inplace' and wants to allow multirow selection.  I have several questions:
1)  debuger never goes to ItemUpdated handler, it goes to ItemCreated and ItemCommand but never goes to Itemupdated, ItemCreated etc handlers.

2) In my Itemcommand event I have written following code:

 

Dim testId As Int16

 

testId = 

CInt(e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("id"))

 

 

Select Case e.CommandName.ToLower()

 

 

 

Case "edit"

 

 

 

RGChoiceItems.EditIndexes.Add(e.Item.ItemIndex)

 

 

 

 

Case "cancel" 

 

RGChoiceItems.EditIndexes.Clear()

 

 

Case "update" 

 

If UpdateTest(False, e) Then

 

 

 

msg.ShowOK("Updated")
End If

 

 

 

 

 

 

 

End Select 

 

 

LoadChoiceGroupTypeItems()

But it never clears the Edit mode even if the data gets updated. UpdateTest() methods works well. I want to do axactly as your first example grid but it is never gets rid of edit mode..I have to refresh the page again!

3) whereas, Cancel button moves the grid in normal mode again but problem with cancel is when I cancel 1 row it cancels all other rows in edit mode.
any idea what I am missing?

 

 

 

 

 

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
K
Top achievements
Rank 1
answered on 11 Aug 2009, 09:44 PM

 

Here is my HTML code:
<
radA:AjaxLoadingPanel ID="RadLoadingPanel1" runat="server" Transparency="5" IsSticky="false">

 

 

<asp:Image ID="imgUpdating" runat="server" AlternateText="Updating..." />

 

 

</radA:AjaxLoadingPanel>

 

 

<radG:RadGrid ID="RGChoiceItems" allowMultiRowEdit="True" AllowMultiRowSelection="True" Skin="Office2007"

 

 

GridLines="None" EnableAJAX="true" runat="server" PageSize="10" AllowPaging="True" AutoGenerateColumns="False">

 

 

<HeaderStyle CssClass="BVSmallText" Font-Bold="True" />

 

 

<ItemStyle CssClass="ItemStyle" VerticalAlign="Top" />

 

 

<AlternatingItemStyle CssClass="AlternateItemStyle" VerticalAlign="Top"/>

 

 

<PagerStyle Mode="NextPrevAndNumeric" />

 

 

<MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" EditMode="InPlace" DataKeyNames="Id" HorizontalAlign="NotSet" >

 

 

<Columns>

 

 

<radG:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" UpdateImageUrl="~\RadControls\Grid\Skins\Update.gif"

 

 

EditImageUrl="~\RadControls\Grid\Skins\Edit.gif" InsertImageUrl="~\RadControls\Grid\Skins\Update.gif" CancelImageUrl="~\RadControls\Grid\Skins\Cancel.gif">

 

 

<ItemStyle CssClass="MyImageButton" />

 

 

</radG:GridEditCommandColumn>

 

 

 

<radG:GridBoundColumn HeaderText="Display Text" UniqueName="Text" MaxLength="50" DataField="DisplayText">

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

<HeaderStyle HorizontalAlign="Left" />

 

 

</radG:GridBoundColumn>

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

</radG:RadGrid>

 

 

<radA:RadAjaxManager ID="radManager" runat="server" EnableOutsideScripts="true">

 

 

<AjaxSettings>

 

 

<radA:AjaxSetting AjaxControlID="RGChoiceItems">

 

 

<UpdatedControls>

 

 

<radA:AjaxUpdatedControl ControlID="RGChoiceItems" LoadingPanelID="RadLoadingPanel1"/>

 

 

 

</UpdatedControls>

 

 

</radA:AjaxSetting>

 

 

</AjaxSettings>

 

 

</radA:RadAjaxManager>

 

0
Shinu
Top achievements
Rank 2
answered on 12 Aug 2009, 05:23 AM
Hi,

1)The ItemUpdated/ItemInserted/ItemDeleted events are raised only with automatic operations enabled.

2) After doing the Update operation try clearing the Edit items using the following line of code

VB:
 
RGChoiceItems.MasterTableView.ClearEditItems();  

3)Cancel button normally cancels all the rows which are in edit mode. Try the following code snippet in the ItemCommand event to
prevent the default behavior and cancel only the clicked row.

VB:
 
 
   If e.CommandName = "Cancel" Then 
       e.Item.Edit = False 
   End If 


Thanks
Shinu

Tags
Grid
Asked by
K
Top achievements
Rank 1
Answers by
K
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or