473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

QueryString not returning anything

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["Category"]%>'
AllowSorting="True" PageSize="5" bordercolor="White"
BORDERWIDTH="1px" GRIDLINES="Horizontal" CELLPADDING="0"
Width="630px">

Using this code to test, the value is displayed correctly on the same
page.
<script language="javascript">
alert('<%=Request.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 1576
Hi Landes,
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataGrid1.DataSource = Pfc.PfcCentreExceptions.Current.DataSet;
DataGrid1.DataBind();
}
}
</script>

<asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="False"
DataMember='<%# "ExceptionCategoryId_" + Request.QueryString["Category"] %>'
AllowSorting="True" PageSize="5" BorderColor="White" BorderWidth="1px"
GridLines="Horizontal" CellPadding="0"
Width="630px">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
a
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>

--
Milosz
"Landes" wrote:
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["Category"]%>'
AllowSorting="True" PageSize="5" bordercolor="White"
BORDERWIDTH="1px" GRIDLINES="Horizontal" CELLPADDING="0"
Width="630px">

Using this code to test, the value is displayed correctly on the same
page.
<script language="javascript">
alert('<%=Request.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(object sender, System.EventArgs e)
{
if(Request.QueryString["test"]!=null)
test = Request.QueryString["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 '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["Category"]%>'
AllowSorting="True" PageSize="5" bordercolor="White"
BORDERWIDTH="1px" GRIDLINES="Horizontal" CELLPADDING="0"
Width="630px">

Using this code to test, the value is displayed correctly on the same
page.
<script language="javascript">
alert('<%=Request.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.comwrote in message
news:11*********************@p10g2000cwp.googlegro ups.com...
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["Category"]%>'
AllowSorting="True" PageSize="5" bordercolor="White"
BORDERWIDTH="1px" GRIDLINES="Horizontal" CELLPADDING="0"
Width="630px">

Using this code to test, the value is displayed correctly on the same
page.
<script language="javascript">
alert('<%=Request.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
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=<%=...
9
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...
2
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 ...
5
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...
9
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...
2
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...
1
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...
2
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...
3
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 =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.