• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 413
  • Last Modified:

VB.net ASPX Binding a Query String to a Controls Property

This should be easy buy I am missing something.   I am trying to bind a Querystring to a controls property and I can't get the syntax right.    If I bind by Index value it will work - like this.

<uc:FindParts runat="server" id="findParts" Nonexact="<%# Request.QueryString(0)%>" />

Open in new window

If I bind by name string I get a "server tag is not well formed.

<uc:FindParts runat="server" id="findParts" Nonexact="<%# Request.QueryString("test")%>" />

Open in new window

What am I missing?
  • 2
1 Solution
Kyle AbrahamsSenior .Net DeveloperCommented:
Try it as a function:
Nonexact="<%# MyFunc() %>"


Public Function MyFunc(obj test) as String
      return Request.QueryString("test").ToString()
end Function
pamsautoAuthor Commented:
The issue fixed by replacing the  double quotes with single quotes.

  <uc:FindParts runat="server" id="findParts" InventoryNumbers='<%# IIf(Request.QueryString("Inv") = "", "", Request.QueryString("Inv"))%>' NonExact='<%# IIf(Request.QueryString("E") = "", True, Request.QueryString("E"))%>' Type='<%# IIf(Request.QueryString("T") = "All", "", Request.QueryString("T"))%>'/>

Open in new window

But you also need to databind the page in the load to grab the querystrings.


Open in new window

pamsautoAuthor Commented:
This is the fix
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.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now