English 中文(简体)
参考法
原标题:ObjectDataSource methods can t refernce master page methods

因此,我有目标数据库,它有更新和删除相关方法,而数据交换系统则被并入网格。 在我讲到这些方法时,我想重新播下主页的倒数,其中包含与电网相同的数据,因此,我试图将这种方法称为:

            MyApp MasterPage = (MyApp)Page.Master;
            MasterPage.getData();

现在,如果我从电网(由罗通德事件处理,而不是由DS处理)中插入一句话,那就只做罚款,但配对系统则会产生以下错误:“不把物体提及......”。

我可以看到, as上的某些田地还没有从后台上获得,但是,怎么能够把主页放在依赖它的网页上? 是否应当提及? 是否有后门trick? 我知道,我可以摆脱DS,但我想利用这一系统,使制作和分类变得非常容易。

成就

最佳回答

http://msdn.microsoft.com/en-us/library/dct97kc3.aspx” rel=“nofollow” 你也许能够把你的代码移至主页之后的火力冲上下弹箱的事件。


EDIT:一种替代办法

如果你能够改变该守则,试图将数据储存在主页的一块财产中,那么,一旦开始下降,就会回到主页并获取数据。

protected object SomePropertyICreatedToStoreData {get;set;}

void GetData()
{
    // get the data (this part works already)
    var theData = WhereTheDataComesFrom

    // bind to dropdownlist - doesn t work, so...
    this.SomePropertyICreatedToStoreData = theData;
}

......

     this.MyDropDownList.DataSource = this.SomePropertyICreatedToStoreData;
问题回答

你们需要补充总指令:

<%@ MasterType TypeName ="MasterPageClassName" %>

<%@ MasterType virtualpath="~/Masters/Master1.master" %>

rel=“nofollow”>http://msdn.microsoft.com/en-us/library/xxwa0ff0.aspx

<>Update: 评论中指出的分门别类Name和虚拟厅。





相关问题
Anyone feel like passing it forward?

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. ...

How to Add script codes before the </body> tag ASP.NET

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 ...

Transaction handling with TransactionScope

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 ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

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!

热门标签