Open a new window and pass parameters to it vb.net asp

三世轮回 提交于 2019-12-11 07:28:59

问题


Hi I have a web app which has a listbox of all the available reports for a particular user. I want to open a new page 'ReportViewerPane' when a row is clicked and pass the report name and some parameters through to the reportviewer.aspx I then need to set the ReportViewer controls .reportpath to the correct (passed through) value and set the parameters values (also passed through).

I the moment I have this in the parent page. 'PassParmString' is a textbox on the main form:

function open_win()
{
   var Parms = document.getElementById('<%=PassParmString.ClientID %>');
   window.open("ViewerPane.aspx?prm=" + Parms,"_blank","left=20,top=20,width=1000,height=1140,toolbar=0,resizable=1");
}
</script>

but have no idea how to access the parameter 'Parms' that I pass once I am in in the ReportViewer.aspx form.

Please help.

I'm not good at this. And really trying to understand the posts so please be patient.

Many thanks

Mac


回答1:


you can get it using regular request querystring collection in your ViewerPane.aspx page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) 
    If NOT IsPostBack
        If Not String.IsNullOrEmpty(Request.QueryString("prm"))
           string querystringvalue = Request.QueryString("prm").ToString()
        End If
    End If
End Sub

try changing your javascript to this

<script>
function open_win()
{
   var Parms = document.getElementById('<%=PassParmString.ClientID %>');
   window.open("ViewerPane.aspx?prm=" + Parms.value,"_blank","left=20,top=20,width=1000,height=1140,toolbar=0,resizable=1");
}
</script>

See if this helps :)




回答2:


u are passing the element, and not its value, u can do something like this :

Parms = document.getElementById('PassParmString').value;


来源:https://stackoverflow.com/questions/10224407/open-a-new-window-and-pass-parameters-to-it-vb-net-asp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!