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

Handle Link button In radgrid with ajax

3 Answers 282 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Howard
Top achievements
Rank 1
Howard asked on 27 Dec 2012, 03:18 PM

I have a link button in my RadGrid. When I clicked the link button,it will pop out a new page. All is working fine without error. Here is my code:


ASP
<telerik:RadGrid ID="gvCustomer" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Width="100%">
        <MasterTableView AllowMultiColumnSorting="True">
            <CommandItemSettings ExportToPdfText="Export to PDF" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" HeaderText="Customer Name"
                    SortExpression="CUSTOMERNAME" UniqueName="TemplateColumn">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkCustomerName" runat="server" CommandArgument='<%#Eval("CUSTOMERNAME") "," +Eval("IC")+ "," +Eval("ACCNO")%>' 
   CommandName="command" Font-Underline="True" Text='<%# Bind("CUSTOMERNAME") %>'>
 </
asp:LinkButton>
                    </ItemTemplate>
                    <FooterStyle HorizontalAlign="Center" />
                    <HeaderStyle Width="25%" />
                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" />
                </telerik:GridTemplateColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
            <PagerStyle AlwaysVisible="True" />
        </MasterTableView>
        <HeaderStyle HorizontalAlign="Center" />
        <PagerStyle AlwaysVisible="True" />
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
</telerik:RadGrid>

VB.NET
Protected Sub gvCustomer_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles gvCustomer.ItemCommand
 
       If e.CommandName = "command" Then
           Dim arg As String() = e.CommandArgument.ToString.Split(",")
           Dim strName As String = arg(1)
           Dim strIC As String = arg(2)
           Dim strAccountNo As String = arg(3)
 
           Dim str As String
           str = "<script language='javascript'>window.open(' " + "~/Customer.aspx?CustomerName=" & strName & "&OldIC=" & strIC & "&AccountNo=" & strAccountNo + " ');</script>"
           ClientScript.RegisterStartupScript(Me.GetType(), "script", str)
       End If
   End Sub

But after I added the RadAjaxManager to handle the RadGrid. The link button is not working anymore. The new page does not pop out. But if I remove the ajax manager will work fine,the page is post back and new page is pop out. Below is the code I added:


ASP
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="gvCustomer">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="gvCustomer" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
</telerik:RadAjaxManager>

Please help me to find out the solution.Thank you very much!

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Dec 2012, 08:52 AM
Hi,

You can use the following approaches explained in this documentation to exclude controls from ajaxifying.

Thanks,
Shinu.
0
Dario
Top achievements
Rank 1
answered on 01 Aug 2018, 02:20 PM
The link is not working anymore. It would be useful to have it please.
0
Attila Antal
Telerik team
answered on 06 Aug 2018, 01:28 PM
Hi Dario,

Could you please describe us the link you are experiencing problems with? The one posted by Shinu is working, please check the following: Exclude Controls from Ajaxifying

Kind regards,
Attila Antal
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Ajax
Asked by
Howard
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Dario
Top achievements
Rank 1
Attila Antal
Telerik team
Share this question
or