Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

JavaScript in ASP.NET

New Here ,
Dec 31, 2006 Dec 31, 2006

Copy link to clipboard

Copied

hello
I have this simple javascript code:

<script language="JavaScript" type="text/javascript">
var Emp = new String(3);
Emp[0] = fname;
Emp[1] = mname;
Emp[2] = lname;
</script>

the question is : how to give values to fname, mname, lname from a database table using asp.net? ( table contains : Fname,MName,LName)
thx alot guys
TOPICS
Server side applications

Views

336
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 31, 2006 Dec 31, 2006

Copy link to clipboard

Copied

As usual, nothing is said about how or when the data is being retrieved from
the database. Sigh.
Let's say the data is available when the page loads. Thus, HTML controls of
type="hidden" can be populated with the data retrieved from the database
during the page compilation process. The data in the HTML controls can then
be referenced using the document object model in your JavaScript.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP http://wikimapia.org/#y=43038073&x=-88043838&z=17&l=0&m=h


"Feras_86" <webforumsuser@macromedia.com> wrote in message
news:en828c$dm$1@forums.macromedia.com...
> hello
> I have this simple javascript code:
>
> <script language="JavaScript" type="text/javascript">
> var Emp = new String(3);
> Emp[0] = fname;
> Emp[1] = mname;
> Emp[2] = lname;
> </script>
>
> the question is : how to give values to fname, mname, lname from a
> database
> table using asp.net? ( table contains : Fname,MName,LName)
> thx alot guys
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 31, 2006 Dec 31, 2006

Copy link to clipboard

Copied

i wanted to get the first row from a datagrid and pass them to the java script code :
<script language="JavaScript" type="text/javascript">
var Emp = new String(2);

News[0] = <% dgTop.Items(0).Cells(0).Text() %>; News[1]= <% dgTop.Items(0).Cells(1).Text() %>;
</script>

well i got the following error :
Property access must assign to the property or use its value.

any ideas?
thx alot

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 02, 2007 Jan 02, 2007

Copy link to clipboard

Copied

LATEST
I would suggest that you use a literal field inside of the javascript and
then you can set the values of the literals as part of either the page load,
or the datagrid selection.

The JS code would look like this

<script language="JavaScript" type="text/javascript">
var Emp = new String(2);
Emp[0] = <asp:Literal id="fname" runat="server" />;
Emp[1] = <asp:Literal id="mname" runat="server" />;
Emp[2] = <asp:Literal id="lname" runat="server" />;
</script>

You would set the literal text value to whatever you were grabbing for
example

fname.Text = dgTop.Items(0).Cells(0).Text()



--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"Feras_86" <webforumsuser@macromedia.com> wrote in message
news:en9q1k$roo$1@forums.macromedia.com...
>i wanted to get the first row from a datagrid and pass them to the java
> script code :
> <script language="JavaScript" type="text/javascript">
> var Emp = new String(2);
>
> News[0] = <%
> dgTop.Items(0).Cells(0).Text() %>; News[1]= <%
> dgTop.Items(0).Cells(1).Text() %>;
> </script>
>
> well i got the following error :
> Property access must assign to the property or use its value.
>
> any ideas?
> thx alot
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines