Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Request.QueryString is always null

Posted on 2007-10-08
10
Medium Priority
?
328 Views
Last Modified: 2008-01-09
Hi Experts,

I'm trying to receive a value out of a query string.
In all my other sites it's working fine, but in one site the whole request.querystring is always null.
What might be the reason?
The query in the browser looks like this:
http://server/folder/site.aspx?pid=2
and the page_load:
       protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["pid"] != null)
               int pid = Convert.ToInt32(Request.Params["pid"]));
       }

Please help! Thanks! Regards
0
Comment
Question by:arthrex
10 Comments
 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 20032944
to be very frank i dont see anything wrong in what you are trying to do.
Please check if any configuration is worng. Thats what might go wrong. Code wise its seems ok
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 20032954
u are sure that there is no space after  'pid' like

?pid ="2";
0
 

Author Comment

by:arthrex
ID: 20033040
Thanks for your answers!
There are no spaces.
What config settings do you mean ragi0017?
Thanks!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 20033051
Just try with

Request["pid"]  

is it working ?
0
 

Author Comment

by:arthrex
ID: 20033065
unfortunately
Request["pid"]  is also null
0
 

Author Comment

by:arthrex
ID: 20033073
In DebugMode the value for Request QueryString is {}
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 20033083
Is this is same problem for other pages also in project ?/
0
 

Author Comment

by:arthrex
ID: 20033090
no all other pages are working fine.
maybe it has something to do with the gridview?
the page itself works fine. sending another pid than 1 brings the right result.
just accessing the query in code's not working.

        <asp:SqlDataSource ID="DB" runat="server" ConnectionString="<%$ .... %>"
            SelectCommand="SELECT col1, col2 FROM [table] WHERE ([ProjectID] = @ProjectID)">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="1" Name="ProjectID" QueryStringField="pid"
                    Type="Int32" />
0
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 2000 total points
ID: 20033096
SelectCommand="SELECT col1, col2 FROM [table] WHERE ([ProjectID] = @ProjectID)"


you need to modify the query , query needs to return pid fild in prder to set it

SelectCommand="SELECT col1 as pid, col2 FROM [table] WHERE ([ProjectID] = @ProjectID)"
0
 

Author Comment

by:arthrex
ID: 20034645
thanks it thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

810 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