I'm trying to add some javascript that will run when the user clicks on the "Add new record" button.
I can do this with a regular linkbutton like this:
<asp:LinkButton ID="LinkButton5" runat="server" CssClass="gridLink" CommandName="PerformInsert"Text="Insert" OnClientClick="javascript:hideConfirm = true;" />How would I do this for the Add new record button? I've attached the code below. Or maybe I could add my javascript from the code behind, but how would I find that control? I've added an image of the "Add" button. Thanks in advance for your help.
<telerik:RadGrid ID="rgComments" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowSorting="True" CellSpacing="0" GridLines="None" Width="800px" AutoGenerateColumns="False" BorderWidth="0px"> <MasterTableView CommandItemDisplay="Top" DataKeyNames="idPartnerCommentId" EditMode="InPlace"> <CommandItemSettings ExportToPdfText="Export to PDF" ShowRefreshButton="False" AddNewRecordText="Add Comment" /> <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn><telerik:RadGrid ID="rgComments" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowSorting="True" CellSpacing="0" GridLines="None" Width="800px" AutoGenerateColumns="False" BorderWidth="0px"> <MasterTableView CommandItemDisplay="Top" DataKeyNames="idPartnerCommentId" EditMode="InPlace"> <CommandItemSettings ExportToPdfText="Export to PDF" ShowRefreshButton="False"AddNewRecordText="Add Comment" /> <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridTemplateColumn DataField="varcharComment" HeaderText="Comment" SortExpression="varcharComment" UniqueName="varcharComment"> <EditItemTemplate> <asp:TextBox ID="txtComment" TextMode="MultiLine" Width="430px" Height="60px"runat="server" MaxLength="5000" /> </EditItemTemplate> <ItemTemplate> <asp:Label ID="lblComment" runat="server"></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView></telerik:RadGrid> <Columns> <telerik:GridTemplateColumn DataField="varcharComment" HeaderText="Comment" SortExpression="varcharComment" UniqueName="varcharComment"> <EditItemTemplate> <asp:TextBox ID="txtComment" TextMode="MultiLine" Width="430px" Height="60px" runat="server" MaxLength="5000" /> </EditItemTemplate> <ItemTemplate> <asp:Label ID="lblComment" runat="server"></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView></telerik:RadGrid>