arthurh88
asked on
How do I start a postback with javascript?
I'm using this code on a small popup datepicker to input the date into a textbox on my main form.
Response.Write("<script language=javascript>")
Response.Write(("window.op ener.docum ent.forms[ '" _
+ (Request.QueryString.Get(" FormName") .ToString + ("'].elements['" _
+ (Request.QueryString.Get(" ElementNam e").ToStri ng + ("'].value='" _
+ (date1 + "';")))))))
Response.Write("window.clo se();")
Response.Write("</script>" )
The problem is that when this popup places the date in the textbox on my mainform, I want a postback to initiate. I've set postback = true, on the textbox but for some reason it doesn't register a text change via javascript as being an actual "change" and no postback occurs. The popup correctly inputs the date into the textbox, but without a postback.
Any ideas?
Response.Write("<script language=javascript>")
Response.Write(("window.op
+ (Request.QueryString.Get("
+ (Request.QueryString.Get("
+ (date1 + "';")))))))
Response.Write("window.clo
Response.Write("</script>"
The problem is that when this popup places the date in the textbox on my mainform, I want a postback to initiate. I've set postback = true, on the textbox but for some reason it doesn't register a text change via javascript as being an actual "change" and no postback occurs. The popup correctly inputs the date into the textbox, but without a postback.
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ajax...didn't even know what that was until you recommended it and I looked it up...it looks just like what I need!
As I first approach to Ajax, I would recommend you to install the ASP.NET AJAX extensions (.NET 2.0) and look at the quickstarts examples that come with them.
This is not the optimal AJAX solution (which is the raw javascript XMLHttp coding way) but is far less complicated for the beginner.
The story is as simple as adding an ASP:ScriptManager werbserver control on your page (1 per page only or 1 on the Master page) then putting all the ASP.Net controls that you want to be "ajaxed" inside an ASP:UpdatePanel werbserver control.
Those 2 controls are installed with the ASP.NET AJAX Extensions and are draggable from the ToolBox in VS2005.
This is not the optimal AJAX solution (which is the raw javascript XMLHttp coding way) but is far less complicated for the beginner.
The story is as simple as adding an ASP:ScriptManager werbserver control on your page (1 per page only or 1 on the Master page) then putting all the ASP.Net controls that you want to be "ajaxed" inside an ASP:UpdatePanel werbserver control.
Those 2 controls are installed with the ASP.NET AJAX Extensions and are draggable from the ToolBox in VS2005.
Response.Write("window.ope
Response.Write("window.clo
Response.Write("</script>"
Response.Write("window.ope
+Request.QueryString("Form
Response.Write("window.clo
Response.Write("</script>"