Showing posts with label textboxes. Show all posts
Showing posts with label textboxes. Show all posts

Tuesday, March 6, 2012

Adding multiple textboxes to PageHeader

I am creating matrix reports programmatically and have come up against a problem where I can only add a single textbox into the pageheader. Writing the report using the report designer software I can add multiple textboxes to the pageheader, however trying to add many of them using the ReportItem object I keep getting a syste.object[] cannot be used in this context. error.

for (int i = 0; i < Items.Count; i++)
{
reportItems.Items = new object[] { CreateTextBox(ItemsIdea.ItemName, ItemsIdea.ItemMessage, ItemsIdea.ItemStyle) };
}

This is the line of code that I am hitting the problem. This works fine, however only inserts the last textbox in the Items Array.

If I change the code to

for (int i = 0; i < Items.Count; i++)

{

reportItems.ItemsIdea = new object[] { CreateTextBox(ItemsIdea.ItemName, ItemsIdea.ItemMessage, ItemsIdea.ItemStyle) };

}

It executes, but fails when trying to render it into XML.

Has anyone managed to get multiple textboxes programatically into the pageheader?In the first approach you are overwriting the Items array with each iteration of the for loop. And in the second approach you are setting each entry in the Items array to a new object array, so you end up with an array of arrays. Instead what you should do is just add the object to the array. Try using the following code.

// create a new array for the text boxes in the header
reportItems.Items = new object[Items.Count];

// iterate though all the Items creating a textbox, which is added to the report items object array
for (int i = 0; i < Items.Count; i++)
{
reportItems.ItemsIdea = CreateTextBox(ItemsIdea.ItemName, ItemsIdea.ItemMessage, ItemsIdea.ItemStyle);
}

Ian

Thursday, February 9, 2012

Adding a value to a URL

i have been told that

="http://www.somewhere.com/" + CStr(Fields!CUNAME.Value)

placed in a textboxes expression field (in the jumptoURL box ) will allow for the URL to be generated, however when i type this in, the report doesnt recognizes it as a hyperlink

any ideas to whet im doing wrong!

Possibly this will help you:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=858533&SiteID=1

Edit: As you can see, the only results that spam will get you is a locked thread.

|||

Jnasch, you post is locked.

Anyhow, the answer is

="javascript:void window.open('http://www.onsemi.com/PowerSolutions/product.do?id=" & CStr(Fields!WEB_PART_NAME.Value) & "','_blank')"

Philippe

|||

Thank you Phillippe. I proposed a similar solution.

|||Thank you very much, this has helped me greatly|||

You're welcome. I know technology can be extremely frustrating at times. Let us know if we can help with anything else.