why this "printtext()" fun. not calling?
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string printtext()
{
return "Hello";
}
}
Function calling problem.
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Raja KrishnamurthyRank #3,615 · 403 reputationPosted Mar 11, 2011, 2:12 AM EST
HTH.
Happy Programming!!!
Regards,
Raja
Edit: took off the semicolon.... thanks Vulpes :-)
Krishna GaradRank #191 · 12.8K reputationPosted Mar 11, 2011, 2:15 AM EST
VulpesRank #55 · 29.2K reputationPosted Mar 11, 2011, 2:15 AM EST
<%Response.Write(printtext());%>
Incidentally, Raja's suggestion should also work if you remove the semicolon after the function call:
<%=printtext()%>
Vikas AhlawatRank #2,648 · 525 reputationPosted Mar 11, 2011, 2:37 AM EST