you are a superstar
thanks Eliyahu
Mike
"Eliyahu Goldin" <> wrote in message
news:%...
> 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" <> 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">
> > <asp:label id="hiddenId" style="Z-INDEX: 102; LEFT: 50px; POSITION:
> > absolute; TOP: 28px" runat="server"
> > CssClass="Hidden"></asp:label>
> > </body>
> > </HTML>
> >
> >
> >
> > "Eliyahu Goldin" <> wrote in message
> > news:...
> > > 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" <> 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" <> wrote in message
> > > > news:...
> > > > > 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" <> 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" <> wrote in
message
> > > > > > news:...
> > > > > > > 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" <> 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
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
|