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

radgrid and paging removes custom button functions

1 Answer 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
regina
Top achievements
Rank 1
regina asked on 17 Jun 2012, 05:37 PM
I am using the Q2 2012 version of ajax, I have a grid on an aspx page and in that grid I have a template column for a custom button and a custom editlink functionality.  The custom button and link open a radwindow and they work fine.  However I am also allowing paging of the grid, and this strips the custom functions because i have it in the radgrid_created event wrapped in an !ispostback if statement.  I have tried the pageindexchanged event up it is after the create event.  Any guidance is appreciated on how to tell the created event that while it is a postback it is a also paging and allow the buttons to create in this instance. thanks.

//here is the markup for the custom columns
                <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" UniqueName="addSubscriber"
                                AllowFiltering="false">
                                <ItemTemplate>
                                    <asp:Button ID="Button7" runat="server" Text="Add Subscribers" /></ItemTemplate>
                            </telerik:GridTemplateColumn>
       <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" AllowFiltering="false">
                                <ItemTemplate>
                                    <asp:HyperLink ID="EditLink" runat="server" Text="Edit"></asp:HyperLink></ItemTemplate>
                            </telerik:GridTemplateColumn>
 
 
//and here is the code behind
   if (!IsPostBack)
        {
            if (e.Item is GridDataItem)
            {
 
                HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink");
                editLink.Attributes["href"] = "#";
                editLink.Attributes["onclick"] = String.Format("return ShowAlertEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"], e.Item.ItemIndex);
            }
            if (e.Item is GridDataItem)
            {
                Button editLink = (Button)e.Item.FindControl("Button7");
                // OnClientClick=" return ShowAddSubscriberForm();"
                editLink.Attributes.Add("onclick", String.Format("return ShowAddSubscriberForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"], e.Item.ItemIndex));
 
            }
        }

1 Answer, 1 is accepted

Sort by
0
regina
Top achievements
Rank 1
answered on 19 Jun 2012, 12:11 PM
figured it out.
Tags
Grid
Asked by
regina
Top achievements
Rank 1
Answers by
regina
Top achievements
Rank 1
Share this question
or