QueryString Problem

  • Thread starter Thread starter Ray Alirezaei
  • Start date Start date
R

Ray Alirezaei

I want to get a parameter through quesry string and set it to a property of
a control in my page as follow but it shows me an error:

<cc1:ReportViewer id="ReportViewer1"
runat="server" Height="312px" width="712px" parameters="true"
ServerUrl="http://localhost/reportserver"
ReportPath="<%=Request.QueryString["rptPath"];%>"> <--Error occurs
here "Server tags cannot contain <% ... %> constructs"
</cc1:ReportViewer>
 
hi Ray,

try with this solution...

incorrect : ReportPath="<% =Request.QueryString["rptPath"];%>
correct: ReportPath="<% Request.QueryString["rptPath"];%>

just remove the "=" at the beginning.

hope this helps,
regards,
CMA
 
Ray, that's correct. You probably want to use the codebehind, and do
something like;

ReportViewer1.ReportPath = Request.QueryString["rptPath"];

in your Page_Load ().
 
Thannks for your reply
No ,I can't use code behind for some reason and I have to do it inline.
MWells said:
Ray, that's correct. You probably want to use the codebehind, and do
something like;

ReportViewer1.ReportPath = Request.QueryString["rptPath"];

in your Page_Load ().

Ray Alirezaei said:
I want to get a parameter through quesry string and set it to a property of
a control in my page as follow but it shows me an error:

<cc1:ReportViewer id="ReportViewer1"
runat="server" Height="312px" width="712px" parameters="true"
ServerUrl="http://localhost/reportserver"
ReportPath="<%=Request.QueryString["rptPath"];%>"> <--Error
occurs
here "Server tags cannot contain <% ... %> constructs"
</cc1:ReportViewer>
 
No,it dosen't work as well now it says:
Parser Error Message: Literal content ('" >') is not allowed within a
'Microsoft.Samples.ReportingServices.ReportViewer'.

Source Error:

Line 16: runat="server" Height="312px" width="712px" parameters="true"
Line 17: ServerUrl="http://localhost/reportserver"
Line 18: ReportPath="<%Request.QueryString["rptPath"];%>"
Line 19: ></cc1:ReportViewer>
Line 20: </form>

CMA said:
hi Ray,

try with this solution...

incorrect : ReportPath="<% =Request.QueryString["rptPath"];%>
correct: ReportPath="<% Request.QueryString["rptPath"];%>

just remove the "=" at the beginning.

hope this helps,
regards,
CMA


Ray Alirezaei said:
I want to get a parameter through quesry string and set it to a property of
a control in my page as follow but it shows me an error:

<cc1:ReportViewer id="ReportViewer1"
runat="server" Height="312px" width="712px" parameters="true"
ServerUrl="http://localhost/reportserver"
ReportPath="<%=Request.QueryString["rptPath"];%>"> <--Error
occurs
here "Server tags cannot contain <% ... %> constructs"
</cc1:ReportViewer>
 
The job of <%= %> is to place the content in the response stream. A server
tag doesn't go to the response stream. It goes to asp.net for processing.

Eliyahu
 
You don't have to use code-behind. You can place the code on the aspx page
in a server script.

Eliyahu

Ray Alirezaei said:
Thannks for your reply
No ,I can't use code behind for some reason and I have to do it inline.
MWells said:
Ray, that's correct. You probably want to use the codebehind, and do
something like;

ReportViewer1.ReportPath = Request.QueryString["rptPath"];

in your Page_Load ().

Ray Alirezaei said:
I want to get a parameter through quesry string and set it to a
property
of
a control in my page as follow but it shows me an error:

<cc1:ReportViewer id="ReportViewer1"
runat="server" Height="312px" width="712px" parameters="true"
ServerUrl="http://localhost/reportserver"
ReportPath="<%=Request.QueryString["rptPath"];%>"> <--Error
occurs
here "Server tags cannot contain <% ... %> constructs"
</cc1:ReportViewer>
 
Do I have access to my control in a sever script?
Eliyahu Goldin said:
You don't have to use code-behind. You can place the code on the aspx page
in a server script.

Eliyahu

Ray Alirezaei said:
Thannks for your reply
No ,I can't use code behind for some reason and I have to do it inline.
MWells said:
Ray, that's correct. You probably want to use the codebehind, and do
something like;

ReportViewer1.ReportPath = Request.QueryString["rptPath"];

in your Page_Load ().

I want to get a parameter through quesry string and set it to a property
of
a control in my page as follow but it shows me an error:

<cc1:ReportViewer id="ReportViewer1"
runat="server" Height="312px" width="712px" parameters="true"
ServerUrl="http://localhost/reportserver"
ReportPath="<%=Request.QueryString["rptPath"];%>"> <--Error
occurs
here "Server tags cannot contain <% ... %> constructs"
</cc1:ReportViewer>
 
Why not? The aspx code inherits from codebehind. It can access any public
and protected members.

Eliyahu

ALI-R said:
Do I have access to my control in a sever script?
Eliyahu Goldin said:
You don't have to use code-behind. You can place the code on the aspx page
in a server script.

Eliyahu

Ray Alirezaei said:
Thannks for your reply
No ,I can't use code behind for some reason and I have to do it inline.
"MWells" <outbound__at_sygnal.com> wrote in message
Ray, that's correct. You probably want to use the codebehind, and do
something like;

ReportViewer1.ReportPath = Request.QueryString["rptPath"];

in your Page_Load ().

I want to get a parameter through quesry string and set it to a property
of
a control in my page as follow but it shows me an error:

<cc1:ReportViewer id="ReportViewer1"
runat="server" Height="312px" width="712px" parameters="true"
ServerUrl="http://localhost/reportserver"
ReportPath="<%=Request.QueryString["rptPath"];%>"> <--Error
occurs
here "Server tags cannot contain <% ... %> constructs"
</cc1:ReportViewer>
 
Thanks very much indeed ,I got it working now
Eliyahu Goldin said:
Why not? The aspx code inherits from codebehind. It can access any public
and protected members.

Eliyahu

ALI-R said:
Do I have access to my control in a sever script?
Eliyahu Goldin said:
You don't have to use code-behind. You can place the code on the aspx page
in a server script.

Eliyahu

Thannks for your reply
No ,I can't use code behind for some reason and I have to do it inline.
"MWells" <outbound__at_sygnal.com> wrote in message
Ray, that's correct. You probably want to use the codebehind, and do
something like;

ReportViewer1.ReportPath = Request.QueryString["rptPath"];

in your Page_Load ().

I want to get a parameter through quesry string and set it to a
property
of
a control in my page as follow but it shows me an error:

<cc1:ReportViewer id="ReportViewer1"
runat="server" Height="312px" width="712px" parameters="true"
ServerUrl="http://localhost/reportserver"
ReportPath="<%=Request.QueryString["rptPath"];%>"> <--Error
occurs
here "Server tags cannot contain <% ... %> constructs"
</cc1:ReportViewer>
 
Back
Top