I use a lot of ObjectDataSources (ods) in my website projects. Almost all of my ods's use SessionParameters; typing the session parameter name into the SessionField property of the ods is annoying and prone to typos.
我在我的网站项目中使用了很多ObjectDataSources(ods)。几乎所有的od都使用SessionParameters;将会话参数名称键入ods的SessionField属性是烦人的并且容易出现拼写错误。
I have a static SessionParams class where I store all the session parameter names, is it possible to reference the members of that class in the ods? I've tried to do it, but it never worked.
我有一个静态的SessionParams类,我存储了所有会话参数名称,是否可以在ods中引用该类的成员?我试过这样做,但它从未奏效。
Here's what i have now:
这就是我现在拥有的:
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetStuff" TypeName="RM.Stuff">
<SelectParameters>
<asp:SessionParameter SessionField="HAVE_TO_TYPE_EVERY_TIME" Name="somename" Type="Int32" />
</SelectParameters>
Here's what i want:
这就是我想要的:
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetStuff" TypeName="RM.Stuff">
<SelectParameters>
<asp:SessionParameter SessionField='<%= RM.SessionParams.SESSION_PAREMETER_NAME %>' Name="somename" Type="Int32" />
</SelectParameters>
1 个解决方案
#1
as far as i know, these parameters are not databind-able (also the defaultvalue). but you can assign them @codebhind
据我所知,这些参数不是数据绑定(也是默认值)。但你可以指定它们@codebhind
#1
as far as i know, these parameters are not databind-able (also the defaultvalue). but you can assign them @codebhind
据我所知,这些参数不是数据绑定(也是默认值)。但你可以指定它们@codebhind