While it got me going in the right direction, I had no luck with
document.FindElementbyId("bt_submit").click(); But for those of you who
may be interested in the outcome of this thread, a variation of the
recommendation is what works:
This is the hyperlink that, when clicked, executes the client-side
JavaScript function:
<a id="HyperLink1" href="javascript
:TestPostBackFromJavaScript()" >Test Save
From JavaScript</a>
Here is the JavaScript Function
function TestPostBackFromJavaScript() {
document.all("btnSaveChanges").click();
}
That JavaScript function effectively "clicks" the following ASP.NET button:
<asp:Button id="btnSaveChanges" EnableViewState="true"
CommandName="SaveChanges" Visible="true" Width="115" runat="server"
Text="Save Changes"></asp:Button>
Thanks to Lau Lei Cheong for pointing me in the right direction.
GH
"Guadala Harry" <Ch*********@gh.com> wrote in message
news:e0**************@TK2MSFTNGP12.phx.gbl...
Thank you very much.
I'll give it a whirl.
-GH
"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:u7***************@tk2msftngp13.phx.gbl... Use the statement:
document.FindElementbyId("bt_submit").click();
where bt_Submit is a button with "runat=server" & " id='bt_submit'
"properties set.
I've already suggested that in my last post.
You'll have to follow this kind of approach as there's no easier method
to pass value to server-side using form-submittion(get/post)
"Guadala Harry" <Ch*********@gh.com> ¦b¶l¥ó
news:eg**************@tk2msftngp13.phx.gbl ¤¤¼¶¼g... How do I do the following part of what you recommend - do you have
specific JavaScript Syntax?
<<...and finally call a server-side button to post the data to server...>
Does anyone have an easier way to accomplish what I'm after?
Thanks for your input so far - GH.
"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:uG**************@TK2MSFTNGP12.phx.gbl...
> You can make the button to be a client-side button that invokes the
script,
> then store the value to a hidden control with "runat=server" and finally > call a server-side button to post the data to server(possibly with a
> document.FindElementbyId().click()).
> If there should be only one button on the form, you may want to try
an > ImageButton with "white" image.
>
> "Guadala Harry" <Ch*********@gh.com> ¦b¶l¥ó
> news:%2****************@tk2msftngp13.phx.gbl ¤¤¼¶¼g...
> > I have some client-side JavaScript that, among other things,
calculates > the
> > value of a variable (myVar). On the server I have a stored
procedure that
> > needs to somehow receive as an input parameter the value of myVar.
I need
> to
> > know how to get the value of myVar from the script up to the
server. > > Specifically, I'd like to have the following happen when the user
clicks a
> > button in the browser:
> > 1. The client-side script executes (and determines the value of
myVar). > > 2. A postback is initiated - at which time the value of myVar is
sent to > an
> > aspx.cs function which ultimately...
> > 3. executes a stored procedure (which receives the value of myVar
as an > > input parameter).
> >
> > This is a very important piece of a larger project... any help
would be > > greatly appreciated - including any JavaScript syntax, as I'm a
but rusty
> on
> > my JavaScript skills.
> >
> > Thanks!
> >
> > -GH
> >
> >
>
>