Click here to Skip to main content
15,904,024 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi All,

Iam trying to send simple kind of data to asp.net from flash.I already wrote the code for flash and asp.net,in flash the sending is working great and in asp.net the value is being received and i knew that by debugging in asp.net.The value of the textbox is becoming equal to the passed variable from flash but the textbox is not displaying it so please i need help. This is my flash code and my asp.net code:

Flash part :
C#
btn.addEventListener(MouseEvent.MOUSE_DOWN,senddata);
function senddata(e:MouseEvent)
{
var scriptRequest:URLRequest = new URLRequest("Default.aspx");
var scriptLoader:URLLoader = new URLLoader();
var scriptVars:URLVariables = new URLVariables();

scriptLoader.addEventListener(Event.COMPLETE, handleLoadSuccessful);
scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, handleLoadError);

scriptVars.var1 = "one";


scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars;

scriptLoader.load(scriptRequest);

function handleLoadSuccessful($evt:Event):void
{
    txt.text="sent";
    trace("Message sent.");
}

function handleLoadError($evt:IOErrorEvent):void
{
    txt.text="failed";
    trace("Message failed.")
}
}


Asp.net part :
C#
protected void Page_Load(object sender, EventArgs e)
   {
       if (!Page.IsPostBack)
       {
           if (Request["var1"] != null)
           {
               TextBox1.Text = Request["var1"];

           }
          
       }

   }
Posted
Updated 25-Apr-11 23:49pm
v3

1 solution

If you've debugged and the value is there, have you tried removing the check for IsPostBack?

C#
protected void Page_Load(object sender, EventArgs e)
{
   if (Request["var1"] != null)
   {
       TextBox1.Text = Request["var1"];
   } 
}
 
Share this answer
 
Comments
mhamad zarif 26-Apr-11 8:39am    
yeah jim,initially the code was with no "IsPostBack" and it was no working also.Please if you can help me fix this issue since i need it.Thanks for your reply.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900