The problem I'm having is how best to communicat back to the server- so in the code below,
1) What should the line alert("You clicked " + x); be, so that it uses ajax to call back to the server, sending the parameter 'hello'
2) What method would be invoked on the server? Would it be Page_Load again?
3) After having called the server, what code would I need to popluate the text box without sending back the whole page again (i.e. still using ajax)? The problem is not retrieving the text on the server, let's just say I receive 'hello' as a parameter on the server, and want to send back 'goodbye' to the text box, again using ajax
So my source aspx file has this in it... <div id="contents" runat="server"></div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
and in my codebehind file in form_load, I have..
System.IO.StreamReader rdr = System.IO.File.OpenText("c:\\myHtmlFile.html");
string s = rdr.ReadToEnd();
this.contents.InnerHtml = s;
the HTML I'm loading into the div element is this
<script type="text/javascript">
function myfunction(x)
{
alert("You clicked " + x);
}
</script>
<p onclick="myfunction('hello')">hello</p>
When the user clicks 'hello', I want TextBox1 to say 'goodbye'. Again, it's the server that has to handle things here, without reposting the webpage though..
Anyone have any ideas? The simpler the better please! thanks in advance...

New Topic/Question
Reply



MultiQuote



|