QueryString Problem

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>
 
C

CMA

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
 
M

MWells

Ray, that's correct. You probably want to use the codebehind, and do
something like;

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

in your Page_Load ().
 
R

Ray Alirezaei

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>
 
R

Ray Alirezaei

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>
 
E

Eliyahu Goldin

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
 
E

Eliyahu Goldin

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>
 
A

ALI-R

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>
 
E

Eliyahu Goldin

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>
 
A

ALI-R

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top