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

Change text of edit button in detail table after update

6 Answers 199 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amy
Top achievements
Rank 1
Amy asked on 08 Oct 2010, 07:50 PM
Is it possible to change the text of the 'edit' button/link in a detail table after the user has clicked the 'update' button/link? 

Essentially after the user makes changes to the detail table row and clicks the 'update' button I'd like the detail table row to show the 'edit' button again rather than displaying the 'update' and 'cancel' button as it does by default.  I do see that if the user clicks the 'cancel' button then the detail table row will show the 'edit' button.

Thanks!

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 11 Oct 2010, 11:05 AM
 Hello Amy,

I guess your issue is that editform is not closing after updating the record. If that the case check whether you have set AllowAutomaticUpdates to 'True' for GridTableView. That is if you are performing the update operation in code behind(manually), then set the AllowAutomaticUpdates to false to close the update form after insertion/updation .

Thanks,
Princy.
0
Amy
Top achievements
Rank 1
answered on 11 Oct 2010, 08:52 PM
Princy,  thank you for  your response!

When you say close the editform, do you mean the related master table row will no longer be expanded?  There may be several detail table rows within a master table row, and I'd like the end-user to be able to edit the various detail table rows without having to expand the related master table row each time.

0
Princy
Top achievements
Rank 2
answered on 12 Oct 2010, 01:43 PM
Hello Amy,

Setting AllowAutomaticUpdates to 'True' for GridTableView, will close the edit form when you click the update button. I believe, it will not collapse the griditem after update is performed. The grid item which is expanded, will remain in expanded state.

Hope this information helps,
Princy.
0
Amy
Top achievements
Rank 1
answered on 12 Oct 2010, 07:49 PM
I think I must be a bit confused.  :)

In the RadGrid declaration 'AllowAutomaticUpdates' is set to true in the aspx file though this property is not specified in the MasterTableView orDetailTable GridTableView declarations.  Here's the related code...
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None"
    AllowAutomaticUpdates="True" Skin="tds" EnableEmbeddedSkins="False" DataSourceID="dsContracts"
    AllowSorting="True" AllowFilteringByColumn="True" AllowPaging="True" EnableLinqExpressions="False">
    <GroupingSettings CaseSensitive="False"></GroupingSettings>
    <MasterTableView Name="MasterTable" HeaderStyle-HorizontalAlign="Center" EditMode="EditForms"
        DataKeyNames="iSelContractID" DataSourceID="dsContracts">
        <RowIndicatorColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>    
        <DetailTables>
            <telerik:GridTableView Name="DetailTable" DataKeyNames="iSelContractID, iObjID"
                DataSourceID="dsContractsWriteDetails" Width="100%" runat="server" AllowSorting="False"
                AllowFilteringByColumn="false" EditMode="InPlace">

The update of either a master table row or detail table row is handled in the code behind.  Initially I had the following line of code (in the code behind) after an update was performed but it caused the master table row to be collapsed after the update was completed for the detail table row... 
e.Item.Edit = False

Per your suggestion I tried the following, but it didn't seem to have any effect... 
e.Item.OwnerTableView.AllowAutomaticUpdates = False

So I think I must be getting it all confused.  :)  Any insight would be greatly appreciated, thank you!
0
Princy
Top achievements
Rank 2
answered on 13 Oct 2010, 09:14 AM
 Hello Amy,

I feel sorry that I mistyped the property 'AllowAutomaticUpdates' as 'True' in the above forum post. Since you are performing the update operation from code behind, you dont need to set the AllowAutomaticUpdates property of RadGrid to 'True', but set to "False". And I expect someone from Telerik also jump in this issue to help us, if this does not help.


Thanks,
Princy.
0
Amy
Top achievements
Rank 1
answered on 14 Oct 2010, 04:13 PM
Hi Princy!

I set 'AllowAutomaticUpdates' to be false in the aspx page, but it doesn't seem to have any effect...the detail table row that was updated still shows the 'update' and 'cancel' buttons/links rather than the 'edit' button/link as desired.

I also tried adding the following line in the code behind after the update completes but still no luck...
e.Item.OwnerTableView.AllowAutomaticUpdates = False 

Btw, I noticed if you click the 'cancel' button/link in the detail table row once it's in edit mode then the master table row stays expanded and the detail table row will show the 'edit' button/link.  Didn't know if this might help in narrowing down what the solution could be. :)

Thank you for all your help with this!  Let me know if there's any additional information I can provide.
Tags
Grid
Asked by
Amy
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Amy
Top achievements
Rank 1
Share this question
or