Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 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