-1

there is an error in reading data from a text box here is the XML code:

    <asp:Button ID="btnSearch" runat="server" Style="z-index: 100; left: 513px; position: absolute;
        top: 340px" Text="Search" Width="188px"/>
    <asp:TextBox ID="MyTB" runat="server" Style="z-index: 101; left: 365px; position: absolute;
        top: 302px" Width="493px"/>

and here is the code where i call the textbox "MyTB" to read the data from it:

    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string text = MyTB.Text;

        string[] textArr = text.Split(new char[] { ' ', '\n', ',' });
    }

The XML code :

<div>
    <asp:Button ID="btnSearch" runat="server" Style="z-index: 100; left: 513px; position: absolute;
        top: 340px" Text="Search" Width="188px"/>
    <asp:TextBox ID="MyTB" runat="server" Style="z-index: 101; left: 365px; position: absolute;
        top: 302px" Width="493px"/>


</div>
4

1 回答 1

0

The codes seems to be correct. You could check the page's designer.cs file to make sure that it has MyTB defined eg

protected global::System.Web.UI.WebControls.TextBox MyTB; 
于 2012-05-22T00:25:49.997 回答