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

Trigger edit from a GridTemplateColumn

3 Answers 169 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 16 May 2016, 03:34 PM

I am currently using a RadGrid to display a list of events and documents.  One of the columns in the grid is called "Action" with a few links in it (a link to the document, a link to a 3rd party annotation tool, etc).  The user wants the ability to rename the document (using the grid's edit functionality) but wants the "Rename" link to be in the Action column instead of it's own column.  How do I add a GridEditCommandColumn-like action to another column or add other columns to the GridEditCommandColumn.

 

<telerik:GridTemplateColumn HeaderText="Actions" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left">
    <ItemTemplate>
        <asp:HyperLink runat="server" Target="_blank" ID="ViewLink" Text="View" NavigateUrl="/ViewCaseDoc.aspx?" />
        <asp:LinkButton runat="server" ID="AnnotationOpenLink" Text="Annotate" />
        <%-- 
            I want this action here
            <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"  EditText="Rename"></telerik:GridEditCommandColumn>
        --%>
    </ItemTemplate>
</telerik:GridTemplateColumn>

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 19 May 2016, 01:32 PM
Hi Jeremy,

Just set the CommandName of the LinkButton to Edit:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/control-lifecycle/command-reference-

I hope this will prove helpful.

Regards,
Eyup
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Jeremy
Top achievements
Rank 1
answered on 19 May 2016, 08:57 PM

Ok, that works.

I guess at this point the only other issue is how the Edit seems to work.  So the RadGrid has nearly 100 records in it.  The user has to scroll down to find the row they want to edit.  But when they click the edit button the page posts back and the user is at the top of the radgrid again.  How do we keep or return the screen to the edit row so the user doesn't have to scroll and find the row again?

0
Eyup
Telerik team
answered on 24 May 2016, 11:57 AM
Hello Jeremy,

Generally, you can preserve the scrolling position by ajaxifying the grid using RadAjaxManager or RadAjaxPanel.

Alternatively, you can scroll the window to the edited item manually. I am sending a sample RadGrid web site to demonstrate how you can achieve this requirement. Please run the attached application and let me know if it helps you.

Regards,
Eyup
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Jeremy
Top achievements
Rank 1
Share this question
or