Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > XmlHttpPanel > Lost TextBox Value in ServerSide RadXmlHttpPanel Event

Not answered Lost TextBox Value in ServerSide RadXmlHttpPanel Event

Feed from this thread
  • Hakan avatar

    Posted on Jul 3, 2010 (permalink)

    I couldnt get TextBox value Which is placed inside of the XmlHttpPanel.Why I lost value?
    There are no TextBox values XmlHttpPanel_ServiceRequest2 event,Values also set  XmlHttpPanel_ServiceRequest
    event.Just I can take values with js and panel.set_value but When I have a many TextBoxes this is problem.

    C Sharp Code




       protected void XmlHttpPanel_ServiceRequest(object sender, RadXmlHttpPanelEventArgs e)  
        {  
                string val = e.Value;  
                DataSet ds = db.dbRead("Select * from Doctors where Id=" + val + "");  
                TextBox1.Attributes.Add("Value", ds.Tables[0].Rows[0]["Header"].ToString());  
                TextBox1.Text = ds.Tables[0].Rows[0]["Header"].ToString();  
                TextBox2.Text = ds.Tables[0].Rows[0]["ShortDescription"].ToString();  
                TextBox3.Text = val;  
        }  
     
        protected void XmlHttpPanel_ServiceRequest2(object sender, RadXmlHttpPanelEventArgs e)  
        {  
            //Random numbers = new Random();  
            //int index = numbers.Next(1, 10);  
            int i = db.dbWrite("update doctors set Header='" + TextBox1.Text + "',ShortDescription='" + TextBox1.Text + "' where Id=" + TextBox1.Text + "");  
            RadGrid1.DataSource = LoadData();  
            RadGrid1.CurrentPageIndex = 0;  
            RadGrid1.DataBind();  
     
        } 

    JS COde
     
    function rowSelected(sender, args) {  
                    var key = args.getDataKeyValue("Id");  
                    var panel = $find("<%=RadXmlHttpPanel1.ClientID %>");  
                    panel.set_value(key);  
                }  
                function UpdateGrid() {  
     
                    var panel = $find("<%=RadXmlHttpPanel2.ClientID %>");  
                    panel.set_value("any value");  
                } 
    HTML CODE

    <
    telerik:RadXmlHttpPanel ID="RadXmlHttpPanel1" runat="server"  OnServiceRequest="XmlHttpPanel_ServiceRequest" 
                    RenderMode="Block">  
         <asp:Button ID="Button1" runat="server" Text="Update Record and Grid " OnClientClick="UpdateGrid();return false;"  /> 
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> 
            <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> 
            </telerik:RadXmlHttpPanel> 
        <telerik:RadXmlHttpPanel ID="RadXmlHttpPanel2" runat="server" EnableClientScriptEvaluation="true"  OnServiceRequest="XmlHttpPanel_ServiceRequest2" 
                    RenderMode="Block">  
        <telerik:RadGrid ID="RadGrid1"  Skin="Hay"  OnNeedDataSource="RadGrid1_NeedDataSource" 
                    Width="370px" AllowSorting="True"   PageSize="10" AllowPaging="True" runat="server" 
                    AutoGenerateColumns="false" GridLines="None">  
                    <MasterTableView ClientDataKeyNames="Id" Width="100%"  > 
                        <Columns> 
                            <telerik:GridBoundColumn DataField="Id"  Visible="false">  
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn HeaderText="Name" DataField="Header" UniqueName="Header"  > 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn HeaderText="Address" DataField="ShortDescription" UniqueName="ShortDescription">  
                            </telerik:GridBoundColumn> 
                        </Columns> 
                    </MasterTableView> 
                    <PagerStyle Mode="NumericPages" PageButtonCount="5" /> 
                    <ClientSettings EnableRowHoverStyle="true" Selecting-AllowRowSelect="true" ClientEvents-OnRowSelected="rowSelected">  
                    </ClientSettings> 
            </telerik:RadGrid> 
        </telerik:RadXmlHttpPanel> 

    Reply

  • Pero Pero admin's avatar

    Posted on Jul 7, 2010 (permalink)

    Hi Hakan,

    The RadXmlHttpPanel uses ASP.NET client callbacks to retrieve its HTML from the server. The page does not go through its standard lifecycle - most importantly the ViewState is not loaded and saved. This means that, if you change a property of a server control, the new value will not be persisted. That's why the value of the TextBox is lost.

    More information about the RadXmlHttpPanel control can be found on our website: http://www.telerik.com/help/aspnet-ajax/radxmlhttppanel.html.


    All the best,
    Pero
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Posted on Oct 10, 2011 (permalink)

    If service is used to send data to server should l it work? i have another problem with xmlhttppanel. after server request all client side function sucha asremoving empty message on click is gone . Do you know what mayer be the reason ?


    I have found the solution myself. For those who have same problem,
    make sure you have:
    EnableClientScriptEvaluation="true"
    in your XmlHttpPanel.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > XmlHttpPanel > Lost TextBox Value in ServerSide RadXmlHttpPanel Event