Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListView > ListView losing values on post back.

Not answered ListView losing values on post back.

Feed from this thread
  • fabian avatar

    Posted on Jan 9, 2012 (permalink)

    I have a list view with an item template and some radnumeric text boxes.
    I'm binding the radnumerictextboxes programaticaly OnItemCreated.
    When I fire a postback the values are all gone.
    Any suggestions?
    thank you

     <telerik:RadListView ID="RadListView1" runat="server" OnItemCreated="RadListView1_ItemCreated">
                    <ItemTemplate>
                        <div>
                            <telerik:RadNumericTextBox ID="txb0" runat="server" Width="50px" />
                            <telerik:RadNumericTextBox ID="txb1" runat="server" Width="50px" />
                        </div>
                    </ItemTemplate>
       </telerik:RadListView>

        protected void RadListView1_ItemCreated(object sender, RadListViewItemEventArgs e)
        {
                    if (!IsPostBack)
                    {
                        RadNumericTextBox txb0 = (RadNumericTextBox)e.Item.FindControl("txb0");
                        txb0.Value = 1;

                        RadNumericTextBox txb1 = (RadNumericTextBox)e.Item.FindControl("txb1");
                        txb1.Value = 2;
                    }
            }

    Reply

  • jumpstart Master avatar

    Posted on Jan 9, 2012 (permalink)

    Fabian:

    Unfortunately, RadNumericTextBox is a type of RadInput, and as you can see in the radtextbox with password mode cant save its state while post back forum thread answered by Maria of Telerik (January 12, 2011): "The RadInput clear its value after each postback and this is by design due to security reasons."

    So, you'd have to manually add the values to the ViewState or ControlState and reference them on the server-side. This could be a cumbersome task.

    Hope this helps!

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListView > ListView losing values on post back.
Related resources for "ListView losing values on post back."

ASP.NET ListView Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]