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

RadTextBox value not propagating to server

2 Answers 73 Views
Input
This is a migrated thread and some comments may be shown as answers.
Brian Mains
Top achievements
Rank 1
Brian Mains asked on 01 Sep 2009, 02:55 PM
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 Answers, 1 is accepted

Sort by
0
Brian Mains
Top achievements
Rank 1
answered on 01 Sep 2009, 04:04 PM
Hello,

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

Thanks.
0
Martin
Telerik team
answered on 04 Sep 2009, 01:15 PM
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.
Tags
Input
Asked by
Brian Mains
Top achievements
Rank 1
Answers by
Brian Mains
Top achievements
Rank 1
Martin
Telerik team
Share this question
or