473,414 Members | 1,631 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,414 software developers and data experts.

Using Global Variables in HTML of 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
6 1947
Jerry,

I think an easier way to do this would be to rename the datatable's fields
when you get them.

Right after you fill your datatable move through each column and name it the
way you want:

DataTable.Columns("T003_EntityName_String").Column Name = "EName"

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rlrcstr" <rl*****@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
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
Can't do that... I have no control over the naming conventions and if I
start changing column names, there will be significant political fall-out.
Unions will file law suits, cats and dogs living together... etc, etc...

But.. I think I figured it out. I created a class with a bunch of public
string vars where I can set the vars equal to whatever they tell me to
actually name the fields. Then I just use an instance of the class in my
code behind and reference it from the HTML. It works.

Now I can code with short names and just fill in the names they want me to
use when they get around to it.

Thanks for the reply.

Jerry

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:un**************@TK2MSFTNGP10.phx.gbl...
Jerry,

I think an easier way to do this would be to rename the datatable's fields
when you get them.

Right after you fill your datatable move through each column and name it the way you want:

DataTable.Columns("T003_EntityName_String").Column Name = "EName"

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rlrcstr" <rl*****@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
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
See other [identical] post for answer

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"rlrcstr" <rl*****@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
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
Good solution. But I don't understand why you can't just rename the columns.
That doesn't rename them in the actual database...
But I'm glad you found a solution you're happy with!
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<rl*****@newsgroups.nospam> wrote in message
news:u1**************@TK2MSFTNGP15.phx.gbl...
Can't do that... I have no control over the naming conventions and if I
start changing column names, there will be significant political fall-out.
Unions will file law suits, cats and dogs living together... etc, etc...

But.. I think I figured it out. I created a class with a bunch of public
string vars where I can set the vars equal to whatever they tell me to
actually name the fields. Then I just use an instance of the class in my
code behind and reference it from the HTML. It works.

Now I can code with short names and just fill in the names they want me to
use when they get around to it.

Thanks for the reply.

Jerry

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:un**************@TK2MSFTNGP10.phx.gbl...
Jerry,

I think an easier way to do this would be to rename the datatable's
fields
when you get them.

Right after you fill your datatable move through each column and name it

the
way you want:

DataTable.Columns("T003_EntityName_String").Column Name = "EName"

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rlrcstr" <rl*****@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
> 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
Ahhh, but check out Karl's reply. I think that's the way to go!

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:%2***************@TK2MSFTNGP14.phx.gbl...
Good solution. But I don't understand why you can't just rename the
columns. That doesn't rename them in the actual database...
But I'm glad you found a solution you're happy with!
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<rl*****@newsgroups.nospam> wrote in message
news:u1**************@TK2MSFTNGP15.phx.gbl...
Can't do that... I have no control over the naming conventions and if I
start changing column names, there will be significant political
fall-out.
Unions will file law suits, cats and dogs living together... etc, etc...

But.. I think I figured it out. I created a class with a bunch of
public
string vars where I can set the vars equal to whatever they tell me to
actually name the fields. Then I just use an instance of the class in my
code behind and reference it from the HTML. It works.

Now I can code with short names and just fill in the names they want me
to
use when they get around to it.

Thanks for the reply.

Jerry

"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:un**************@TK2MSFTNGP10.phx.gbl...
Jerry,

I think an easier way to do this would be to rename the datatable's
fields
when you get them.

Right after you fill your datatable move through each column and name it

the
way you want:

DataTable.Columns("T003_EntityName_String").Column Name = "EName"

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rlrcstr" <rl*****@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
> 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
It's all in the QUERY

Use As [newfieldname]...

"rlrcstr" <rl*****@discussions.microsoft.com> schreef in bericht
news:E4**********************************@microsof t.com...
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 #7

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

Similar topics

0
by: Jason | last post by:
Currently I have a number of html forms which loop through records in a database table. In order to be able to update the right record when the form is submitted, I've tacked number on to the...
17
by: MLH | last post by:
A97 Topic: If there is a way to preserve the values assigned to global variables when an untrapped runtime error occurs? I don't think there is, but I thought I'd ask. During development, I'm...
3
by: frothpoker | last post by:
Guys, I'm sure this has been asked a million times but I can't seem to formulate a google search that returns what i'm looking for. I've go a dev and live environment. Currently the DB...
10
patjones
by: patjones | last post by:
Hi: I have two forms, frmVerifyUser and frmVerifyNewPassword. In the VB module for both forms, at the very top, I try to set a global variable like Public strNewPassword As String Option...
1
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
1
by: Keith Hughitt | last post by:
Hi all, I was wondering if anyone had any suggestions for alternative ways for multiple objects to keep track of a single variable? Initially, I thought of just using a single (YUI) Custom event...
18
by: Bruce | last post by:
When I do this: <input id="someName" type="text"> <script type="text/javascript"> alert(someName.nodeName); </script> Both IE6 and Firefox alert("INPUT"). Why isn't "someName" undefined?
7
by: yuki007 | last post by:
I need to know how to add many datas into a table using html form and the php query for example, i want to do like this <form action="addsong.php" method="post"> song1: <input type="text"...
2
by: kstevens | last post by:
I have a global variable assigned in a module. Public MyVar as Integer Right before I open a report, I have the variable set. MyVar= InputBox("Please enter the markup percentage for oursource...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.