InfoPath 2007: Submit button error - infopath

I have a button that has custom code which sends the form data to a database. When I build the custom code, I receive the following error when I click the 'Submit' button.
Things that I have checked:
I don't have any errors in the code.
I have tried all 3 trust levels in the 'Security and Trust' settings of the InfoPath form itself.
System.Security.SecurityException
That assembly does not allow partially trusted callers.
at InfoPath_FormNAme.FormCode.btnSubmit_Clicked(Object sender, ClickedEventArgs e)
at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)

I did have to set the Security Level to 'Full' in order to get the button to work.

Related

SSRS - Link not clickable in .net Report Application

I have a report that specifies a 'Go to URL' action for a textbox. The URL I am using is simply a field from the dataset, so the expression for the URL is something like "=Fields!URLLinkText.Value". When I deploy the report to SSRS Report Manager, the link works fine. It is clickable and opens the URL. However, when I link to the report from the custom asp.Net Reporting Application, the link is not clickable. The cursor of the mouse does not even change when I hover over the link. It seems like the hyperlink/Go To property of the textbox is completely removed. At first, I thought that this had to be an issue with the configuration of the reporting app, which was disabling external hyperlinks. However, I created another report with just one textbox with a Go To Action to go to www.CNN.com and it worked on both the Report Manager and the Report Application...
Any suggestions?
I was just posting about a possibly related issue. It does not involve any custom reporting app though. http://weblogs.asp.net/mnissen/archive/2009/03/26/reporting-services-does-not-display-hyperlink-for-placeholder-with-go-to-url-action.aspx
A few different options you can try: wrap the link in javascript, try "servername:port" instead of the site name if its internal, or try reversing the slashes like http backslash backslash...
You will need to handle the Hyperlink clicked event for your reportviewer control:
Assign the handler in your reportviewer constructor
YourReportViewerControl.Hyperlink += new HyperlinkEventHandler(YourReportViewerControl_Hyperlink);
void YourReportViewerControl_Hyperlink(object sender, HyperlinkEventArgs e)
{
e.Cancel = true;
System.Diagnostics.Process.Start(e.Hyperlink);
}

Sitefinity login failure: "Incorrect Username/Password Combination"

I have a Sitefinity app that just won't let me log in.
I've checked:
Event viewer, no errors.
Sitefinity log files, nothing.
Database - I tried logging in a multitude of times yet it's not even locking the account out.
Checked to make sure the DataConfig points to the correct database.
What could be another reason for it not letting me log in.
Thanks,
Jacques
I had a similar issue, Jacques, and I found that examining the control's properties during the LoginError event showed other errors besides the "Incorrect..." error. Wire up the control's LoginError event and set a breakpoint:
//In Page_Load:
YourControl.LoginError += new EventHandler(YourControl_LoginError);
void YourControl_LoginError(object sender, EventArgs e)
{
//Set a breakpoint here
}
...The Control's .FailureText may say "Incorrect UserName/Password Combination", but if you examine the control's .FailureTextControl.Text, It may have a more specific message.
I hope this gets you started... FWIW, in my case, the problem was that setting the DenyLogonMessageText and Orientation attributes in the markup for the control causes a silent error.

'Go to Report' (drillthrough) action not working in SSRS and ASP.NET

I've recently started working with SSRS 2008 and ASP.Net.
I must develop a report with 3 different levels of detail. So, I decided the best solution was to develop 3 different reports and provide some drill-through mechanism in order to allow navigation. For that, I set the 'Action' property of one of the textboxes to 'Go to report' and set the correct url.
The parameters passed to the report need to be validated first. So, for a matter of flexibility and better user experience I let the user enter the parameters using standard ASP.Net controls. When the user clics on my custom button 'Show report' the following code executes:
ReportViewer2.ServerReport.ReportPath = ".. my report path ..";
ReportViewer2.ServerReport.ReportServerUrl = new Uri(".. my report url ..");
ReportParameter p1 = new ReportParameter("dateStart", dateStart.ToString());
ReportParameter p2 = new ReportParameter("dateEnd", dateEnd.ToString());
ReportViewer2.ServerReport.SetParameters(p1);
ReportViewer2.ServerReport.SetParameters(p2);
ReportViewer2.ServerReport.Refresh();
Then the report is shown, but the links for navigating to the other reports don't work.
You may notice that the parameters added are visible, thus letting me press the 'View Report' button wich is embedded inside the report viewer. If I do so, the report is rendered again and then everithing is Ok. It's like the ReportViewer.ServerReport.Refresh() method is missing something.
That's a problem, because the requirements states that the parameteres need to be hidden.
When I execute the report from inside VS or the Report Server the links work ok, but in those cases I always must press the standard 'View Report' button.
Is this a bug of the ReportViewer control or am I missing something here?
Thanks in advance.
Regards,
Gonzalo.
The report viewer contains an update panel. You must call the Update method of the update panel in the pre-render event of the report viewer:
protected void ReportViewer2_PreRender(object sender, EventArgs e)
{
((UpdatePanel)this.ReportViewer2.Controls[1]).Update();
}

Show CreateUserWizard's error message label

I've got a CreateUserWizard control and am performing server-side validation. Is there a way to force the CUW's error message to display from the code-behind? At the moment, if the user enters a duplicate name, the controls DuplicateUserNameErrorMessage property is displayed. However, if the user has turned javascript off, or sends a custom POST header, with invalid characters, I rely on my server-side validation to catch the error. How can I then display the same error message in the control's ErrorMessage label, instead of creating a custom label and faking it?
Edit: Just to clarify, the server side validation tests various aspects. Duplicate user was just an example of when the ErrorMessage label gets called by the control.
Thanks
Update:
Here is something that will work, but requires private reflection:
void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e) {
typeof(CreateUserWizard).GetField(
"_unknownErrorMessage",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
.SetValue(sender, "My error message");
e.Cancel = true;
}
Basically, you set this field to the error message you want, and CreateUserWizard picks it up. Being private reflection, it's not a 'supported' technique, but it's at least an option to consider if nothing else works.
I don't think you should have to do anything special for this to work. Generally, anything that supports client side validation has matching server side validation logic. In fact, for something like duplicate name, there is only server side validation, so I wouldn't think that turning off javascript should affect the scenario.
What exactly are you seeing when you disable javascript and you post a duplicate name? ARe you able to repro this issue with a simple page, or is there some added factors that could affect it?
I tried with a plain CUW and disabled javascript, and the duplicate user error was correctly displayed.

InfoPath Submit functionality

I need to save my InfoPath form regardless of whether the required fields have been entered when the user clicks on a button. Is there a way to turn off validation for the InfoPath form temporarily?
By save i assume that you mean that you want to save the xml data file locally rather than submit your form to a datastore (webservice, sharepoint etc)
In tools>form options you can enable "save/save as" on the form (i think this is on by default) it will complain that there are validation errors but still allow you to save.
There is also save via code-behind using which will not go through the validation routine but will require that the form is fully trusted as it needs access resources that Infopath forms are normally restriced from using.
VB.Net
Me.SaveAs("c:\temp\myfile.xml")
C#
this.SaveAs("c:\temp\myfile.xml");
Or as Chris suggested allow nulls as part of your data source.
In my form, I required a button ("Save As Draft") that would submit the form to a SharePoint library even when validation errors were present.
This code-behind function worked for me:
public void SaveAsDraftButton_Clicked(object sender, ClickedEventArgs e)
{
this.Errors.DeleteAll();
this.Submit();
}
I've done similar by including radio buttons on the form with the labels 'I have completed this form and am ready to submit' and 'I am not done with this form. Save it and finish later'. Each validation then look something like (validation OR saveOptions == 'complete'). The submits similarly use this field to decide what actions to take.
You will have to write your own validation code in the code behind file and have it validate when the user clicks the submit button or not when you just want to have the code.
Another approach is to have the fields allow null values and only validate when they have text in them. This method would not require custom code.

Resources