后期绑定问题

编程入门 行业动态 更新时间:2024-10-28 04:23:08
本文介绍了后期绑定问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的VS 2008代码中有以下内容: 参数(0).Value =会话(" User")。CompanyID 我认为这意味着因为没有用户在这一点上,我不能这样做。 但它会在那里而且用户对象有一个CompanyID属性。 如何在我的代码中访问它? 谢谢, Tom

解决方案

我也有同样的问题: Sub SetMoveList_Click(ByVal s As Object,ByVal e As EventArgs) Trace.Warn(在SetMove_Click s.id ="& s.id) Dim oPanel As Panel = s.parent Dim oDLI As DataListItem = s.parent.parent 我在s.id,s.parent和s.parent.parent上收到错误。 我曾经在2003年这样做过 - 我怎么会在这里做同样的事情? 谢谢, Tom " tshad" < tf*@dslextreme写在留言中 新闻:eG ************** @ TK2MSFTNGP04.phx.gbl ...

>我的VS 2008代码中有以下内容: parameters(0).Value = Session(" User")。CompanyID 我认为这意味着因为没有用户在这一点上,我不能这样做。 但它会在那里而且用户对象有一个CompanyID属性。 如何在我的代码中访问它? 谢谢, Tom

" tshad" < tf*@dslextreme写在消息中 新闻:eG ************** @ TK2MSFTNGP04.phx.gbl ...

我的VS 2008代码中有以下内容: parameters(0).Value = Session(" User")。CompanyID 我认为这意味着因为没有用户在这一点上,我不能这样做。 但它会在那里而且用户对象有一个CompanyID属性。 如何在我的代码中访问它?

您似乎使用的是VB.NET而不是C#,所以它可能是 之类的东西: 如果会话(用户)不是,那么 参数(0).Value =会话(" User")。CompanyID 结束如果 - Mark Rae ASP.NET MVP www.markrae

tshad写道:

我的VS 2008代码中有以下内容: 参数(0).Value = Session(" User" ;)。CompanyID 我认为这意味着因为没有用户在这一点上,我不能这样做。 但它会在那里而且用户对象有一个CompanyID属性。 如何在我的代码中访问它?

嗨汤姆, 据我所知,你有CompanyID问题。 当时不知道(或者在VB.NET中有什么不同?)。在这种情况下,您必须将会话(用户)的结果转换为您期望的对象。也许这个 可以帮助你: http:/ /www.codeproject/KB/dotnet...astingNET.aspx Best, Hilmar

I have the following in my VS 2008 code: parameters(0).Value = Session("User").CompanyID I assume this means that since there is no "User" at this point I can''t do this. But it will be there and the User Object has a CompanyID property. How can I access this in my code? Thanks, Tom

解决方案

I also have the same problem with: Sub SetMoveList_Click(ByVal s As Object, ByVal e As EventArgs) Trace.Warn("in SetMove_Click s.id = " & s.id) Dim oPanel As Panel = s.parent Dim oDLI As DataListItem = s.parent.parent I am getting the error on s.id, s.parent and s.parent.parent. I used to do this in 2003 - how would I do the same thing here? Thanks, Tom "tshad" <tf*@dslextremewrote in message news:eG**************@TK2MSFTNGP04.phx.gbl...

>I have the following in my VS 2008 code: parameters(0).Value = Session("User").CompanyID I assume this means that since there is no "User" at this point I can''t do this. But it will be there and the User Object has a CompanyID property. How can I access this in my code? Thanks, Tom

"tshad" <tf*@dslextremewrote in message news:eG**************@TK2MSFTNGP04.phx.gbl...

I have the following in my VS 2008 code: parameters(0).Value = Session("User").CompanyID I assume this means that since there is no "User" at this point I can''t do this. But it will be there and the User Object has a CompanyID property. How can I access this in my code?

You appear to be using VB.NET instead of C#, so it''s probably something like: If Session("User") Is Not Nothing Then parameters(0).Value = Session("User").CompanyID End If -- Mark Rae ASP.NET MVP www.markrae

tshad wrote:

I have the following in my VS 2008 code: parameters(0).Value = Session("User").CompanyID I assume this means that since there is no "User" at this point I can''t do this. But it will be there and the User Object has a CompanyID property. How can I access this in my code?

Hi Tom, as far as I see you have the problem that "CompanyID" is not known at that moment (or is this different in VB.NET?). In that case you have to cast the result of Session("User") to the object you expect. Maybe this helps you: www.codeproject/KB/dotnet...astingNET.aspx Best, Hilmar

更多推荐

后期绑定问题

本文发布于:2023-08-04 17:45:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1298337.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   后期

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!