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

Screen is not repainted in ajaxifyied rad grid after saving.

3 Answers 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dean
Top achievements
Rank 1
Dean asked on 08 Mar 2012, 04:00 AM

I have an ajaxified textbox in an ajaxified RadGrid.

When I update text in the textbox and click on the save icon in an editable row the server side code gets executed correctly but the ui is not updated (repainted). The row is still in edit mode and there is no save message.

NOTE:  The textbox’s and the save buttons ajax postback occurs at the same time. This is because the textbox has not lost focus until the save button has been clicked. This is where the issue is. If the textbox text is changed and the focus is moved to a second control then the save button is clicked everything works fine.

Note: The textbox is displayed in editable rows of the RadGrid. There is an ontextchange event handler on the textbox. Therefore when text has changed and focus is lost on the textbox an ajax postback occurs to the server.

Any assistance would be much appreciated .

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 08 Mar 2012, 09:18 AM
Hello Dean,

Sorry but i am not able to reproduce this problem. Please check below code snippet.

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false"
            OnNeedDataSource="RadGrid1_NeedDataSource"
            onupdatecommand="RadGrid1_UpdateCommand">
            <MasterTableView>
                <Columns>
                    <telerik:GridTemplateColumn>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("Name") %>'> </asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged" AutoPostBack="true"></asp:TextBox>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
      {
          dynamic data = new[] {
              new { ID = 1, Name ="name1"},
              new { ID = 2, Name = "name2"},
              new { ID = 3, Name = "name3"},
              new { ID = 4, Name = "Name4"},
               new { ID = 1, Name ="name5"}};
          RadGrid1.DataSource = data;
      }
 
      protected void TextBox1_TextChanged(object sender, EventArgs e)
      {
          Response.Write("text changed fire");
      }
 
      protected void RadGrid1_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
      {
          Response.Write("update command fire");
      }
 

Thanks,
Jayesh Goyani
0
Dean
Top achievements
Rank 1
answered on 08 Mar 2012, 09:56 AM
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
 Did you ajaxify the rad grid using the rad ajax manager above?
0
Jayesh Goyani
Top achievements
Rank 2
answered on 09 Mar 2012, 06:50 AM
Hello Dean,

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
           <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="RadGrid1">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
               <telerik:AjaxSetting AjaxControlID="TextBox1">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
           </AjaxSettings>
       </telerik:RadAjaxManager>
       <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
       </telerik:RadAjaxLoadingPanel>
       <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"
           OnUpdateCommand="RadGrid1_UpdateCommand">
           <MasterTableView>
               <Columns>
                   <telerik:GridTemplateColumn>
                       <ItemTemplate>
                           <asp:Label ID="Label1" runat="server" Text='<%# Eval("Name") %>'> </asp:Label>
                       </ItemTemplate>
                       <EditItemTemplate>
                           <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged" AutoPostBack="true"></asp:TextBox>
                       </EditItemTemplate>
                   </telerik:GridTemplateColumn>
                   <telerik:GridEditCommandColumn>
                   </telerik:GridEditCommandColumn>
               </Columns>
           </MasterTableView>
       </telerik:RadGrid>

protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        dynamic data = new[] {
              new { ID = 1, Name ="name1"},
              new { ID = 2, Name = "name2"},
              new { ID = 3, Name = "name3"},
              new { ID = 4, Name = "Name4"},
               new { ID = 1, Name ="name5"}};
        RadGrid1.DataSource = data;
    }
 
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
         
    }
 
    protected void RadGrid1_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
 
    }

Let me know if any concern.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Dean
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Dean
Top achievements
Rank 1
Share this question
or