473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Variables in the HTML part of a web form...

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
Dec 12 '05 #1
7 923
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/
<rl*****@newsgroups.nospam> wrote in message
news:Ok**************@TK2MSFTNGP09.phx.gbl...
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

Dec 12 '05 #2
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:Od**************@TK2MSFTNGP10.phx.gbl...
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/
<rl*****@newsgroups.nospam> wrote in message
news:Ok**************@TK2MSFTNGP09.phx.gbl...
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


Dec 12 '05 #3
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-***@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
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:Od**************@TK2MSFTNGP10.phx.gbl...
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/
<rl*****@newsgroups.nospam> wrote in message
news:Ok**************@TK2MSFTNGP09.phx.gbl...
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



Dec 12 '05 #4
I guess I ended up doing something very similar. I didn't see your response
as this post never showed up in my newsreader. Hence the double post. Using
the web client, i see both posts.

I didn't use const and I had to declare an instance of the class in the code
behind in order for it to be recognized. Even tried it with shared vars, but
that didn't help.

It works as a class... Declare an instance of the class in the code module
and reference that var in the HTML.

Thanks for your input...

"Karl Seguin" wrote:
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/
<rl*****@newsgroups.nospam> wrote in message
news:Ok**************@TK2MSFTNGP09.phx.gbl...
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


Dec 12 '05 #5
You shouldn't need an instance. But if it works, it works I guess.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"rlrcstr" <rl*****@discussions.microsoft.com> wrote in message
news:8B**********************************@microsof t.com...
I guess I ended up doing something very similar. I didn't see your response
as this post never showed up in my newsreader. Hence the double post.
Using
the web client, i see both posts.

I didn't use const and I had to declare an instance of the class in the
code
behind in order for it to be recognized. Even tried it with shared vars,
but
that didn't help.

It works as a class... Declare an instance of the class in the code
module
and reference that var in the HTML.

Thanks for your input...

"Karl Seguin" wrote:
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/
<rl*****@newsgroups.nospam> wrote in message
news:Ok**************@TK2MSFTNGP09.phx.gbl...
> 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
>
>


Dec 12 '05 #6
Oops! I didn't notice the DatabaseColumn reference in the DataBind.Eval
statement. That makes more sense. Sorry.
"Scott M." <s-***@nospam.nospam> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
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:Os**************@TK2MSFTNGP10.phx.gbl...
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-***@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
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:Od**************@TK2MSFTNGP10.phx.gbl...
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/
<rl*****@newsgroups.nospam> wrote in message
news:Ok**************@TK2MSFTNGP09.phx.gbl...
> 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
>
>



Dec 13 '05 #7
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:Os**************@TK2MSFTNGP10.phx.gbl...
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-***@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
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:Od**************@TK2MSFTNGP10.phx.gbl...
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/
<rl*****@newsgroups.nospam> wrote in message
news:Ok**************@TK2MSFTNGP09.phx.gbl...
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



Dec 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dariusz | last post by:
I have a problem where I need to pass two variables using GET from a form I have, to solve a page selection problem I have. The code is written that if a new visitor arrives at the front page of...
9
by: Mark | last post by:
This may be a dumb question but can you tranfer variables stored in a PHP page on one server to a page on a different server via a form POST and be able to access those variables on the new page...
3
by: Robert | last post by:
Hello, Can anyone help with this? On my online order form, I need to send a few variables to my credit-card processor. These variables are for non-secure customer comments, and will be sent...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
6
by: Roman | last post by:
Which is better when passing values between forms?
17
by: Woody Splawn | last post by:
I am finding that time after time I have instances where I need to access information in a variable that is public. At the same time, the books I read say that one should not use public variables...
5
by: Terry On Windigo | last post by:
I think I have figured out my problem but I don't know how to solve it. We are going to start using a forums package and do not want our users to have to login to both our site, and then again to...
2
by: FrankieBakerJr | last post by:
Hello I'm using ASP.NET 2003 on Windows XP SP2. I'm providing a web form that allows users to upload a document (xls, images, doc, pdf, etc) to the server. This part works fine, but after the form...
6
by: nbomike | last post by:
I am trying to integrate a custom page into a shopping cart app written in PHP. The custom page is basically a part finder widget that helps customers find a car part based on the car's make, model,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.