Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
hi all,

i got the given error, please let me know if anybody knows this..


Operator '+' cannot be applied to operands of type 'string' and 'method group'



XML
Source Error:

Line 190:
Line 191:                strsubject = Session["user_name"] + " - Updated Account";
Line 192:                strbody = " Hi " + Session["user_name"] + ",<br>" + "      You have successfully Allocated new Destination details. Please find the details below:<br><br> " + "       Access Number      - '" + accessnumber + "' <br>" + "       Destination Number  - '" + TextBoxDest.Text.Trim + "'     <br>" + "       Reference Name     - '" + TextBoxRef.Text.Trim + "'     <br><br>";
Line 193:                strbody = strbody + " Thank you for choosing this.<br><br>.";
Line 194:                if (Session["user_email"] != null)






my code is:

C#
string strsubject = null;
                string strtoaddress = null;
                string strbody = null;
                string strcc = null;
                string strbcc = null;

                strsubject = Session["user_name"] + " - Updated Account ";
                strbody = " Hi " + Session["user_name"] + ",<br>" + "      You have successfully Allocated new Destination details. Please find the details below:<br><br> " + "       Access Number      - '" + accessnumber + "' <br>" + "       Destination Number  - '" + TextBoxDest.Text.Trim + "'     <br>" + "       Reference Name     - '" + TextBoxRef.Text.Trim + "'     <br><br>";
                strbody = strbody + " Thank you for choosing this .<br><br>.";
                if (Session["user_email"] != null)
                {
                    strtoaddress = Session["user_email"] + ConfigurationManager.AppSettings["SendMail_from"];
                }
Posted
Comments
macika123 27-Sep-12 11:11am    
That escalated quickly :D. When I came here, there had been no comments, but after submitting mine I saw 4. I simply have to speed up :).

Since you are using C# it needs to be

C#
TextBoxDest.Text.Trim()


Note the parentheses.
 
Share this answer
 
Comments
fjdiewornncalwe 27-Sep-12 11:06am    
+5. Your answer went up as I was putting mine in.
TextBoxDest.Text.Trim should be TextBoxDest.Text.Trim() and
TextBoxRef.Text.Trim should be TextBoxRef.Text.Trim()
 
Share this answer
 
Comments
stellus 27-Sep-12 11:21am    
thank u very much now its working fine..
Well, I can't now access to an ASP.NET server, so it's only a guess, but what about changing
C#
TextBoxRef.Text.Trim
to
C#
TextBoxRef.Text.Trim()
? Simple, I think you missed the brackets.
 
Share this answer
 

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