我有3个伙伴关系。 NET pages. 每种方法都有自己的GetSearchResult方法,产生不同的搜索结果,并填写了GridView。 每一页都用一个助手班的共享助手方法。
现在,在这个助手类别中,我想执行这一“
这是可能的吗? 如果是的话,我如何这样做?
我有3个伙伴关系。 NET pages. 每种方法都有自己的GetSearchResult方法,产生不同的搜索结果,并填写了GridView。 每一页都用一个助手班的共享助手方法。
现在,在这个助手类别中,我想执行这一“
这是可能的吗? 如果是的话,我如何这样做?
采用“GetSearchResult”方法作为助手方法的参数。 这将使助手方法能够进入打电话者的方法。 你们需要建立一个接口来做到这一点。
public interface ISearchable
{
void GetSearchResult();
}
public class MyPage : Page, ISearchable
{
public void GetSearchResult() {
HelperClass.HelperMethod(this); // Pass in
}
}
public static class HelperClass
{
public static void HelperMethod(ISearchable page) {
page.GetSearchResult();
}
}
You could pass a reference to the page as an argument to the helper method, and call GetSearchResult again on the page. (Ideally, your page should implement an interface, say ISearchPage, that contains the method GetSearchResult)
[Edit:在我打上上述字时,David Anderson在其答复中提供了密码]
或者,根据你的助手方法,在助手的物体上设定了身份标志(或使用身份清单)。 在你的网页上,你可以读到这一旗帜或高价值,如果情况表明GetSearchResult应当重新命名,则再次叫它。
In my webpages I have references to js and images as such: "../../Content/Images/"Filename" In my code if I reference a file as above, it doesnt work so i have to write: "c:/miscfiles/"filename" 1-...
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
I m looking for best practices here. Sorry. I know it s subjective, but there are a lot of smart people here, so there ought to be some "very good" ways of doing this. I have a custom object called ...
I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...
i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...
For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!