hi
i am coding with vb , i need to open pop up window with out display any tool bars. and also need to pass a value to opening page which will need to get related data to display on pop up.
need to cal java script inside a vb method
![]() |
-2 |
![]() |
You can call this either via javascript or use Ajax
Here is a good example
http://www.codeproject.com/KB/custom-controls/asppopup.aspx
or the JavaScript version, which uses the the ScriptManager for the JavaScript:
C#
public static void OpenWindow(Page currentPage, String window, String htmlPage, Int32 width, Int32 height) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("popWin=window.open('"); sb.Append(htmlPage); sb.Append("','"); sb.Append(window); sb.Append("','width="); sb.Append(width); sb.Append(",height="); sb.Append(height); sb.Append(",toolbar=no,location=no, directories=no,status=no,menubar=no,scrollbars=no,resizable=no"); sb.Append("');"); sb.Append("popWin.focus();"); ScriptManager.RegisterClientScriptBlock(currentPage, typeof(ArvalPage), "OpenWindow", sb.ToString(), true); }VB
Public Shared Sub OpenWindow(ByVal currentPage As Page, ByVal window As String, ByVal htmlPage As String, ByVal width As Int32, ByVal height As Int32) Dim sb As New System.Text.StringBuilder() sb.Append("popWin=window.open('") sb.Append(htmlPage) sb.Append("','") sb.Append(window) sb.Append("','width=") sb.Append(width) sb.Append(",height=") sb.Append(height) sb.Append(",toolbar=no,location=no, directories=no,status=no,menubar=no,scrollbars=no,resizable=no") sb.Append("');") sb.Append("popWin.focus();") ScriptManager.RegisterClientScriptBlock(currentPage, GetType(ArvalPage), "OpenWindow", sb.ToString(), True) End Sub
Regards
<<<Bryan Avery>>>
Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
![]() |
-2 |
![]() |
check out this link > Open a popup window after a button click - ASP.NET Forums
and
you can pass value in QueryString ...
window.open ("Default2.aspx?MyData=DataValue", "mywindow","location=1,status=0,toolbar=0,scrollbars=1,width=100,height=100");
hope it helps./.
Thanx,
[KaushaL] || BloG || Profile || Microsoft MVP
"I would love to change the world, but they won’t give me the source code"
Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.
![]() |
-2 |
![]() |
hi Bryan
I have problem with ScriptManager it says ScriptManager ,ArvalPage not declared
what should i do?
![]() |
-1 |
![]() |
in the form_load put this
btn.Attributes.Add("onclick", "window.open('itemsinfo.aspx','','location=0,resizable=0,ScrollBars=1,statusbar=1,width=980,height=800,left=20,top=10,moveable=0') ;return false")
Amjad Ahmad
![]() |
1 |
![]() |
Woops sorry, that what copy and paste does for you, you just need to make sure the second parameter is the Class you are in, if it is on the page it should be GetType(Page)
ScriptManager.RegisterClientScriptBlock(currentPage, GetType(Page), "OpenWindow", sb.ToString(), True)
Hope that fixes your problem
Regards
<<<Bryan Avery>>>
Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
![]() |
0 |
![]() |
for scriptManager do I need to import any thing
![]() |
0 |
![]() |
Just need to make sure you have an Ajax enabled website, click on the Ajax Link at the top of the page if you not done this before
Regards
<<<Bryan Avery>>>
Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
![]() |
-2 |
![]() |
Hi Coppermill,
Coppermill:
ScriptManager.RegisterClientScriptBlock(currentPage, GetType(Page), "OpenWindow", sb.ToString(), True)
I think there is something wrong with this line, which should be
ScriptManager.RegisterClientScriptBlock(currentPage,currentPage.GetType (), "OpenWindow", sb.ToString(), true);
Regards,
Ivan.
![]() |
0 |
![]() |
Well I havent select AJAX need to try that too. In my code after call java script exit from that function and go back to next lines of button click , there i callResponse.Redirect(pbUrl) . I think because of that client script not working.
Public
Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs)........
pbUrl = ProcessChange(strso,process) ' inside this method i have writen that client script which is not working when response redirect there. if not it works and popup window
....
Response.Redirect(pbUrl)
End Sub
![]() |
-2 |
![]() |
Yes you are right
Regards
<<<Bryan Avery>>>
Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.
![]() |
-2 |
![]() |