Textbox not retrieving entered text

Thread is closed for posting
3 posts, 0 answers
  1. Ryan
    Ryan avatar
    5 posts
    Member since:
    Oct 2012

    Posted 01 Nov 2012 Link to this post

    Hi All,
    After about three hours of trying I have finally given up and had to use ASP:Textbox but this is not ideal, so hoping someone can tell me what I have done wrong, I have an aspx page linked to a radGrid, when the user clicks edit it opens up a radwindow where they can change the data, I know all the code is working as I can set values from behind but not with user input, Here is the ASPX...
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="SeriesUpdate.aspx.vb" Inherits="SeriesUpdate" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head runat="server" id="Head1">
        <title>Update Series</title>
    </head>
    <body onkeydown="return noBackspace(event)" onload="InitWindow()">
        <form id="Itemedit" runat="server">
        <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
        </telerik:RadStyleSheetManager>
        <telerik:RadSkinManager ID="RadSkinManager1" runat="server">
        </telerik:RadSkinManager>
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadInputManager ID="RadInputManager1" runat="server">
        </telerik:RadInputManager>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript" src="scripts\editwindow.js">
            </script>
            <script type="text/javascript">
                function OnClientClicked(button, args) {
                    if (window.confirm("Are you sure you want to delete this item?")) {
                        button.set_autoPostBack(true);
                    }
                    else {
                        button.set_autoPostBack(false);
                    }
                }
                function returnArg() {
                    var oWnd = GetRadWindow();
                    var UniqueID = document.getElementById("<%= lblUniqueID.ClientID %>").value;
                    oWnd.close(UniqueID);
                }
            </script>
        </telerik:RadCodeBlock>
        <div>
            <table>
                <tr>
                    <td>
                        Reference:
                    </td>
                    <td>
                        <ASP:Textbox ID="txtSeriesCode" runat="server" Width="150px" MaxLength="10"
                            ToolTip="Maximum 10 character reference">
                        </ASP:Textbox>
                        <Telerik:RadTextbox ID="TextBox1" runat="server"></Telerik:RadTextbox>
                    </td>
                    <td>
                        <asp:Label ID="lblUniqueID" runat="server" Text="" Visible="false"></asp:Label>
                        <asp:Label ID="InjectScript" runat="server" Text=""></asp:Label>
                    </td>
                    <td>
                        <asp:CheckBox ID="chkArchived" runat="server" Text="Archivd" TabIndex="99" />
                    </td>
                </tr>
                <tr>
                    <td>
                        Name:
                    </td>
                    <td>
                        <Telerik:RadTextbox ID="txtName1" runat="server" Width="532px" Text="">
                        </Telerik:RadTextbox>
                    </td>
                </tr>
            </table>
        </div>
        <div class="Radbutton-line">
            <telerik:RadButton ID="btnSave" runat="server" Text="Save & Close">
            </telerik:RadButton>
            <telerik:RadButton ID="btnCancel" runat="server" Text="Cancel">
            </telerik:RadButton>
            <telerik:RadButton ID="btnDelete" runat="server" Text="Delete" OnClientClicked="return OnClientClicked()">
            </telerik:RadButton>
        </div>
        </form>
    </body>
    </html>
     
    and this is my code behind...
    Imports Telerik.Web.UI
    Imports TimeManager
    Imports RoadsInterface
    Partial Class SeriesUpdate
        Inherits System.Web.UI.Page
     
        Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
            If Not Page.IsPostBack And Not Page.IsCallback Then
                Dim intUniqueID As Integer = Request.QueryString("UniqueID")
                lblUniqueID.Text = intUniqueID
                Dim strStaff As String = Session("Staff")
                If String.IsNullOrEmpty(strStaff) Then
                    Response.Redirect("~/default.aspx")
                End If
                Dim skn As New Skins
                skn.setSkin(RadSkinManager1)
                'skn.setForm(RadFormDecorator1)
                Dim itm As New dbItem(Session("ConnectionString"))
                itm.InitialiseItem(itm)
                If intUniqueID <> 0 Then
                    ShowItem(itm)
                End If
            End If
        End Sub
     
        Public Sub ShowItem(ByRef itm As dbItem)
            itm.SingleSeries(lblUniqueID.Text, itm)
            txtName1.Text = itm.Name
            txtSeriesCode.Text = itm.Number
            chkArchived.Checked = itm.Archive
        End Sub
     
        Protected Sub btnDelete_Click(sender As Object, e As System.EventArgs) Handles btnDelete.Click
            Dim itm As New dbItem(Session("ConnectionString"))
            itm.DeleteSeries(lblUniqueID.Text)
            InjectScript.Text = "<script type='text/javascript'>CloseAndRebind();</" + "script>"
        End Sub
     
        Protected Sub btnCancel_Click(sender As Object, e As System.EventArgs) Handles btnCancel.Click
            InjectScript.Text = "<script type='text/javascript'>CloseAndRebind();</" + "script>"
        End Sub
     
        Protected Sub btnSave_Click(sender As Object, e As System.EventArgs) Handles btnSave.Click
            'txtName1.Text = "Hello"
            MsgBox(txtName1.Text)
            Dim itm As New dbItem(Session("ConnectionString"))
            itm.InitialiseItem(itm)
            itm.UniqueID = lblUniqueID.Text
            itm.Name = txtName1.Text
            itm.Number = txtSeriesCode.Text
            itm.Archive = chkArchived.Checked
            Dim Test As String
            Test = TextBox1.Text
            If lblUniqueID.Text <> 0 Then
                'Update
                itm.UpdateSeries(itm)
            Else
                'Insert
                itm.AddSeries(itm)
            End If
     
            InjectScript.Text = "<script type='text/javascript'>CloseAndRebind();</" + "script>"
        End Sub
     
        Protected Sub chkArchived_CheckedChanged(sender As Object, e As System.EventArgs) Handles chkArchived.CheckedChanged
     
        End Sub
     
        Protected Sub txtName1_TextChanged(sender As Object, e As System.EventArgs) Handles txtName1.TextChanged
            MsgBox(txtName1.Text)
        End Sub
    End Class

    To Clarify...
    My RadTextboxes are not returning the user input to the code behind, but I can set them from code behind, I am not sure what is wrong because the code is copied from a working page
    Many Thanks
    Ryan
  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 06 Nov 2012 Link to this post

    Hi Ryan,

    Do you use the latest version of RadControls?  I don't see such problem when I place RadTextBox in a similar to your scenario. Could you confirm that you have enabled the Script Debugging in your browser, and that you don't have any JavaScript error? If there is an error and scripts stop to work, the value of the RadTextBox will not be serialized to the server and it will remain empty.

    Kind regards,
    Vasil
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ryan
    Ryan avatar
    15 posts
    Member since:
    Aug 2012

    Posted 06 Nov 2012 Link to this post

    Hi Vasil,
    Yes I do have the latest version, I cannot recreate the error either on any other page, so I assume I have an error in the script somewhere, if I find anything I'll let you know, thank-you for replying
    Many Thanks
    Ryan
Back to Top