kishore_peddi
asked on
What is the equivalent client-side Java-Script for this server-side script ?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DynamicVar As Integer
DynamicVar = //Dynamically generated value when this button clicked --- WHEN BUTTON CLICKED (REMEMBER)
Dim sb As New StringBuilder
sb.Append("<script language=javascript>")
sb.Append("window.open('")
sb.Append(DynamicVar) //Note that the Dynamically generated value is passed as a parameter here and opens a new window at the same time.
sb.Append("','mywin';")
sb.Append("</script>")
Response.Write(sb.ToString ())
End Sub
I need client-side Java-Script for this. (function on the client-side where i can pass the dynamica value and opens a new window when button clicked).
Thanks,
Kishore
Dim DynamicVar As Integer
DynamicVar = //Dynamically generated value when this button clicked --- WHEN BUTTON CLICKED (REMEMBER)
Dim sb As New StringBuilder
sb.Append("<script language=javascript>")
sb.Append("window.open('")
sb.Append(DynamicVar) //Note that the Dynamically generated value is passed as a parameter here and opens a new window at the same time.
sb.Append("','mywin';")
sb.Append("</script>")
Response.Write(sb.ToString
End Sub
I need client-side Java-Script for this. (function on the client-side where i can pass the dynamica value and opens a new window when button clicked).
Thanks,
Kishore
ASKER
<a href="javascript:OpenIT('m
There is no hyperlink where user can click. This should happen when the button click was done.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
//The value is dynamically generated here. Now i want to pass this value to JavaScript function.
//OpenIT in your example
End Sub
But you can say, i can write like this in page_load (event)
Button1.Attributes.Add("On
But you can't do this also, becuase the value when you are binding will be nothing if you have done in page_load event.
Got it ?
Thanks,
Kishore
where do you expect the "dynamic" value to come from?
as I said in my previous post, can you provide more details about your requirement
as I said in my previous post, can you provide more details about your requirement
ASKER
I will get the dynamic value from database. So i want to pass that value to JavaScript function when the button clicked.
When the button clicked the following things will happen
1. Get the dynamic value from database.
2. Pass that value to the JavaScript function.
3. Invoke the window.open method to open a new window in JavaScript.
4. Pass the dynamic value to the newly opened window as a query string.
Is this insight is enough ?
Thanks,
Kishore
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
what deanvanrooyen has provided you seems like a good solution for your requirement
ASKER
But
protected void Page_Load(object sender, EventArgs e)
{
OpenWindow("Hello there!!!!"); //This is a static value and you are not getting from database.
}
But my dynamic value comes from database when the button clicked.
Thanks,
Kishore
when the button is clicked it postback to the server to get the data then reload the page with the new or updated data
OpenWindow("Hello there!!!!");
"Hello there!!!!" is merely an example - you can put anyhting in its place - the reason was to show you that the string to transfered var which is added to the query string.
You can also transfer the data from page to page now in 2.0
"Hello there!!!!" is merely an example - you can put anyhting in its place - the reason was to show you that the string to transfered var which is added to the query string.
You can also transfer the data from page to page now in 2.0
hopefully this is solved
<script type="text/javascript>
var newwindow;
function OpenIT(url)
{
newwindow=window.open(url,
if (window.focus) {newwindow.focus()}
}
</script>
You pass the url variable to the function to open the window?
use it like this
<a href="javascript:OpenIT('m
if this is not what you looking for, can you explain what you want to achieve ?