asp.net querystring

<asp:textbox id="txtMfgPartNum"  runat="server" Text='<% Request.QueryString["search"] %>'  />
OR
<asp:textbox id="txtMfgPartNum"  runat="server" Text="<% Request.QueryString["search"] %>"  />

I tried both above. First one does not show the value, 2nd one show invalid code alert.

I just want to see the value inside of the textbox. What should I do?

Thanks,
LVL 1
ITsolutionWizardAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
This is the explanations and solutions I found for your question:
 You cannot use Generic Server Tags (<% ... %>) or Printing Server Tags (<%= somevar %>) as Attributes of a Server Control.  You can use them in normal, non-server tags because they become Literals.  You are, however, allowed to use Binding Server Tags (<%# ... %>) and Prefix Server Tags (<%$ prefix: Argument %>).  (I don't know the official names for any of these things, but I hope you understand what I am talking about.)The caveat is that if you need some sort of dynamic value for the attribute, then the entire attribute has to be in the tag code. So you can rewrite your code like this: <asp:TextBox runat="server" ID="Proof" Text='<%# "http://www.website.com/" + request.querystring("ID") + ".pdf" %>' />Or (my preference) like this: <asp:TextBox runat="server" ID="Proof" Text='<%# String.Format("http://www.website.com/{0}.pdf", request.querystring("ID")) %>' /> Also, if ever need to access something in code for a repeater, you can use the ItemDataBound event for the repeater. There is a special subclass of EventArgs -- RepeaterItemEventArgs -- which gives you access to the item after it is built.

Open in new window

I hope this helps
0
ITsolutionWizardAuthor Commented:
i don't understand. please show me the exact codes solution
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Being on mobile... not so easy...

This should do:
<asp:textbox id="txtMfgPartNum"  runat="server" Text="<%# String.Format("{0}" , Request.QueryString["search"] )%>"  />
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ITsolutionWizardAuthor Commented:
Helpful and quick response.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.