使用 JS 从 GridBoundColumn (GridView) 传递 URL 中的参数 ID

Passing parameter ID in URL from GridBoundColumn (GridView) with JS

我正在使用 ASP.NET 和 C# 使用上面的代码和 JS 我打开新的 window info.aspx 。我试图在 info.aspx 的 URL 中传递一个参数,以了解 项目的 ID (RouteNo) 被按下以显示该项目的信息。 作为注释的行是我尝试获取 RouteNo.

的 Id 的方式

我做错了什么,我该怎么做?有办法吗?

routedoc.aspx

<script>

        var popUpObj;
      //  var par = dataItem["RouteNo"];
         function RowClick(sender, eventArgs) {
             // popUpObj = window.open("Info.aspx?" + para + "",
             popUpObj = window.open("Info.aspx?",
             "ModalPopUp",
             "toolbar=no," +
             "scrollbars=no," +
             "location=no," +
             "statusbar=no," +
             "menubar=no," +
             "resizable=0," +
             "width=500," +
             "height=500," +
             "left = 300," +
             "top=150"
             );
             popUpObj.focus();
             LoadModalDiv();
         }


     function LoadModalDiv()
     {
         var bcgDiv = document.getElementById("divBackground");
         bcgDiv.style.display="block";
     }

     function HideModalDiv() {
         var bcgDiv = document.getElementById("divBackground");
         bcgDiv.style.display = "none";
     }
</script>
<telerik:RadGrid ID="RadGrid1" runat="server" GroupPanelPosition="Top" OnNeedDataSource="RadGrid1_NeedDataSource" AllowMultiRowSelection="True" Skin="Glow" AllowPaging="True"  >
        <ExportSettings>
            <Pdf PageWidth="">
            </Pdf>
        </ExportSettings>
        <ClientSettings>
            <Selecting AllowRowSelect="True"  />
            <ClientEvents OnRowClick="RowClick" />
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" ClientDataKeyNames="RouteNo" PageSize="20"  >
            <Columns>
                <telerik:GridBoundColumn  DataField="RouteNo" HeaderText="RouteNo"  SortExpression="RouteNo"/>
                <telerik:GridBoundColumn DataField="Recipient"  HeaderText="Recipient" ReadOnly="True" SortExpression="Recipient"/>
                <telerik:GridBoundColumn DataField="DocHandle" HeaderText="DocHandle" ReadOnly="True" SortExpression="DocHandle" />
               <telerik:GridBoundColumn DataField="Sender" HeaderText="Sender" ReadOnly="True" SortExpression="Sender" />
                <telerik:GridBoundColumn DataField="TermNo" HeaderText="TermNo" SortExpression="TermNo" />
                <telerik:GridBoundColumn DataField="SentDate" DataFormatString="{0:yyyy/MM/dd}" HeaderText="SentDate" SortExpression="SentDate" />
                <telerik:GridBoundColumn DataField="DueDate" DataFormatString="{0:yyyy/MM/dd}" HeaderText="DueDate" SortExpression="DueDate" />
                <telerik:GridBoundColumn DataField="SentTime" HeaderText="SentTime" SortExpression="SentTime" />
                <telerik:GridBoundColumn DataField="DueTime" HeaderText="DueTime" SortExpression="DueTime" />
                <telerik:GridBoundColumn DataField="Action" HeaderText="Action" SortExpression="Action" />
                <telerik:GridBoundColumn DataField="Notes" HeaderText="Notes" SortExpression="Notes" />
                <telerik:GridBoundColumn DataField="BUDate" HeaderText="BUDate" SortExpression="BUDate" />
           <telerik:GridTemplateColumn HeaderText="Select"  UniqueName="AssetId" >
                <ItemTemplate>
        <asp:CheckBox ID="CheckBox1" runat="server" />
    </ItemTemplate>
               </telerik:GridTemplateColumn>

            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    <telerik:RadButton ID="RadButton1" runat="server"  Text="Delete" OnClick="RadButton1_Click" Skin="Office2010Black" style="position: relative;">
    </telerik:RadButton>

在你的 javascript 函数中试试这个

var routeId = eventArgs.getDataKeyValue('RouteNo');

你会得到routeid,你可以通过它。