jeudi 4 septembre 2014

Object null reference stuff. Where is it?


Vote count:

0




Should be an easy one, being as there isn't even that much code, but apparently I'm blind. Check it out:


Markup:



Search by last name:<asp:TextBox ID="searchTB" runat="server"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="Search" OnClick="Search" />


Code behind:



protected void Search(object sender, EventArgs e)
{
TextBox LastName = (TextBox)this.FindControl("SearchTB");
Response.Redirect("OrgsByName.aspx?LASTNAME=" + LastName.Text);
}


When I run it, it is telling me that LastName.Text is empty. Is something wrong with using "this.FindControl" or something?



asked 17 secs ago







Object null reference stuff. Where is it?

Aucun commentaire:

Enregistrer un commentaire