Request.QueryString is always null

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:
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
Who is Participating?
Pratima PharandeConnect With a Mentor Commented:
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)"
Anurag ThakurTechnical ManagerCommented:
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
Gautham JanardhanCommented:
u are sure that there is no space after  'pid' like

?pid ="2";
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

arthrexAuthor Commented:
Thanks for your answers!
There are no spaces.
What config settings do you mean ragi0017?
Pratima PharandeCommented:
Just try with


is it working ?
arthrexAuthor Commented:
Request["pid"]  is also null
arthrexAuthor Commented:
In DebugMode the value for Request QueryString is {}
Pratima PharandeCommented:
Is this is same problem for other pages also in project ?/
arthrexAuthor Commented:
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)">
                <asp:QueryStringParameter DefaultValue="1" Name="ProjectID" QueryStringField="pid"
                    Type="Int32" />
arthrexAuthor Commented:
thanks it thanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.