Solved

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

Posted on 2013-05-22
3
399 Views
Last Modified: 2013-05-27
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?
0
Comment
Question by:pamsauto
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 39189135
Try it as a function:
Nonexact="<%# MyFunc() %>"


.VB

Public Function MyFunc(obj test) as String
      return Request.QueryString("test").ToString()
end Function
0
 

Accepted Solution

by:
pamsauto earned 0 total points
ID: 39189251
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.

  Page.DataBind()

Open in new window

0
 

Author Closing Comment

by:pamsauto
ID: 39198795
This is the fix
0

Featured Post

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question