Click here to Skip to main content
15,891,184 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Deploying Asp .Net 4.0 website on ISS 5.1 Pin
Sandeep Mewara13-Jun-12 0:15
mveSandeep Mewara13-Jun-12 0:15 
GeneralRe: Deploying Asp .Net 4.0 website on ISS 5.1 Pin
nvarunkumar13-Jun-12 0:43
nvarunkumar13-Jun-12 0:43 
Questionlogin page Pin
tennyson1234912-Jun-12 20:17
tennyson1234912-Jun-12 20:17 
AnswerRe: login page Pin
Sandeep Mewara12-Jun-12 20:34
mveSandeep Mewara12-Jun-12 20:34 
AnswerRe: login page Pin
SachinDakle13-Jun-12 0:01
SachinDakle13-Jun-12 0:01 
QuestionMicrosoft.Office.Interop.Word Pin
Ramkumar_S12-Jun-12 20:07
Ramkumar_S12-Jun-12 20:07 
AnswerRe: Microsoft.Office.Interop.Word Pin
Ramkumar_S13-Jun-12 15:36
Ramkumar_S13-Jun-12 15:36 
QuestionUpdating a control using ajax Pin
wiins12-Jun-12 2:55
wiins12-Jun-12 2:55 
I have an asp.net webform which has a div element named 'contents', and a textbox on it. The div is loaded with some html, which I've retrieved into a string in the codebehind file. Inside this html, I need to be able to mark up various bits of text so that when a user clicks them, it sends a message back to the server, which then populates the text box (which is on the same form) with some other data.

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...

ASP.NET
<div id="contents" runat="server"></div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>


and in my codebehind file in form_load, I have..

C#
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


HTML
<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!
AnswerRe: Updating a control using ajax Pin
Rahul Rajat Singh12-Jun-12 19:12
professionalRahul Rajat Singh12-Jun-12 19:12 
QuestionHow to dynamically create dropdownlist as ItemTemplate in a gridview Pin
ramsai197312-Jun-12 2:33
ramsai197312-Jun-12 2:33 
AnswerRe: How to dynamically create dropdownlist as ItemTemplate in a gridview Pin
Sandeep Mewara12-Jun-12 20:41
mveSandeep Mewara12-Jun-12 20:41 
Questionbanner in asp.net Pin
jalpa from amreli12-Jun-12 1:42
jalpa from amreli12-Jun-12 1:42 
AnswerRe: banner in asp.net Pin
jkirkerx12-Jun-12 10:43
professionaljkirkerx12-Jun-12 10:43 
AnswerRe: banner in asp.net Pin
dipen mistry13-Jun-12 1:34
dipen mistry13-Jun-12 1:34 
Questionanybody please help in asp.net Pin
suman993911-Jun-12 23:06
suman993911-Jun-12 23:06 
AnswerRe: anybody please help in asp.net Pin
Abhinav S11-Jun-12 23:19
Abhinav S11-Jun-12 23:19 
AnswerRe: anybody please help in asp.net Pin
Sandeep Mewara11-Jun-12 23:20
mveSandeep Mewara11-Jun-12 23:20 
GeneralRe: anybody please help in asp.net Pin
Rahul Rajat Singh12-Jun-12 2:15
professionalRahul Rajat Singh12-Jun-12 2:15 
AnswerRe: anybody please help in asp.net Pin
Rahul Rajat Singh12-Jun-12 19:10
professionalRahul Rajat Singh12-Jun-12 19:10 
GeneralRe: anybody please help in asp.net Pin
AshishChaudha30-Jun-12 8:10
AshishChaudha30-Jun-12 8:10 
QuestionThe namespace attribute cannot have empty string(WebService) Pin
vinayh11-Jun-12 22:59
vinayh11-Jun-12 22:59 
AnswerRe: The namespace attribute cannot have empty string(WebService) Pin
Abhinav S11-Jun-12 23:21
Abhinav S11-Jun-12 23:21 
GeneralRe: The namespace attribute cannot have empty string(WebService) Pin
vinayh12-Jun-12 0:10
vinayh12-Jun-12 0:10 
Questionintermittent issues with visual studio 2010 when calling a web service Pin
zied_jouini11-Jun-12 12:45
zied_jouini11-Jun-12 12:45 
QuestionReaching a button outside an updatepanel. Pin
Mark Vloerjans11-Jun-12 6:38
Mark Vloerjans11-Jun-12 6:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.