On Aug 27, 9:42 pm, "jphayc...@googlemail.com"
<jphayc...@googlemail.com> wrote:
> Hi all
>
[quoted text clipped - 17 lines]
>
> John
John,
you can do a button click, but it requires a postback to the server
<input type="button" id="bbb" style="display:none" runat="server"
onserverclick="...">
in js
var btn = document.getElementById("bbb");
btn.click();
I would suggest either to think about Ajax, or change the behavior of
the form
Mukesh Zala - 28 Aug 2007 10:22 GMT
My understanding says you need following funcationality
1) before page load some javascript executes
2) on page load event some server side method uses value of textbox.
you can try in this way.
declare html hidden control with runat server side, when javascript executes
store value of textbox in hidden field.
Use hidden field value in server side method during page load.
Bye
> On Aug 27, 9:42 pm, "jphayc...@googlemail.com"
> <jphayc...@googlemail.com> wrote:
[quoted text clipped - 34 lines]
> I would suggest either to think about Ajax, or change the behavior of
> the form
jphaycock@googlemail.com - 28 Aug 2007 13:53 GMT
Thank you Mukesh
This gives me the same type of problem. I cannot get the value of the
hidden field until after the page has completely rendered so i can't
refer to it in the page_load event.
John
On 28 Aug, 10:22, Mukesh Zala <MukeshZ...@discussions.microsoft.com>
wrote:
> My understanding says you need following funcationality
> 1) before page load some javascript executes
[quoted text clipped - 4 lines]
> Use hidden field value in server side method during page load.
> Bye
jphaycock@googlemail.com - 28 Aug 2007 13:47 GMT
Cheers for the answer Alex
I tried this but it didn't work. it couldn't find the serverside
method
John
> you can do a button click, but it requires a postback to the server
>
[quoted text clipped - 10 lines]
>
> - Show quoted text -
On Aug 27, 10:42 pm, "jphayc...@googlemail.com"
<jphayc...@googlemail.com> wrote:
> Hi all
>
[quoted text clipped - 17 lines]
>
> John
As I see you have to do something with value in textbox after it was
changed.
Try to use OnTextChanged event handler insted of Page_Load:
<asp:TextBox ID="TextBox1" runat=server AutoPostBack=true
OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
//call your method here
}
Regards,
Mykola
http://marss.co.ua
jphaycock@googlemail.com - 28 Aug 2007 15:16 GMT
Thank you Mykola
Alas, that still requires user interaction after the page has loaded.
I need this to happen without the user clicking a button or changing
text. The value of the textbox is populated by a javascript and the
OnTextChanged event isn't fired by this action.
John
> As I see you have to do something with value in textbox after it was
> changed.
[quoted text clipped - 12 lines]
>
> - Show quoted text -
marss - 28 Aug 2007 16:14 GMT
On 28 , 17:16, "jphayc...@googlemail.com"
<jphayc...@googlemail.com> wrote:
> Thank you Mykola
>
[quoted text clipped - 21 lines]
>
> > - Show quoted text -
View page source and find how ASP.Net rendered textbox. It have to be
something like this:
<input name="TextBox1" type="text"
onchange="javascript:setTimeout('__doPostBack(\'TextBox1\',\'\')',
0)" ...
Call __doPostBack('TextBox1','') in your javascript after you changed
value..
Regards,
Mykola
http://marss.co.ua
jphaycock@googlemail.com - 28 Aug 2007 17:24 GMT
Hi Mykola
Thank you
This worked but it keeps firing repeatedly. Do you know how i can make
it postback only once?
John
View page source and find how ASP.Net rendered textbox. It have to be
> something like this:
> <input name="TextBox1" type="text"
[quoted text clipped - 8 lines]
>
> - Show quoted text -
marss - 29 Aug 2007 09:14 GMT
On 28 , 19:24, "jphayc...@googlemail.com"
<jphayc...@googlemail.com> wrote:
> This worked but it keeps firing repeatedly. Do you know how i can make
> it postback only once?
Hi John,
The method itself does not cause looping. It may be caused by program
logic. It is hard to me to give more definite advice. Perhaps, if you
want to call some method in Page_Load (not in textbox's OnTextChanged
event handler) you have to test whether this postback was caused by
change in textbox. I mean that if you call __doPostBack('TextBox1','')
in javascript then you can process this postback in Page_Load
if (Request.Params["__EVENTTARGET"] == "TextBox1")
{
//call some method here
}
Regards,
Mykola
http://marss.co.ua
jphaycock@googlemail.com - 29 Aug 2007 10:58 GMT
Thanks again Mykola
The problem seems to be that each time the page loads the javascript
is executed and this forces a postback so it gets stuck in a loop.
I may have to rethink how I'm going about this
Cheers
John
> Hi John,
> The method itself does not cause looping. It may be caused by program
[quoted text clipped - 11 lines]
> Regards,
> Mykolahttp://marss.co.ua