1
Google에서 런타임에 내 페이지에 메소드를 추가 할 수있는 방법이 있습니다. 이 stackoverflow에서 링크가 있어요 .... 그 expando 개체입니다.ascx에서 aspx 페이지의 정적 메소드를 동적으로 추가하십시오.
나는 expando 객체에 익숙하지 않습니다. 여기에 내가 많은 aspx 페이지에서와 같은 아래 를 루틴을 추가 할 필요가 내 상황에 따라 약간의 내가 가진 코드의 조각과 같은
namespace DynamicDemo
{
class ExpandoFun
{
public static void Main()
{
Console.WriteLine("Fun with Expandos...");
dynamic student = new ExpandoObject();
student.FirstName = "John";
student.LastName = "Doe";
student.Introduction=new Action(()=>
Console.WriteLine("Hello my name is {0} {1}",student.FirstName,student.LastName);
);
);
Console.WriteLine(student.FirstName);
student.Introduction();
}
}
}
이다.
[WebMethod]
public static string LoadData(string CountryCode,int PageIndex)
{
string strData = "";
if (CountryCode != "")
{
strData = Left1.HavingCountry(CountryCode, PageIndex);
}
else
{
strData = Left1.WithoutCountry(PageIndex);
}
return strData;
}
는 그래서는 특정 ASCX 호스트의 모든 영문 페이지에 위의 방법을 추가 할 것입니다 내 ASCX 페이지에서 몇 가지 기술을 추가 할 수있는 방법이 있음을 알아야합니다. 그것을 성취하도록 도와주세요. 감사합니다.