Solved

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

Posted on 2013-05-22
3
390 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

929 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now