c# - Display variable in textbox -


in asp.net page have search box working expected. leave searched value in textbox after searching (the search opens new page, though i'm retaining search value querystring). can confirm variable being retained correctly using value <%= search%> in aspx, when try show in textbox nothing displays. have searched dozens of forum posts , nearest can tell need databind textbox. i'm not sure mistake is, closest have come with:

<asp:textbox id="searchtextbox" runat="server" text='<%# search %>'></asp:textbox> search: <%=search %> 

with code behind

public string search;  protected void page_load(object sender, eventargs e) {     search = request.querystring["search"];     searchtextbox.text = search;     page.databind(); } 

you have check if first time see page this

 if (page.ispostback == false)         {  } 

and check first if query string exist.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -