使用JavaScript将变量值从aspx页面传递到VB.net页面
我正在处理一个现有的项目,并被要求提供一些新的功能。我是VB.net的新手 我在aspx页面上创建了以下HTML表:使用JavaScript将变量值从aspx页面传递到VB.net页面,javascript,asp.net,vb.net,Javascript,Asp.net,Vb.net,我正在处理一个现有的项目,并被要求提供一些新的功能。我是VB.net的新手 我在aspx页面上创建了以下HTML表: <asp:Repeater runat="server" id="DataGrid1" > <HeaderTemplate> <table id="pageviews" class="display"> <thead> <tr>
<asp:Repeater runat="server" id="DataGrid1" >
<HeaderTemplate>
<table id="pageviews" class="display">
<thead>
<tr>
<th>
User ID
</th>
<th>
Page Name
</th>
<th>
Page Views
</th>
</tr>
</thead>
</HeaderTemplate>
<ItemTemplate >
<tr>
<td onclick="fnGetID(id)" id="<%#Eval("page_name") %>|<%#Eval("user_id") %>">
<%#Eval("user_id") %>
</td>
<td onclick="fnGetID(id)" id="<%#Eval("page_name") %>|<%#Eval("user_id") %>">
<%#Eval("page_name")%>
</td>
<td onclick="fnGetID(id)" id="<%#Eval("page_name") %>|<%#Eval("user_id") %>">
<%#Eval("Count") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate >
</table>
</FooterTemplate>
</asp:Repeater>
目前,此onClick还将引导用户进入下一页,新表将显示在该页上,如上所述
我的问题是,如何将变量传递到下一页,它必须在VB.net代码中结束,这样它才能包含在查询中
我试过:
window.location.href = 'IndividualView.aspx?field1=UserID'
但这不会传递变量,而是传递实际文本“UserID”
即使这确实有效,我将如何将它从JavaScript页面转到VB页面
我已经搜索过了,但是这个问题没有明确的解决方案。因为UserID是一个变量
使用
在VB.NET中,您需要使用属性
window.location.href = 'IndividualView.aspx?field1=UserID'
window.location.href = 'IndividualView.aspx?field1=' + UserID;
Dim field1 As String = Request.QueryString("field1")