RadGrid "Add" button is not working at all. Nothing happens on Add button click.

2 posts, 1 answers
  1. Priyanka
    Priyanka avatar
    34 posts
    Member since:
    Dec 2014

    Posted 11 Jun 2015 Link to this post


    I have a RadGrid on my web page in which I am implementing only "Add records" functionality.
    When I try to click on "Add" button, nothing happens (it do not show panel to add records in it)

    Please reply what mistake I am doing in my code.

    Below is the .aspx (say "Default.aspx" page) code:

    <telerik:RadMultiPage ID="RadMultiPage4" runat="server" SelectedIndex="0" Width="100%">
                                                                                <telerik:RadPageView ID="RadPageView3" runat="server" Width="100%">
                                                                                    <telerik:RadAjaxPanel ID="RadAjaxPanel3" runat="server">
                                                                                         <asp:label ID="Label2" runat="server" style="display: none;"/>
              <telerik:RadGrid ID="RGGSTChat" runat="server"  AutoGenerateColumns="false"
                  ShowStatusBar="true" EnableEmbeddedSkins="true" Skin="Outlook"
                  OnNeedDataSource= "rggstChat_NeedDataSource" OnInsertCommand="RGGSTChat_InsertCommand">
              <mastertableview commanditemdisplay="Top" autogeneratecolumns="false" datakeynames="ChatID"
                insertitempageindexaction="ShowItemOnCurrentPage" ShowFooter="True">
                        <CommandItemSettings AddNewRecordText="New" />
                                            <telerik:GridBoundColumn DataField="ChatID" HeaderText="Id"
                                                UniqueName="ChatID" SortExpression="ChatID" Visible="false">
                                                <ItemStyle HorizontalAlign="Right" />
                                                <FooterStyle HorizontalAlign="Right" />
                                            <telerik:GridBoundColumn DataField="ChatTo" HeaderText="To"
                                                UniqueName="ChatTo" SortExpression="ChatTo">
                                                <ItemStyle HorizontalAlign="Right" />
                                                <FooterStyle HorizontalAlign="Right" />
                                            <telerik:GridBoundColumn DataField="ChatCc" HeaderText="Cc"
                                                UniqueName="ChatTo" SortExpression="ChatTo">
                                                <ItemStyle HorizontalAlign="Right" />
                                                <FooterStyle HorizontalAlign="Right" />
                                            <telerik:GridBoundColumn DataField="ChatSubject" HeaderText="Subject"
                                                UniqueName="ChatSubject" SortExpression="ChatSubject">
                                                <ItemStyle HorizontalAlign="Right" />
                                                <FooterStyle HorizontalAlign="Right" />
                                            <telerik:GridBoundColumn DataField="ChatContent" HeaderText="Content"
                                                UniqueName="ChatContent" SortExpression="ChatContent">
                                                <ItemStyle HorizontalAlign="Right" />
                                                <FooterStyle HorizontalAlign="Right" />
                                            <EditColumn ButtonType="ImageButton" />
                                        <PagerStyle AlwaysVisible="True" PageSizeControlType="RadComboBox" />

    C# code:

    protected void rggstChat_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
            Label GUID = fvIPRForm.FindControl("TempGUID") as Label; // RequestID
            RadGrid RGGSTChat = fvIPRForm.FindControl("RGGSTChat") as RadGrid;
            if (!string.IsNullOrEmpty(Request.QueryString["RequestID"]))
                GUID.Text = Request.QueryString["RequestID"];
            if (string.IsNullOrEmpty(GUID.Text))
                GUID.Text = Session["GUID"].ToString();
            DataTable dt = IPRRequest.SelectChatData(new Guid(GUID.Text));
            RGGSTChat.DataSource = dt;
            Response.Write("Page_Load Error. Reason: " + GUID.Text);

    protected void RGGSTChat_InsertCommand(object sender, GridCommandEventArgs e)
            GridEditableItem item = e.Item as GridEditableItem;
            Label requestID = fvIPRForm.FindControl("TempGUID") as Label;
            string chat_to = (item["lblTo"].Controls[1] as Label).Text;
            string chat_cc = (item["lblCc"].Controls[2] as Label).Text;
            string chat_subj = (item["lblSubject"].Controls[3] as Label).Text;
            string chat_Content = (item["lblContent"].Controls[4] as Label).Text;
            string loginUser = AD_Guard.Checker(Session["LoginUser"].ToString()) + "";
            IPRRequest.InsertChatData(new Guid(requestID.Text), chat_to, chat_cc, chat_subj, chat_Content, loginUser);  

    This is the .dll (say "abc.cs" page) code, this .dll is used for DB connection:

    public static DataTable SelectChatData(Guid requestID)
                Data data = new Data();
                Dictionary<string, object> input = new Dictionary<string, object>()
                    {"@RequestId", requestID}
                    //{"@ChatID", null},
                    //{"@ChatTo", chatTo},
                    //{"@ChatCc", chatCC},
                    //{"@ChatSubject", chatSubj},
                    //{"@ChatContent", chatMsg}
                DataTable dt = data.ExecuteQuery(CommandType.StoredProcedure, "Invoice.usp_tbl_Request_Chat_Select", input);           
                return dt;
            public static DataTable InsertChatData(Guid requestID, string chat_to, string chat_cc, string chat_subj,
                string chat_Content, string loginUser)
                Data data = new Data();
                Dictionary<string, object> input = new Dictionary<string, object>()
                    {"@RequestID", requestID},
                    {"@ChatTo", chat_to},
                    {"@ChatCc", chat_cc},
                    {"@ChatSubject", chat_subj},
                    {"@ChatContent", chat_Content},
                    {"@CreatedBy", loginUser},
                    {"@CreatedDate", DateTime.Now.ToString()}
                DataTable dt = data.ExecuteQuery(CommandType.StoredProcedure, "[Invoice].[usp_tbl_Request_Chat_Insert]", input);
                return dt;


  2. Answer
    Konstantin Dikov
    Konstantin Dikov avatar
    1800 posts

    Posted 16 Jun 2015 Link to this post

    Hello Priyanka,

    The problem that you are facing is due to the fact that you are calling Response.Write method within an AJAX request, which is not supported scenario and if you inspect your browser's console you will notice that an exception will be thrown when you click on the "Add" button.

    In order to handle this you will either have to disable AJAX or remove the line where you are calling the Response.Write method.

    Detailed information on this matter could be found in the following article:
    Hope this helps.

    Konstantin Dikov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top