Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Passing data from server side to client side?

Reply
Thread Tools

Passing data from server side to client side?

 
 
Mike Fellows
Guest
Posts: n/a
 
      06-29-2004
Ok, im not sure if this is at all possible and if it is how i go about it is
beyond me

i have a piece of client side code that requires a piece of data from the
server side (an ID number in this case)

how can i pass the data from one side to the other, or retrieve it from the
webform on the client side?

i hope ive explained this properly

Mike Fellows


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      06-29-2004
Mike,

This is one of the most common tasks in ASP.NET development. The solution is
to use hidden elements. If you need a single id value, you can use any html
element capable of holding values. If you need to pass the value back, you
need to use a <input type="hidden" ...>. If you need an id column in a grid,
you need to ad a column to your datagrid and make it invisible with a
stylesheet rule.

Note, if you use a server control and set property Visible to false, the
control won't be rendered to the client and you won't get anything.

Eliyahu

"Mike Fellows" <(E-Mail Removed)> wrote in message
news:WpbEc.1276$Cs1.434@newsfe6-win...
> Ok, im not sure if this is at all possible and if it is how i go about it

is
> beyond me
>
> i have a piece of client side code that requires a piece of data from the
> server side (an ID number in this case)
>
> how can i pass the data from one side to the other, or retrieve it from

the
> webform on the client side?
>
> i hope ive explained this properly
>
> Mike Fellows
>
>



 
Reply With Quote
 
 
 
 
Mike Fellows
Guest
Posts: n/a
 
      06-29-2004
Eliyahu,

ok i sort of understand (though not fully)

if i have a label on my webform called MyLabel

and i have a clientside HTML button that runs my client side code

i want my HTML button to get the value of MyLabel so that i can use it
clientside





"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Mike,
>
> This is one of the most common tasks in ASP.NET development. The solution

is
> to use hidden elements. If you need a single id value, you can use any

html
> element capable of holding values. If you need to pass the value back, you
> need to use a <input type="hidden" ...>. If you need an id column in a

grid,
> you need to ad a column to your datagrid and make it invisible with a
> stylesheet rule.
>
> Note, if you use a server control and set property Visible to false, the
> control won't be rendered to the client and you won't get anything.
>
> Eliyahu
>
> "Mike Fellows" <(E-Mail Removed)> wrote in message
> news:WpbEc.1276$Cs1.434@newsfe6-win...
> > Ok, im not sure if this is at all possible and if it is how i go about

it
> is
> > beyond me
> >
> > i have a piece of client side code that requires a piece of data from

the
> > server side (an ID number in this case)
> >
> > how can i pass the data from one side to the other, or retrieve it from

> the
> > webform on the client side?
> >
> > i hope ive explained this properly
> >
> > Mike Fellows
> >
> >

>
>



 
Reply With Quote
 
Mike Fellows
Guest
Posts: n/a
 
      06-29-2004
Eliyahu,

I hate to be a pain, but im probably more confused than ever

could you point me in the direction of an example at all?
(ive tried searching for them but i cant find any)

Thanks

Mike


"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> That's fine. Give you label an id and refer to it from javascript. If it

is
> an asp:Label, it will translate to <span> and you can get the label text

via
> innerText property.
>
> Eliyahu
>
> "Mike Fellows" <(E-Mail Removed)> wrote in message
> news:s1eEc.1931$Cs1.1084@newsfe6-win...
> > Eliyahu,
> >
> > ok i sort of understand (though not fully)
> >
> > if i have a label on my webform called MyLabel
> >
> > and i have a clientside HTML button that runs my client side code
> >
> > i want my HTML button to get the value of MyLabel so that i can use it
> > clientside
> >
> >
> >
> >
> >
> > "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Mike,
> > >
> > > This is one of the most common tasks in ASP.NET development. The

> solution
> > is
> > > to use hidden elements. If you need a single id value, you can use any

> > html
> > > element capable of holding values. If you need to pass the value back,

> you
> > > need to use a <input type="hidden" ...>. If you need an id column in a

> > grid,
> > > you need to ad a column to your datagrid and make it invisible with a
> > > stylesheet rule.
> > >
> > > Note, if you use a server control and set property Visible to false,

the
> > > control won't be rendered to the client and you won't get anything.
> > >
> > > Eliyahu
> > >
> > > "Mike Fellows" <(E-Mail Removed)> wrote in message
> > > news:WpbEc.1276$Cs1.434@newsfe6-win...
> > > > Ok, im not sure if this is at all possible and if it is how i go

about
> > it
> > > is
> > > > beyond me
> > > >
> > > > i have a piece of client side code that requires a piece of data

from
> > the
> > > > server side (an ID number in this case)
> > > >
> > > > how can i pass the data from one side to the other, or retrieve it

> from
> > > the
> > > > webform on the client side?
> > > >
> > > > i hope ive explained this properly
> > > >
> > > > Mike Fellows
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      06-29-2004
That's fine. Give you label an id and refer to it from javascript. If it is
an asp:Label, it will translate to <span> and you can get the label text via
innerText property.

Eliyahu

"Mike Fellows" <(E-Mail Removed)> wrote in message
news:s1eEc.1931$Cs1.1084@newsfe6-win...
> Eliyahu,
>
> ok i sort of understand (though not fully)
>
> if i have a label on my webform called MyLabel
>
> and i have a clientside HTML button that runs my client side code
>
> i want my HTML button to get the value of MyLabel so that i can use it
> clientside
>
>
>
>
>
> "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Mike,
> >
> > This is one of the most common tasks in ASP.NET development. The

solution
> is
> > to use hidden elements. If you need a single id value, you can use any

> html
> > element capable of holding values. If you need to pass the value back,

you
> > need to use a <input type="hidden" ...>. If you need an id column in a

> grid,
> > you need to ad a column to your datagrid and make it invisible with a
> > stylesheet rule.
> >
> > Note, if you use a server control and set property Visible to false, the
> > control won't be rendered to the client and you won't get anything.
> >
> > Eliyahu
> >
> > "Mike Fellows" <(E-Mail Removed)> wrote in message
> > news:WpbEc.1276$Cs1.434@newsfe6-win...
> > > Ok, im not sure if this is at all possible and if it is how i go about

> it
> > is
> > > beyond me
> > >
> > > i have a piece of client side code that requires a piece of data from

> the
> > > server side (an ID number in this case)
> > >
> > > how can i pass the data from one side to the other, or retrieve it

from
> > the
> > > webform on the client side?
> > >
> > > i hope ive explained this properly
> > >
> > > Mike Fellows
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Mike Fellows
Guest
Posts: n/a
 
      06-29-2004
Eliyahu,

ok all worked fine on the server side, but i get an error on page on load

im including my code so you can see what im doing, i think the problem lies
within the javascript script

thanks

Mike

<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">

<SCRIPT language="javascript">
var id=hiddenId.innerText
</SCRIPT>

<SCRIPT language="VBScript">
Dim objWord
Dim exists
Sub OpenDoc()
Set objWord = CreateObject("Word.Application")
objWord.Documents.Open("\\Gringotts\common
documents\AutoPackProduction\Remortgage\Factfind.d oc")
objWord.Visible = true
objWord.activedocument.saveas("c:\"& id &".doc")
set objWord=nothing
End Sub
</SCRIPT>

</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
</form>
<input style="Z-INDEX: 101; LEFT: 165px; WIDTH: 157px; POSITION: absolute;
TOP: 82px; HEIGHT: 48px"
onclick="opendoc()" type="button" value="opendoc">&nbsp;
<asp:label id="hiddenId" style="Z-INDEX: 102; LEFT: 50px; POSITION:
absolute; TOP: 28px" runat="server"
CssClass="Hidden"></asp:label>
</body>
</HTML>



"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Mike,
>
> Let's say you want to pass hidden id value from server to client.
>
> 1. Add a hidden label control to the aspx page:
> <asp:Label id="hiddenId" runat="server" CssClass="Hidden"></asp:Label>
> Add a stylesheet rule for Hidden to the page: .Hidden{display:none}
>
> 2. In the code-behind on server-side assign values to the id:
> hiddenId.Text = "12345";
>
> 3. In javascripts on client-side get the value:
> var id=hiddenId.innerText;
>
> If it is not clear, please tell me what step causes a problem.
>
> Eliyahu
>
> "Mike Fellows" <(E-Mail Removed)> wrote in message
> news:yweEc.2058$Cs1.739@newsfe6-win...
> > Eliyahu,
> >
> > I hate to be a pain, but im probably more confused than ever
> >
> > could you point me in the direction of an example at all?
> > (ive tried searching for them but i cant find any)
> >
> > Thanks
> >
> > Mike
> >
> >
> > "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > That's fine. Give you label an id and refer to it from javascript. If

it
> > is
> > > an asp:Label, it will translate to <span> and you can get the label

text
> > via
> > > innerText property.
> > >
> > > Eliyahu
> > >
> > > "Mike Fellows" <(E-Mail Removed)> wrote in message
> > > news:s1eEc.1931$Cs1.1084@newsfe6-win...
> > > > Eliyahu,
> > > >
> > > > ok i sort of understand (though not fully)
> > > >
> > > > if i have a label on my webform called MyLabel
> > > >
> > > > and i have a clientside HTML button that runs my client side code
> > > >
> > > > i want my HTML button to get the value of MyLabel so that i can use

it
> > > > clientside
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > Mike,
> > > > >
> > > > > This is one of the most common tasks in ASP.NET development. The
> > > solution
> > > > is
> > > > > to use hidden elements. If you need a single id value, you can use

> any
> > > > html
> > > > > element capable of holding values. If you need to pass the value

> back,
> > > you
> > > > > need to use a <input type="hidden" ...>. If you need an id column

in
> a
> > > > grid,
> > > > > you need to ad a column to your datagrid and make it invisible

with
> a
> > > > > stylesheet rule.
> > > > >
> > > > > Note, if you use a server control and set property Visible to

false,
> > the
> > > > > control won't be rendered to the client and you won't get

anything.
> > > > >
> > > > > Eliyahu
> > > > >
> > > > > "Mike Fellows" <(E-Mail Removed)> wrote in

> message
> > > > > news:WpbEc.1276$Cs1.434@newsfe6-win...
> > > > > > Ok, im not sure if this is at all possible and if it is how i go

> > about
> > > > it
> > > > > is
> > > > > > beyond me
> > > > > >
> > > > > > i have a piece of client side code that requires a piece of data

> > from
> > > > the
> > > > > > server side (an ID number in this case)
> > > > > >
> > > > > > how can i pass the data from one side to the other, or retrieve

it
> > > from
> > > > > the
> > > > > > webform on the client side?
> > > > > >
> > > > > > i hope ive explained this properly
> > > > > >
> > > > > > Mike Fellows
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      06-29-2004
Mike,

Let's say you want to pass hidden id value from server to client.

1. Add a hidden label control to the aspx page:
<asp:Label id="hiddenId" runat="server" CssClass="Hidden"></asp:Label>
Add a stylesheet rule for Hidden to the page: .Hidden{display:none}

2. In the code-behind on server-side assign values to the id:
hiddenId.Text = "12345";

3. In javascripts on client-side get the value:
var id=hiddenId.innerText;

If it is not clear, please tell me what step causes a problem.

Eliyahu

"Mike Fellows" <(E-Mail Removed)> wrote in message
news:yweEc.2058$Cs1.739@newsfe6-win...
> Eliyahu,
>
> I hate to be a pain, but im probably more confused than ever
>
> could you point me in the direction of an example at all?
> (ive tried searching for them but i cant find any)
>
> Thanks
>
> Mike
>
>
> "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > That's fine. Give you label an id and refer to it from javascript. If it

> is
> > an asp:Label, it will translate to <span> and you can get the label text

> via
> > innerText property.
> >
> > Eliyahu
> >
> > "Mike Fellows" <(E-Mail Removed)> wrote in message
> > news:s1eEc.1931$Cs1.1084@newsfe6-win...
> > > Eliyahu,
> > >
> > > ok i sort of understand (though not fully)
> > >
> > > if i have a label on my webform called MyLabel
> > >
> > > and i have a clientside HTML button that runs my client side code
> > >
> > > i want my HTML button to get the value of MyLabel so that i can use it
> > > clientside
> > >
> > >
> > >
> > >
> > >
> > > "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Mike,
> > > >
> > > > This is one of the most common tasks in ASP.NET development. The

> > solution
> > > is
> > > > to use hidden elements. If you need a single id value, you can use

any
> > > html
> > > > element capable of holding values. If you need to pass the value

back,
> > you
> > > > need to use a <input type="hidden" ...>. If you need an id column in

a
> > > grid,
> > > > you need to ad a column to your datagrid and make it invisible with

a
> > > > stylesheet rule.
> > > >
> > > > Note, if you use a server control and set property Visible to false,

> the
> > > > control won't be rendered to the client and you won't get anything.
> > > >
> > > > Eliyahu
> > > >
> > > > "Mike Fellows" <(E-Mail Removed)> wrote in

message
> > > > news:WpbEc.1276$Cs1.434@newsfe6-win...
> > > > > Ok, im not sure if this is at all possible and if it is how i go

> about
> > > it
> > > > is
> > > > > beyond me
> > > > >
> > > > > i have a piece of client side code that requires a piece of data

> from
> > > the
> > > > > server side (an ID number in this case)
> > > > >
> > > > > how can i pass the data from one side to the other, or retrieve it

> > from
> > > > the
> > > > > webform on the client side?
> > > > >
> > > > > i hope ive explained this properly
> > > > >
> > > > > Mike Fellows
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Mike Fellows
Guest
Posts: n/a
 
      06-29-2004
you are a superstar

thanks Eliyahu

Mike


"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Mike,
>
> A few things:
>
> You can't have webcontrols outside <form> tags.
>
> The javascript should be a function and you should call it on client-side
> load event:
> <SCRIPT language="javascript">
> var id;
> function getId() {id=hiddenId.innerText;}
> </SCRIPT>
> ...
> <body MS_POSITIONING="GridLayout" onload="getId()">
> After this variable id is available to other javascripts functions on the
> page.
>
> Also the stylesheet rule for Hidden is missing, unless you don't want to
> hide the id.
>
> Eliyahu
>
> "Mike Fellows" <(E-Mail Removed)> wrote in message
> news:OyfEc.2307$Cs1.737@newsfe6-win...
> > Eliyahu,
> >
> > ok all worked fine on the server side, but i get an error on page on

load
> >
> > im including my code so you can see what im doing, i think the problem

> lies
> > within the javascript script
> >
> > thanks
> >
> > Mike
> >
> > <HTML>
> > <HEAD>
> > <title>WebForm1</title>
> > <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
> > <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
> > <meta content="JavaScript" name="vs_defaultClientScript">
> > <meta content="http://schemas.microsoft.com/intellisense/ie5"
> > name="vs_targetSchema">
> >
> > <SCRIPT language="javascript">
> > var id=hiddenId.innerText
> > </SCRIPT>
> >
> > <SCRIPT language="VBScript">
> > Dim objWord
> > Dim exists
> > Sub OpenDoc()
> > Set objWord = CreateObject("Word.Application")
> > objWord.Documents.Open("\\Gringotts\common
> > documents\AutoPackProduction\Remortgage\Factfind.d oc")
> > objWord.Visible = true
> > objWord.activedocument.saveas("c:\"& id &".doc")
> > set objWord=nothing
> > End Sub
> > </SCRIPT>
> >
> > </HEAD>
> > <body MS_POSITIONING="GridLayout">
> > <form id="Form1" method="post" runat="server">
> > </form>
> > <input style="Z-INDEX: 101; LEFT: 165px; WIDTH: 157px; POSITION:

> absolute;
> > TOP: 82px; HEIGHT: 48px"
> > onclick="opendoc()" type="button" value="opendoc">&nbsp;
> > <asp:label id="hiddenId" style="Z-INDEX: 102; LEFT: 50px; POSITION:
> > absolute; TOP: 28px" runat="server"
> > CssClass="Hidden"></asp:label>
> > </body>
> > </HTML>
> >
> >
> >
> > "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Mike,
> > >
> > > Let's say you want to pass hidden id value from server to client.
> > >
> > > 1. Add a hidden label control to the aspx page:
> > > <asp:Label id="hiddenId" runat="server" CssClass="Hidden"></asp:Label>
> > > Add a stylesheet rule for Hidden to the page: .Hidden{display:none}
> > >
> > > 2. In the code-behind on server-side assign values to the id:
> > > hiddenId.Text = "12345";
> > >
> > > 3. In javascripts on client-side get the value:
> > > var id=hiddenId.innerText;
> > >
> > > If it is not clear, please tell me what step causes a problem.
> > >
> > > Eliyahu
> > >
> > > "Mike Fellows" <(E-Mail Removed)> wrote in message
> > > news:yweEc.2058$Cs1.739@newsfe6-win...
> > > > Eliyahu,
> > > >
> > > > I hate to be a pain, but im probably more confused than ever
> > > >
> > > > could you point me in the direction of an example at all?
> > > > (ive tried searching for them but i cant find any)
> > > >
> > > > Thanks
> > > >
> > > > Mike
> > > >
> > > >
> > > > "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > That's fine. Give you label an id and refer to it from javascript.

> If
> > it
> > > > is
> > > > > an asp:Label, it will translate to <span> and you can get the

label
> > text
> > > > via
> > > > > innerText property.
> > > > >
> > > > > Eliyahu
> > > > >
> > > > > "Mike Fellows" <(E-Mail Removed)> wrote in

> message
> > > > > news:s1eEc.1931$Cs1.1084@newsfe6-win...
> > > > > > Eliyahu,
> > > > > >
> > > > > > ok i sort of understand (though not fully)
> > > > > >
> > > > > > if i have a label on my webform called MyLabel
> > > > > >
> > > > > > and i have a clientside HTML button that runs my client side

code
> > > > > >
> > > > > > i want my HTML button to get the value of MyLabel so that i can

us
> e
> > it
> > > > > > clientside
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > "Eliyahu Goldin" <(E-Mail Removed)> wrote in

message
> > > > > > news:(E-Mail Removed)...
> > > > > > > Mike,
> > > > > > >
> > > > > > > This is one of the most common tasks in ASP.NET development.

The
> > > > > solution
> > > > > > is
> > > > > > > to use hidden elements. If you need a single id value, you can

> use
> > > any
> > > > > > html
> > > > > > > element capable of holding values. If you need to pass the

value
> > > back,
> > > > > you
> > > > > > > need to use a <input type="hidden" ...>. If you need an id

> column
> > in
> > > a
> > > > > > grid,
> > > > > > > you need to ad a column to your datagrid and make it invisible

> > with
> > > a
> > > > > > > stylesheet rule.
> > > > > > >
> > > > > > > Note, if you use a server control and set property Visible to

> > false,
> > > > the
> > > > > > > control won't be rendered to the client and you won't get

> > anything.
> > > > > > >
> > > > > > > Eliyahu
> > > > > > >
> > > > > > > "Mike Fellows" <(E-Mail Removed)> wrote in
> > > message
> > > > > > > news:WpbEc.1276$Cs1.434@newsfe6-win...
> > > > > > > > Ok, im not sure if this is at all possible and if it is how

i
> go
> > > > about
> > > > > > it
> > > > > > > is
> > > > > > > > beyond me
> > > > > > > >
> > > > > > > > i have a piece of client side code that requires a piece of

> data
> > > > from
> > > > > > the
> > > > > > > > server side (an ID number in this case)
> > > > > > > >
> > > > > > > > how can i pass the data from one side to the other, or

> retrieve
> > it
> > > > > from
> > > > > > > the
> > > > > > > > webform on the client side?
> > > > > > > >
> > > > > > > > i hope ive explained this properly
> > > > > > > >
> > > > > > > > Mike Fellows
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      06-29-2004
Mike,

A few things:

You can't have webcontrols outside <form> tags.

The javascript should be a function and you should call it on client-side
load event:
<SCRIPT language="javascript">
var id;
function getId() {id=hiddenId.innerText;}
</SCRIPT>
....
<body MS_POSITIONING="GridLayout" onload="getId()">
After this variable id is available to other javascripts functions on the
page.

Also the stylesheet rule for Hidden is missing, unless you don't want to
hide the id.

Eliyahu

"Mike Fellows" <(E-Mail Removed)> wrote in message
news:OyfEc.2307$Cs1.737@newsfe6-win...
> Eliyahu,
>
> ok all worked fine on the server side, but i get an error on page on load
>
> im including my code so you can see what im doing, i think the problem

lies
> within the javascript script
>
> thanks
>
> Mike
>
> <HTML>
> <HEAD>
> <title>WebForm1</title>
> <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
> <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
> <meta content="JavaScript" name="vs_defaultClientScript">
> <meta content="http://schemas.microsoft.com/intellisense/ie5"
> name="vs_targetSchema">
>
> <SCRIPT language="javascript">
> var id=hiddenId.innerText
> </SCRIPT>
>
> <SCRIPT language="VBScript">
> Dim objWord
> Dim exists
> Sub OpenDoc()
> Set objWord = CreateObject("Word.Application")
> objWord.Documents.Open("\\Gringotts\common
> documents\AutoPackProduction\Remortgage\Factfind.d oc")
> objWord.Visible = true
> objWord.activedocument.saveas("c:\"& id &".doc")
> set objWord=nothing
> End Sub
> </SCRIPT>
>
> </HEAD>
> <body MS_POSITIONING="GridLayout">
> <form id="Form1" method="post" runat="server">
> </form>
> <input style="Z-INDEX: 101; LEFT: 165px; WIDTH: 157px; POSITION:

absolute;
> TOP: 82px; HEIGHT: 48px"
> onclick="opendoc()" type="button" value="opendoc">&nbsp;
> <asp:label id="hiddenId" style="Z-INDEX: 102; LEFT: 50px; POSITION:
> absolute; TOP: 28px" runat="server"
> CssClass="Hidden"></asp:label>
> </body>
> </HTML>
>
>
>
> "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Mike,
> >
> > Let's say you want to pass hidden id value from server to client.
> >
> > 1. Add a hidden label control to the aspx page:
> > <asp:Label id="hiddenId" runat="server" CssClass="Hidden"></asp:Label>
> > Add a stylesheet rule for Hidden to the page: .Hidden{display:none}
> >
> > 2. In the code-behind on server-side assign values to the id:
> > hiddenId.Text = "12345";
> >
> > 3. In javascripts on client-side get the value:
> > var id=hiddenId.innerText;
> >
> > If it is not clear, please tell me what step causes a problem.
> >
> > Eliyahu
> >
> > "Mike Fellows" <(E-Mail Removed)> wrote in message
> > news:yweEc.2058$Cs1.739@newsfe6-win...
> > > Eliyahu,
> > >
> > > I hate to be a pain, but im probably more confused than ever
> > >
> > > could you point me in the direction of an example at all?
> > > (ive tried searching for them but i cant find any)
> > >
> > > Thanks
> > >
> > > Mike
> > >
> > >
> > > "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > That's fine. Give you label an id and refer to it from javascript.

If
> it
> > > is
> > > > an asp:Label, it will translate to <span> and you can get the label

> text
> > > via
> > > > innerText property.
> > > >
> > > > Eliyahu
> > > >
> > > > "Mike Fellows" <(E-Mail Removed)> wrote in

message
> > > > news:s1eEc.1931$Cs1.1084@newsfe6-win...
> > > > > Eliyahu,
> > > > >
> > > > > ok i sort of understand (though not fully)
> > > > >
> > > > > if i have a label on my webform called MyLabel
> > > > >
> > > > > and i have a clientside HTML button that runs my client side code
> > > > >
> > > > > i want my HTML button to get the value of MyLabel so that i can us

e
> it
> > > > > clientside
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > "Eliyahu Goldin" <(E-Mail Removed)> wrote in message
> > > > > news:(E-Mail Removed)...
> > > > > > Mike,
> > > > > >
> > > > > > This is one of the most common tasks in ASP.NET development. The
> > > > solution
> > > > > is
> > > > > > to use hidden elements. If you need a single id value, you can

use
> > any
> > > > > html
> > > > > > element capable of holding values. If you need to pass the value

> > back,
> > > > you
> > > > > > need to use a <input type="hidden" ...>. If you need an id

column
> in
> > a
> > > > > grid,
> > > > > > you need to ad a column to your datagrid and make it invisible

> with
> > a
> > > > > > stylesheet rule.
> > > > > >
> > > > > > Note, if you use a server control and set property Visible to

> false,
> > > the
> > > > > > control won't be rendered to the client and you won't get

> anything.
> > > > > >
> > > > > > Eliyahu
> > > > > >
> > > > > > "Mike Fellows" <(E-Mail Removed)> wrote in

> > message
> > > > > > news:WpbEc.1276$Cs1.434@newsfe6-win...
> > > > > > > Ok, im not sure if this is at all possible and if it is how i

go
> > > about
> > > > > it
> > > > > > is
> > > > > > > beyond me
> > > > > > >
> > > > > > > i have a piece of client side code that requires a piece of

data
> > > from
> > > > > the
> > > > > > > server side (an ID number in this case)
> > > > > > >
> > > > > > > how can i pass the data from one side to the other, or

retrieve
> it
> > > > from
> > > > > > the
> > > > > > > webform on the client side?
> > > > > > >
> > > > > > > i hope ive explained this properly
> > > > > > >
> > > > > > > Mike Fellows
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing a value from server side to client side kimberly.walker@consultant.com ASP .Net 4 07-13-2006 09:07 AM
client-side browser timeout OR server-side web server timeout?? (please help) jrefactors@hotmail.com Java 0 01-04-2005 04:06 AM
How to access client side XML data island from server side? =?Utf-8?B?YWRvbGYgZ2FybGlj?= ASP .Net 2 11-23-2004 05:16 PM
Collectiong Data on Server side while adding rows on client side =?Utf-8?B?U2lsZWVzaA==?= ASP .Net 0 11-03-2004 12:43 AM
Passing a text string from the server side to a client side function ken busse ASP .Net 2 11-24-2003 08:18 AM



Advertisments