ItemIndex out of bounds within .NET webtier
Hello
I am trying to get Report Builder to work with .NET
I have used the example mentioned in my other post (Problems with .NET demo)
to create an activeX control which I can now debug
My scenario is -
One webform with 2 edit boxes. This form is the one that is to provide
Report.aspx with a form and a querystring
Source is below
<%@ Page language="c#" validateRequest="false" Codebehind="WebForm2.aspx.cs"
AutoEventWireup="false" Inherits="WebApplication1.WebForm2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
WebForm2
ReportType3ReportPeriodJuly
2005">
When my form's page_load method is called I redirect to the report builder
page report.aspx
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (Page.IsPostBack)
{
Response.Redirect("report.aspx?content=Viewer&name=Thang&volume=Report
Database;frameset=0");
}
}
I have 3 problems here
Firstly - and most importantly, I am getting an itemindex out of bounds
exception when I call ProcessWebRequest within the control. Even though we
purchased report builder server enterprise, we do not have the code for the
server for some reason? I need to be able to trace into the rsWebTier.pas
file. When this error occurs its happening within TStringList.Move - the
first parameter is -1, which is clearly invalid.
Is there a particular order that the parameters have to be provided in on
the querystring?
Secondly string lsForm = Request.Form.ToString(); returns an empty string -
this will cause problems later because the additional parameters box has not
been streamed which means I am missing a lot of information that is required
What do I do next?
I am 99% sure that this problem has nothing to do with my server
Cheers
Paul
I am trying to get Report Builder to work with .NET
I have used the example mentioned in my other post (Problems with .NET demo)
to create an activeX control which I can now debug
My scenario is -
One webform with 2 edit boxes. This form is the one that is to provide
Report.aspx with a form and a querystring
Source is below
<%@ Page language="c#" validateRequest="false" Codebehind="WebForm2.aspx.cs"
AutoEventWireup="false" Inherits="WebApplication1.WebForm2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
WebForm2
ReportType3ReportPeriodJuly
2005">
When my form's page_load method is called I redirect to the report builder
page report.aspx
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (Page.IsPostBack)
{
Response.Redirect("report.aspx?content=Viewer&name=Thang&volume=Report
Database;frameset=0");
}
}
I have 3 problems here
Firstly - and most importantly, I am getting an itemindex out of bounds
exception when I call ProcessWebRequest within the control. Even though we
purchased report builder server enterprise, we do not have the code for the
server for some reason? I need to be able to trace into the rsWebTier.pas
file. When this error occurs its happening within TStringList.Move - the
first parameter is -1, which is clearly invalid.
Is there a particular order that the parameters have to be provided in on
the querystring?
Secondly string lsForm = Request.Form.ToString(); returns an empty string -
this will cause problems later because the additional parameters box has not
been streamed which means I am missing a lot of information that is required
What do I do next?
I am 99% sure that this problem has nothing to do with my server
Cheers
Paul
This discussion has been closed.
Comments
Have you tried this using Delphi only (take dot net out of the equation). I
do not think this related to .NET at all.
Have you checked out the Custom Parameter demos included with RB Server
Edition (see article below).
Perhaps modify one of the examples that we provided so that it demonstrates
what you are trying to accomplish. le Email to support@digital-metaphors.com
in zip format and we can check out here.
From looking at your code below, I do not understand it. Looks like a form
with some parameters, but the redirect does not appear to provide the
parameters as part of the URL. (see article below)
The parameter values will be part of the request that passed to ASP.NET
(Delphi WebBroker works the same way). As far as calling Form.ToString on a
.NET or ASP.NET form, I would not expect that method to return anything. In
.NET every class has a ToString() method but there is no requirement for the
method to return anything. The most it would return would be the name or
caption maybe. ASP.NET forms are not streamed. There are classes that
generate HTML and process web request. The request/response mechanism is
standard HTTP and HTML. If you do not have a solid understanding of this,
consult some books or other references. It can be very helpful to understand
it.
---------------------------------------------
Tech Tips: How can I request that the webtier
execute a specified report?
---------------------------------------------
Question:
---------
Without using the Web ReportExplorer, how can I request that the webtier
execute a specified report?
Solution:
---------
The webtier processes requests for web content. These requests consists of
1. The URL for the webtier
example: http://127.0.0.1/rbWebPub/report.dll
2. A parameter specifying the content type.
example: content=viewer
{note: content=viewer, is used to request report viewer content.}
3. Additional parameters that are specific to the content request.
volume=Report Forms (the volume name)
Name=Basic\Biolife Table (the full path name to the report)
frameset=1 (show the framset with the toolbar etc., this is required)
Use a web browser to access the webtier demo that displays the report
explorer.
Notice that when you place the mouse over a report in the report explorer
that the status bar in IE shows the url plus some params. That is the string
required to run the report on the web tier.
Example:
http://127.0.0.1/rbWebPub/report.dll?content=viewer&volume=Report
Forms&name=Basic\Biolife Table&framset=1
So the parameters here are
content=viewer (type of content is report viewer)
volume=Report Forms (the volume name)
Name=Basic\Biolife Table (the full path name to the report)
frameset=1 (show the framset with the toolbar etc., this is required)
4. AutoSearch Parameters
To specify autosearch parameters for a report, include the parameter
'newsearch=T' followed by the autosearch parameters.
AutoSearch parameters have the following naming convention: asgXfYse and
asgXfYsa.
The asgX specifies the autosearch group number, where X is the number. The
fY specifies the field number, where Y is the number. The se indicates that
the value is a search expression and the sa specifies that the value is the
"show all" boolean expression.
Example:
content=viewer
newsearch=T
asg0f0se=S
asg0f0sa=false
-------------------------------------------------------
Tech Tips: RB Server and Custom Parameters
-------------------------------------------------------
The RBServer Custom Parameter demos show how to define custom session and
report level parameters that can be used to implement security and other
types of custom processing.
The are three projects that work together. Each project includes a
ReadMe.doc and commented code.
1. RBServer\Demos\Servers\Custom Parameters
2. RBServer\Demos\WebTier\Custom Parameters
3. RBServer\Demos\Clients\Custom Parameters
The demos include examples of how to...
1. Define Custom Session parameters.
A custom login form is displayed. Based upon the login, the catalog of
reports available to the user is filtered.
2. Define Custom Report parameters
A custom parameter form is displayed. The parameters are used by the report.
3. Custom AutoSearch form
A custom autosearch form is displayed. The parameter values are used by the
autosearch criteria.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I have not been working on this area today (Thurs) but would like to get
back to it tomm
Cheers
Paul
I researched this and have now modified the example - please download it
again.
The 'Request.Form.ToString()' method call is the problem.
- Request is of type HttpRequest.
- The Request.Form property is of type NameValueCollection and represents
the form parameters (a better name for the property would be
FormParameters).
- the NameValueCollection class does not override ToString() and thus the
call will not work.
I modified the Page_Load method to call a new GetFormParametersAsString
method
private void Page_Load(object sender, System.EventArgs e)
{
string lsQueryString = Request.QueryString.ToString();
string lsFormParameters = GetFormParametersAsString(Request.Form);
string lsWebResponse = (_iRBWebTier.ProcessWebRequest(lsQueryString,
lsFormParameters));
Response.Write(lsWebResponse);
}
protected string GetFormParametersAsString(NameValueCollection
aFormParameters)
{
StringBuilder lStringBuilder = new StringBuilder(aFormParameters.Count);
string lsValue;
foreach(string lsKey in aFormParameters)
{
lsValue = aFormParameters[lsKey];
lStringBuilder.Append(lsKey + "=" + lsValue + "/n");
}
return lStringBuilder.ToString();
}
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I am still having problems with this
I cant any parameters into the name value list
Is there any chance that you could add a page to your demo that posts the
information to your report.aspx page?
When I put all of the information I require into the querystring instead of
using form content, I still get problems as it tries to use some of the info
on the querystring to form a component name
I removed a part of the querystring that appeared as though it could cause
problems and I then get back to the ItemIndex out of bounds error that
started all this off
Cheers
Paul
Just one more question
How do you specify the action in .NET?
With ASP I just say report.dll/OLR for my action called OLR, but I am not
sure how this is done in .NET
Cheers
Paul
- I did not quite understand this part of your message "I cant any
parameters into the name value list"
(perhaps you mean add or access?)
- One option is to modify the demo and send it to
support@digita-metaphors.com in zip format. Then we can look at it here and
try to get it working. Another option is to post here and let me know
specifically what you like to see. Then I canl try to create an enhanced
version of the demo.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I am now using everything from the querystring, tomorrow (Tues) I am going
to try again as I wont be using hidden fields the fact that I still cant get
the demo working for streaming the form is not a problem.
I will try to send you the code I have
I think I meant add sorry!
Can you reply to my action question please?
I am hoping that when I try the querystring approach I dont get this
itemindex error back but I think I probably will
Cheers
Paul
From my understanding of ASP.NET, it is page based. You use the aspx
extension to request pages and each page corresponds to an ASP.NET Page
class descendant. The Page class processes the web request and generates the
response.
To my knowledge there is no concept of the Action that is used in the Delphi
WebBroker architecture.
I think your options are to use parameters for the actions or create a
separate aspx (i.e. Page class descendant) for each action.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
If I went for creating a separate page class descendant for each action, how
do I associate the page with the required action?
Cheers
Paul
I think with ASP.NET you can call a page in two different ways. Lets say we
have Page1 and Page2. We display Page 1 and want to call Page 2.
a. If Page1 is a form that is submitted, then Page1 can contain code to
redirect to Page2. In other words you have page1 call page2.
b. Page1 html could contain a link to Page2.aspx so that the user can click
on the link to invoke the page2.aspx directly.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I have the a) situation, in my page_load, if its not the first time that
page 1 has been loaded, I assume that a post has occured and I redirect to
page 2 (both are aspx pages)
I think I might have to go down the parameter route as I cant think of any
way of calling my OLR action otherwise
Cheers
Paul
I am not fully understanding what all the pieces are and what you are trying
to accomplish. The OLR action is something that you writing in .NET code or
is it something that is written in Delphi code? If its part of your COM
appilcation written in Delphi then you would either call it via a parameter
to the ProcessRequest method or you could add a method to the TypeLibrary to
call it directly.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
library
The OLR is an action within my webtier
Hopefully you will be around for next hour or so - am about to give it
another go and see if I can avoid the ItemIndex out of bounds error
Cheers
Paul
Thanks for all your help - .NET now works with my reports
Cheers
Paul
PS - Please can you look at my next q asap - the TeeChart with webreports
post
Congrats! Glad to hear its working
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Just need reply to my TeeChart post now
Need to know if it is possible to do things like bring up the customize
chart screen, etc from report builder
Cheers
Paul