Click here to Skip to main content
15,879,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
protected void grdmissedapp_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Message")
            {
                GridViewRow row = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                HiddenField hdnEmail = (HiddenField)row.Cells[2].FindControl("hdnEmail");
                string email = e.CommandArgument.ToString();
                if (!string.IsNullOrEmpty(email))
                {
                    Outlook.Application oApp = new Outlook.Application();
                    Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
                   oMailItem.To = email;
                    // body, bcc etc...
                    oMailItem.Display(true);
                }
            }
            if (e.CommandName == "Call")
            {
                GridViewRow row = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                Label lblcall = (Label)row.Cells[1].FindControl("lblcall");
                ImageButton btncall = (ImageButton)row.Cells[1].FindControl("btncall");

                if (lblcall != null)
                {
                    lblcall.Visible = true;
                    lblcall.Text = e.CommandArgument.ToString();
                    btncall.Visible = false;
                }
            }
        }



on calling above method locally it works fine but when i upload it on server it not working error shows

"Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: That assembly does not allow partially trusted callers."

this error also occur locally but works fine
Posted

 
Share this answer
 
Comments
itsathere 19-Dec-14 8:03am    
i already checked that and also checked

http://msdn.microsoft.com/en-us/library/system.security.allowpartiallytrustedcallersattribute.aspx

but on changes page show many errors
At the top of your .aspx page, set EnableEventValidation to false.
 
Share this answer
 
Comments
itsathere 29-Dec-14 9:10am    
it's not aspx page above code is in usercontrol.ascx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900