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

时间:2015-04-16 08:43:17

标签: javascript c# asp.net telerik parameter-passing

我在C#中使用ASP.NET 使用JS上面的代码我打开新窗口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>

1 个答案:

答案 0 :(得分:0)

在你的javascript函数中试试这个

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

你将获得routeid,你可以通过它。