473,772 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

QueryString not returning anything

Hiya,

I have the following code in a C# aspx page, but I keep getting the
error that 'ExceptionCateg oryId_' not found. Looks like the
QueryString is not returning anything.

<asp:DataGrid id=DataGrid1 runat="server"
AutoGenerateCol umns="False" DataSource ="<%#
Pfc.PfcCentreEx ceptions.Curren t.DataSet %>" DataMember
='ExceptionCate goryId_<%=Reque st.QueryString["Category"]%>'
AllowSorting="T rue" PageSize="5" bordercolor="Wh ite"
BORDERWIDTH="1p x" GRIDLINES="Hori zontal" CELLPADDING="0"
Width="630px">

Using this code to test, the value is displayed correctly on the same
page.
<script language="javas cript">
alert('<%=Reque st.QueryString["Category"]%>');
</script>

Can anyone point me to some clues on where I have gone wrong? I'm
obviously missing something here which i can't figure out. :( Anyone
with any idea to help will be greatly appreciated, thanks!

Feb 22 '07 #1
4 1594
Hi Landes,
<script runat="server">
protected void Page_Load(objec t sender, EventArgs e)
{
if (!IsPostBack)
{
DataGrid1.DataS ource = Pfc.PfcCentreEx ceptions.Curren t.DataSet;
DataGrid1.DataB ind();
}
}
</script>

<asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateCol umns="False"
DataMember='<%# "ExceptionCateg oryId_" + Request.QuerySt ring["Category"] %>'
AllowSorting="T rue" PageSize="5" BorderColor="Wh ite" BorderWidth="1p x"
GridLines="Hori zontal" CellPadding="0"
Width="630px">
<Columns>
<asp:TemplateCo lumn>
<ItemTemplate >
a
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>

--
Milosz
"Landes" wrote:
Hiya,

I have the following code in a C# aspx page, but I keep getting the
error that 'ExceptionCateg oryId_' not found. Looks like the
QueryString is not returning anything.

<asp:DataGrid id=DataGrid1 runat="server"
AutoGenerateCol umns="False" DataSource ="<%#
Pfc.PfcCentreEx ceptions.Curren t.DataSet %>" DataMember
='ExceptionCate goryId_<%=Reque st.QueryString["Category"]%>'
AllowSorting="T rue" PageSize="5" bordercolor="Wh ite"
BORDERWIDTH="1p x" GRIDLINES="Hori zontal" CELLPADDING="0"
Width="630px">

Using this code to test, the value is displayed correctly on the same
page.
<script language="javas cript">
alert('<%=Reque st.QueryString["Category"]%>');
</script>

Can anyone point me to some clues on where I have gone wrong? I'm
obviously missing something here which i can't figure out. :( Anyone
with any idea to help will be greatly appreciated, thanks!

Feb 22 '07 #2
Example:

//Codebehind:
protected string test = "";
private void Page_Load(objec t sender, System.EventArg s e)
{
if(Request.Quer yString["test"]!=null)
test = Request.QuerySt ring["test"];

//Page (ASPX):
<script>
var test ='<%=test %>'
alert( test);
</script>

Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Landes" wrote:
Hiya,

I have the following code in a C# aspx page, but I keep getting the
error that 'ExceptionCateg oryId_' not found. Looks like the
QueryString is not returning anything.

<asp:DataGrid id=DataGrid1 runat="server"
AutoGenerateCol umns="False" DataSource ="<%#
Pfc.PfcCentreEx ceptions.Curren t.DataSet %>" DataMember
='ExceptionCate goryId_<%=Reque st.QueryString["Category"]%>'
AllowSorting="T rue" PageSize="5" bordercolor="Wh ite"
BORDERWIDTH="1p x" GRIDLINES="Hori zontal" CELLPADDING="0"
Width="630px">

Using this code to test, the value is displayed correctly on the same
page.
<script language="javas cript">
alert('<%=Reque st.QueryString["Category"]%>');
</script>

Can anyone point me to some clues on where I have gone wrong? I'm
obviously missing something here which i can't figure out. :( Anyone
with any idea to help will be greatly appreciated, thanks!

Feb 22 '07 #3

Hiya,

That worked!
Thanks alot! :)

Feb 22 '07 #4
<%= is a shortcut for Response.Write( ). In other words, it sends the
evaluated value to the client response stream. Using it in a pure
server-side definition, like DataMember, has no meaning. DataMember is
intented for things like table names. What are you trying to set it to?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Landes" <la****@gmail.c omwrote in message
news:11******** *************@p 10g2000cwp.goog legroups.com...
Hiya,

I have the following code in a C# aspx page, but I keep getting the
error that 'ExceptionCateg oryId_' not found. Looks like the
QueryString is not returning anything.

<asp:DataGrid id=DataGrid1 runat="server"
AutoGenerateCol umns="False" DataSource ="<%#
Pfc.PfcCentreEx ceptions.Curren t.DataSet %>" DataMember
='ExceptionCate goryId_<%=Reque st.QueryString["Category"]%>'
AllowSorting="T rue" PageSize="5" bordercolor="Wh ite"
BORDERWIDTH="1p x" GRIDLINES="Hori zontal" CELLPADDING="0"
Width="630px">

Using this code to test, the value is displayed correctly on the same
page.
<script language="javas cript">
alert('<%=Reque st.QueryString["Category"]%>');
</script>

Can anyone point me to some clues on where I have gone wrong? I'm
obviously missing something here which i can't figure out. :( Anyone
with any idea to help will be greatly appreciated, thanks!

Feb 22 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
17289
by: Arpan | last post by:
A link has the following URL: <a href="Page1.asp?cname=<%= Request.QueryString("cname") %>&cadd1=<%= Request.QueryString("cadd1") %>&cadd2=<%= Request.QueryString("cadd2") %>&cplace=<%= Request.QueryString("cplace") %>">Click</a> Suppose the names in the above querystring have the following values: cname="Danny" cadd1="House 97"
9
1944
by: Fawke101 | last post by:
Hi there, I have a ASP/SQL 7 application that displays data from various SQL7 Views onto a ASP page. A column of this data is displayed in ASP as hyperlinks and the relevent data is put into a URL query string - so that the linked page is based on this data ( a kind of "drill-down" effect) - ***
2
7783
by: Amadelle | last post by:
Hi all, I have multiple frames which I would like to get the query string from within one of the subframes. But when I do HttpContext.Current.Request.QueryString or Request.QueryString doesn't return the parent frame's querystring but the current page's querystring. I was wondering whether anyone knows how to get the parent frame's Querystring through either request object or through javascripting (I have been trying javascripting...
5
2772
by: .NET Developer | last post by:
Ok, this is probably simple but it's been driving me nuts. If I have a URL like this: http://www.mysite.com/MyPage.aspx?MyKey What code would I write to get that value "MyKey" out of the querystring? Without the = and a value after it, is it considered a querystring value still? I've tried Request.Params, Request.QueryString.Key, and nothing is returning the value to me. I've driven down several levels into the debugger and found the...
9
1593
by: VancouverMike | last post by:
Hi there, I run into a very strange problem. I got the following url and am passing information via query string. The problem when the "sin" key in query string is blank, shown as in the following querystring, I got an error message saying "Unterminated string constant" from IE 6.0 and asking me if I want to debug. When I click Yes button, nothing happened and the page just shows up. When I put anything as a value for "sin" key, IE...
2
5014
by: phl | last post by:
Hello, I have aspx(say page.aspx) page which uses javascript to submit a form reload with some unicode characters,upon an button event e.g page.aspx?param=value I get this value in the codebehind and access it via Request.Querystring property.
1
1525
by: Landes | last post by:
Hiya, I have the following code in a C# aspx page, but I keep getting the error that 'ExceptionCategoryId_' not found. Looks like the QueryString is not returning anything. <asp:DataGrid id=DataGrid1 runat="server" AutoGenerateColumns="False" DataSource ="<%# Pfc.PfcCentreExceptions.Current.DataSet %>" DataMember ='ExceptionCategoryId_<%=Request.QueryString%>'
2
5522
by: Doogie | last post by:
Hi, I'm writing Javascript code to parse out a query string. I want to handle the case where a parameter value may not be sent. So consider a parameter called "State". If the user doesn't pass that in if I do this: var state = <%=Request.QueryString%> This returns an undefined object that I can't seem to do any checks
3
1927
by: =?Utf-8?B?ZGlzcGxheW5hbWU=?= | last post by:
I have an ASP page with a button and other things. When the button is clicked, it executes a javascript function which does: document.Form1.method = 'post'; document.Form1.action = "AnotherASPpage.asp?p1=" + allFields1 + "&p2=" + allFields2 + "&p3=" + bVar; document.Form1.submit(); allFields1 represents all the fields in category 1 that user has selected. The fields are delimited by comma.
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7461
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.