RadTextBox value not propagating to server

3 posts, 0 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 01 Sep 2009 Link to this post

    Hello,

    I change a value in a RadTextBox on a client, and it's not propagating to the server.  I have a RadTextBox in a ListView.  The values get submitted in bulk to the server via button click, but I don't use the button click directly.  Instead, I'm calling __doPostBack(button.name, "<command>"); and the issue is when I use this approach, changes aren't making there way back to the server, either via:

    RTB.SelectedDate
    RTB.DateInput.SelectedDate

    It's all null.  Why would that be?  I'm using 2008.3.1125.35.

    Thanks.
  2. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 01 Sep 2009 Link to this post

    Hello,

    Actually, it's the RadDatePicker; I'm getting my controls mixed up.  Sorry for the confusion.

    Thanks.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Martin
    Admin
    Martin avatar
    811 posts

    Posted 04 Sep 2009 Link to this post

    Hello Brian,

    You can use the OnValueChanging client-side event of the embedded DateInput control to get the entered value. Then set this value to a hidden field that is available on the server. Here is a sample markup:

    <asp:Button runat="server" Text="Button" ID="Button1" style="display:none"
            </asp:Button> 
            <asp:HiddenField ID="HiddenField1" runat="server" /> 
            <asp:ListView runat="server" ID="ListView1" ItemPlaceholderID="itemPlaceholder"
                <ItemTemplate>                 
                        <telerik:RadDatePicker ID="RadDatePicker1" runat="server"
                            <DateInput> 
                                <ClientEvents OnValueChanging="ValueChanging" /> 
                            </DateInput> 
                        </telerik:RadDatePicker>                 
                </ItemTemplate> 
                <LayoutTemplate> 
                    <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder> 
                </LayoutTemplate> 
            </asp:ListView> 
            <br/> 
            <asp:Label runat="server" ID="Label1"></asp:Label> 


    The client-side OnValueChanging event handler:

    function ValueChanging(sender, args) 
                { 
                    var hidden = $get("HiddenField1"); 
                    hidden.value = args.get_newValue(); 
                    var button = $get("Button1"); 
                    __doPostBack(button.name, ""); 
                } 


    and on the server:

    protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!IsPostBack) 
            { 
                DataTable table = new DataTable(); 
                table.Columns.Add("Column1"); 
                table.Rows.Add("Hello"); 
                ListView1.DataSource = table; 
                ListView1.DataBind(); 
            } 
            Label1.Text = "Value is: "+HiddenField1.Value; 
        } 

    Best regards,
    Martin
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top