Posted on: 8/14/2014 5:26:59 PM | Views : 408

i have got the following user control
<uc1:TextSearch runat="server" ID="tsClientName" HistoryQueryStringParameter="CN" LabelText="Client Name" /> i am trying to retrieve value of tsClientName field with the following code

TextBox txtbox = (TextBox)pnlAdvancedSearch.FindControl("tsClientName"); string var = txtbox.Text.ToString() but i getting the below error
Unable to cast object of type 'ASP.usercontrols_gridviewsearch_textsearch_ascx' to type 'System.Web.UI.WebControls.TextBox' he user control field got the following code
<asp:TextBox runat="server" ID="txt" MaxLength="20" CssClass="title" />   ...

Go to the complete details ...