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

RadTextBox.Text in ItemTemplate being rebound after postback

5 Answers 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 14 Jan 2013, 10:25 AM
Hey Guys,

I have a RadTextBox inside  a RadGrid's ItemTemplate for a given column.  This is bound to a datasource (if !Page.IsPostback).
I have an independant button event which fires and tries to reference the text of the radtextbox from the first row of the grid.
It finds it, but it is always the unedited value that was originally bound, and any edit to the field is lost.
It seems like it's being rebound, but I have that bind inside if (!Page.IsPostback) ??

I'm clearing missing something here. - I am not using edit mode - just a template field. 
Any help appreciated.

5 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 17 Jan 2013, 08:03 AM
Hi,

The if (!Page.IsPostback) condition verifies that the page has not been postbacked yet. So, if you bind your data only on initial load then it is normal for the data to be lost on postbacks. Could you share your full page source code along with the code-behind file content?

Thus all the people who want to help you will have better understanding of your case.

All the best,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Simon
Top achievements
Rank 1
answered on 04 Feb 2013, 11:50 PM
Hi, sorry for the delay in updating this issue.
I have managed to isolate the problem down to an Ajaxified RadTextBox in Chrome.  
See the simple demo below:

<telerik:RadAjaxPanel ID="p1" runat="server" RenderMode="Block">
    <telerik:RadTextBox ID="tbQuantity" runat="server" Text="1" Width="53px" MaxLength="5" InputType="Number" OnTextChanged="tbQuantity_TextChanged" AutoPostBack="true" ToolTip="Select your quantity"></telerik:RadTextBox>
    <br />
    <asp:Literal ID="litTotal" runat="server" />
</telerik:RadAjaxPanel>


public partial class design_text : System.Web.UI.Page
{
    protected void tbQuantity_TextChanged(object sender, EventArgs e)
    {
        litTotal.Text = tbQuantity.Text;
    }   
}

This code works in any browser except Google Chrome - where the original value is restored over the updated value.
Changing the RadTextBox to a regular asp textbox solves the issue.
Removing the ajax panel solves the issue.
Changing the ajax panel for a radajaxmanager does not solve the issue.

Is this a known issue with Chrome and RadAjax ?

0
Angel Petrov
Telerik team
answered on 07 Feb 2013, 02:56 PM
Hi Simon,

I am sorry to say but this is an unknown issue to us. I tried reproducing the problem as shown in this video but to no avail. Could you please elaborate more on your scenario? If you could send us your markup and code-behind that would be great. Attached is the project which I have tested.

Kind regards,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Simon
Top achievements
Rank 1
answered on 07 Feb 2013, 11:48 PM
Thanks. I see it does appear to work in your vid.
I realised I was using a masterpage which I hadn't included in my sample.
So here's a stripped down but complete version : 

<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeFile="text.aspx.cs" Inherits="design_text" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<html>
 <head>
    <title>Test</title>
 </head>
 <body>
    <form id="f1" runat="server">
    <telerik:RadAjaxPanel ID="p1" runat="server" RenderMode="Block">
        <telerik:RadScriptManager id="rsm" runat="server"></telerik:RadScriptManager>
        <telerik:RadTextBox ID="tbQuantity" runat="server" Text="1" Width="53px" MaxLength="5" InputType="Number" OnTextChanged="tbQuantity_TextChanged" AutoPostBack="true" ToolTip="Select your quantity"></telerik:RadTextBox>
        <br />
        <asp:Literal ID="litTotal" runat="server" />
    </telerik:RadAjaxPanel>
    </form>
 </body>
</html>


using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class design_text : System.Web.UI.Page
{
    protected void tbQuantity_TextChanged(object sender, EventArgs e)
    {
        litTotal.Text = tbQuantity.Text;
    }   
}

This page can be viewed at http://cgp.triplestones.com.au/text.aspx.

And here is a video of me changing the value, tabbing, then changing again and clicking outside the box in Google Chrome 24.0.1312.57 m

http://screencast.com/t/zUvWnHu2KL

Though I may be a release behind latest with the Telerik DLL.

thanks

0
Angel Petrov
Telerik team
answered on 08 Feb 2013, 04:01 PM
Hi Simon,

Indeed the problem reproduces in the page you provided. However in my local project which uses your code this issue is still not reproducible(please review this video). Could you please send us the project which you are testing or a sample in which the problem replicates? Also please place the RadScriptManager outside the RadAjaxPanel.

All the best,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Simon
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Simon
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or