04-04-2012 12:00 AM
On my Contact Form, I have a dropdown list which contains some other contacts associated to the current contact. I would like to add a event handler to the dropdown list which when one contact in the list is selected, the contact form will jump to show the selected contact information. How should I implement this in Code? Or more specifically, how to open the contact form with contact id in code?
Thanks a lot!
04-04-2012 07:06 AM
Response.Redirect("Contact.aspx?entityid=" + strSelectedContactID);
window.navigate("Contact.aspx?entityid=" + strSelectedContactID);
04-04-2012 04:31 PM
Thanks a lot for your suggestion.
When I use System.Web.HttpContext.Current.Response.Redirect("CONTACT.aspx?entityid=" + associatedId), I got errors as below:
An exception occurred executing the dynamic method ContactDetails.lbPropertyName_OnChange.
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
Do you know what is wrong?
04-04-2012 04:43 PM
Additional Information. I am handling this is a business rule method like below
public static void lbPropertyName_OnChange(IContactDetails form, EventArgs args)
IContact contact = (IContact)form.CurrentEntity;
string associatedId = Utils.DBUtil.getAssociatedContactID(contact.Id.ToString(), form.lbPropertyName.Text);
System.Web.HttpContext.Current.Response.Redirect("CONTACT.aspx?entityid=" + associatedId);
04-04-2012 05:14 PM
That explains the error.
The quick workaround is to use a C# snippet Action instead of the Code Snippet Action.
If you have a reflection tool, you may want to look at the PanelRefreshService. It has a method called SetContextAndRefresh, it seems as if you can set the Type and ID and have the Client refresh, but I have not tried this myself.