Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   ASP.NET (http://www.programmingforums.org/forum35.html)
-   -   Chat program (http://www.programmingforums.org/showthread.php?t=14653)

venkatramasamy Dec 1st, 2007 2:32 AM

Chat program
 
hi,
i ma new to ASP, good in Vb,

now i am trying to write a chat program,i want ot know that how to transfer the text from one form to another,
i tried response.redirect and server.transfer in the both it redirects the page,

but what i need is simple transfer the text to the next page when a button clicked,

Scenario:
Chat1-page1
chat2-page22
'my previous code
Sub submit(ByVal sender As Object, ByVal e As EventArgs)
Dim message As String
message = Textmsg.Text
TextHistory.Text = TextHistory.Text & vbNewLine & "Me:" & message
Textmsg.Text = ""
Context.Items("Transmsg") = message
Server.Transfer("chat1.aspx", False)
end sub

it redirects the page, i need to trnsfer the text and want to remain on the same page,

is anybody there to help me

Thanks in advance

venkatramasamy SN

ReggaetonKing Dec 1st, 2007 3:58 AM

Re: Chat program
 
In first page called Whatever.aspx
:

Reponse.Redirect("NextPage.aspx?textToSend=whatyouwant");

In NextPage.aspx
:

string textFromOtherPage = Request.QueryString[ "textToSend" ];

Do you see how this works? I passed a string value in the URL to the next page and the next page extracts this string and uses it however.

venkatramasamy Dec 2nd, 2007 11:13 PM

Re: Chat program
 
hi,
thank you for your reply,

that code you send has two problems

1. that redirects the page(i need the page remain same)
2. the msg showm on the address bar(dont want to show on address bar)

could you please help me with some other code

With thanks & regards
Venkatramasamy SN

dilipv Mar 7th, 2008 1:18 AM

Re: Chat program
 
Quote:

Originally Posted by venkatramasamy (Post 137884)
hi,
i ma new to ASP, good in Vb,

now i am trying to write a chat program,i want ot know that how to transfer the text from one form to another,
i tried response.redirect and server.transfer in the both it redirects the page,

but what i need is simple transfer the text to the next page when a button clicked,

Scenario:
Chat1-page1
chat2-page22
'my previous code
Sub submit(ByVal sender As Object, ByVal e As EventArgs)
Dim message As String
message = Textmsg.Text
TextHistory.Text = TextHistory.Text & vbNewLine & "Me:" & message
Textmsg.Text = ""
Context.Items("Transmsg") = message
Server.Transfer("chat1.aspx", False)
end sub

it redirects the page, i need to trnsfer the text and want to remain on the same page,

is anybody there to help me

Thanks in advance

venkatramasamy SN



Hi there,

i saw your quote.there is only one problem with your code.

you had set Server.Transfer("chat1.aspx", False) so you have to make it true. because making it true it hold the state of a page.now to retrive the value from the message use the following line of code.

Response.Write(Request.Form["Textmsg"]);

Hope this will help you to solve your query

Thank you
Jitesh
Programmer
Sharepoint Consulting

venkatramasamy Sep 13th, 2008 12:44 AM

Re: Chat program
 
HI Jitesh


Thank u for Your reply,


-Venkatramasamy SN


All times are GMT -5. The time now is 3:59 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC