Re: Variables in the HTML part of a web form...
- From: "Scott M." <s-mar@xxxxxxxxxxxxx>
- Date: Mon, 12 Dec 2005 22:55:15 -0500
Oops! I didn't notice the DatabaseColumn reference in the DataBind.Eval
statement. That makes more sense. Sorry.
"Scott M." <s-mar@xxxxxxxxxxxxx> wrote in message
news:uk7P9h5$FHA.3864@xxxxxxxxxxxxxxxxxxxxxxx
>I understand and use DataBinder.Eval quite frequently. If you point it to
>a constant that contains a string value, that string value is what it
>should return.
>
>
> "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
> wrote in message news:OsvYz4z$FHA.4012@xxxxxxxxxxxxxxxxxxxxxxx
>> Granted, I haven't tried.
>>
>> But Eval() is a method like any other. The 2nd parameter is the name of
>> the property/column it'll look up through reflection. If you pass
>> "Hello" or a variable with the value of "Hello", I'd expect to get the
>> same result.
>>
>> Karl
>>
>> --
>> MY ASP.Net tutorials
>> http://www.openmymind.net/
>>
>>
>> "Scott M." <s-mar@xxxxxxxxxxxxx> wrote in message
>> news:%23uSmLxz$FHA.3992@xxxxxxxxxxxxxxxxxxxxxxx
>>> I'm not sure this approach will work. At runtime, wouldn't this look to
>>> bind to EName, which has a value of "T003_EntityName_String",
>>> and therefore that is the data you'd get back, not the data that
>>> "T003_EntityName_String" refers to?
>>>
>>>
>>> "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
>>> wrote in message news:OdsjWcz$FHA.4036@xxxxxxxxxxxxxxxxxxxxxxx
>>>> Well, assuming EName is defined something like:
>>>>
>>>> public class DatabaseColumn
>>>> public const EName as string = "T003_EntityName_String"
>>>> end class
>>>>
>>>> you should be able to simply do:
>>>>
>>>> <%# DataBiner.Eval(Container.DataItem, DatabaseColumn.EName) %>
>>>>
>>>> IF DatabaseColumn is in a separate namespace than the page, you'll
>>>> need to either fully reference the namespace OR @Import the namespace.
>>>>
>>>> Karl
>>>>
>>>> --
>>>> MY ASP.Net tutorials
>>>> http://www.openmymind.net/
>>>>
>>>>
>>>> <rlrcstr@xxxxxxxxxxxxxxxxx> wrote in message
>>>> news:Ok4aZFz$FHA.3568@xxxxxxxxxxxxxxxxxxxxxxx
>>>>> The DBA team at the office controls the naming conventions for the
>>>>> database
>>>>> structure, but their naming convention are rather tedious. So
>>>>> typically I
>>>>> create a global module that I use as a mapping file to create
>>>>> constants with
>>>>> more appropriate field and table names and map them to the table and
>>>>> field
>>>>> names required by the DB team. But now, using a DataList, I'm having
>>>>> a
>>>>> problem. How can I use a variable name to indicate the field name in
>>>>> the
>>>>> HTML that's rendered by the DataList control?
>>>>>
>>>>> Rather than
>>>>>
>>>>> <%# DataBiner.Eval(Container.DataItem, "T003_EntityName_String") %>
>>>>>
>>>>> I want to use
>>>>>
>>>>> <%# DataBiner.Eval(Container.DataItem, EName) %>
>>>>>
>>>>> Where EName is a global var defined in a separate module.
>>>>>
>>>>> Is there a way to do this? I'm getting complaints that EName isn't a
>>>>> valid
>>>>> column name...
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Jerry
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
.
- References:
- Variables in the HTML part of a web form...
- From: rlrcstr
- Re: Variables in the HTML part of a web form...
- From: Scott M.
- Re: Variables in the HTML part of a web form...
- From: Scott M.
- Variables in the HTML part of a web form...
- Prev by Date: Re: Variables in the HTML part of a web form...
- Next by Date: Handles !
- Previous by thread: Re: Variables in the HTML part of a web form...
- Next by thread: Re: Variables in the HTML part of a web form...
- Index(es):
Relevant Pages
|