Solved

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

Posted on 2013-05-22
3
386 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 39

Expert Comment

by:Kyle Abrahams
Comment Utility
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
Comment Utility
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
Comment Utility
This is the fix
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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.
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…

743 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

12 Experts available now in Live!

Get 1:1 Help Now