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

scroll to #anchor on ItemCommand

2 Answers 18 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DGraham
Top achievements
Rank 1
DGraham asked on 25 Jul 2014, 08:52 AM
I have a RadGrid with a GridButtonColumn column that, when clicked, makes visible and populates some information in a panel below the grid.
‚Äč
<telerik:RadGrid runat="server" ID="RadGridDocuments" ItemStyle-VerticalAlign="Top" AllowPaging="False" AllowSorting="True" ShowGroupPanel="True">
           <%--  etc... --%>
       <telerik:GridButtonColumn CommandName="viewHistory" Text="View History"
             UniqueName="viewHistory">
         </telerik:GridButtonColumn>
           <%--  etc... --%>
</ telerik:RadGrid >   
  
 
 <telerik:RadAjaxPanel ID="pnlViewHistory" runat="server" Visible="false" Height="200px" Width="300px">
    <a href="#anchor"> </a>
    <%-- other stuff --%>
</telerik:RadAjaxPanel>
 
 <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>      
            <telerik:AjaxSetting AjaxControlID="RadGridDocuments">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGridDocuments" />
                    <telerik:AjaxUpdatedControl ControlID="pnlViewHistory" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
</telerik:RadAjaxManagerProxy>

    
And the code behind

Private Sub RadGridDocuments_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles RadGridDocuments.ItemCommand
     
     Select Case e.CommandName
         Case "viewHistory"
             showHistory(e)
         Case
             'more commands follow
     End Select
 End Sub


What I would like to do is also, when this GridButtonColumn is clicked also scroll down to the panel or anchor and bring it in to view. I have no idea how to do this in ItemCommand, can anyone help?





2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 29 Jul 2014, 07:27 AM
Hi DGraham,

You can try to set the Focus to the panel when its made visible.

C#:
void RadGridDocuments_ItemCommand(object sender, GridCommandEventArgs e)
{
  if (e.CommandName == "viewHistory")
  {
    pnlViewHistory.Visible = true;
    pnlViewHistory.Focus();
  }
}

Thanks,
Shinu
0
DGraham
Top achievements
Rank 1
answered on 29 Jul 2014, 08:30 AM
Very strange, I had already tried that and it didn't work, which is when I posted here. However now I try again it does work fine!

Thanks for your help.
Tags
Grid
Asked by
DGraham
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
DGraham
Top achievements
Rank 1
Share this question
or