0

我需要一些关于 Telerik radgrid 的 itemcommand 的帮助,以便在以插入模式打开网格之前从添加新记录的用户那里获取一些信息。我有 itemcommand 工作来打开一个 radwindow,向用户提供一个下拉列表以供选择项目和一个 radbutton 来选择值并关闭 radwindow,然后将此值传递回 javascript 中的父页面。所有的值都被传递下来,我可以使用警报功能来验证这一点。

因此,此时我需要继续流程以在插入模式下打开 radgrid,并使用上述 radwindow 中的值过滤插入模式中的下拉列表。为了使用这个值,我试图将它分配给一个隐藏的 radtextbox,以便在表单以插入模式加载时在 ItemDatabound 事件中使用。不幸的是,该值不是通过这个隐藏控件中的 javascript 设置的,并且表现得好像它在 javascript 中的某个地方出错。我觉得我过于复杂了,但希望能得到一些关于其他人为实现这样的事情所做的指导。

<asp:LinkButton ID="addNewRecord" runat="server" Text="Add New Record" OnClientClick="openWin(); return false;" OnClick="InitInsert">Add New Record</asp:LinkButton>

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">

      //<![CDATA[

function openWin(sender, args) {

    var oWnd = radopen("ParserFileNewDialog.aspx", "RadWindow1");
}       

function OnClientClose(oWnd, args) {

    //get the transferred arguments

    var arg = args.get_argument();

    if (arg) {
        var lenderid = arg.LenderID;
        var tb = null;
        tb = $find("<%=newLenderID2.ClientID %>");
        alert(tb.get_text());
        tb.set_text(lenderid);

        $find("<%=hdnInsertBtn2.ClientID %>").click();
    }
}
          //]]>

 </script>
</telerik:RadCodeBlock>

任何帮助是极大的赞赏!

4

1 回答 1

0

What type of control is the newLenderID2 that you attempt to set a value to? With this syntax, it should be a RadTextBox. If it is an asp:HiddenFiel, you need

$get("<%=newLenderID2.ClientID %>").value = lenderid;

If you get an error - what is the error?

Also, you can fire a grid command and pass an argument to it (depending on the command) directly via the grid's masterTableView client-side API and the fireCommand() method: http://www.telerik.com/help/aspnet-ajax/grid-gridtableview-firecommand.html. Thus, you may not need the hidden button at all. A hidden field will suffice for data transmission.

于 2014-11-12T11:24:22.090 回答