简体   繁体   English

将telerik radgrid itemcommand与radwindow结合使用可获取InsertMode Dropdowns的初始数据

[英]Using telerik radgrid itemcommand with a radwindow to get initial data for InsertMode Dropdowns

I need some assistance with the telerik radgrid's itemcommand to get some information from a user adding a new record prior to opening the Grid in Insert mode. 我需要Telerik radgrid的itemcommand方面的帮助,以便在以“插入”模式打开Grid之前,从添加新记录的用户那里获取一些信息。 I have the itemcommand working to open a radwindow, present the user with a dropdown list of items to select from and a radbutton to select the value and close the radwindow, then this value is passed back to the parent page in javascript. 我让itemcommand工作来打开radwindow,为用户提供一个可供选择的项目的下拉列表,以及一个radbutton来选择值并关闭radwindow,然后将此值传递回javascript中的父页面。 All the values are passed down and I can use the alert function to validate this. 所有的值都向下传递,我可以使用警报功能来验证这一点。

So at this point I need to continue the flow to open the radgrid in insert mode and filter a dropdown in the insertmode using the value from the radwindow noted above. 因此,在这一点上,我需要继续执行上述流程以在插入模式下打开radgrid,并使用上述radwindow中的值在插入模式下过滤下拉列表。 In order to use this value I'm attempting to assign it to a hidden radtextbox for use in the ItemDatabound event when the form is loading in insert mode. 为了使用此值,当表单以插入模式加载时,我尝试将其分配给一个隐藏的radtextbox,以在ItemDatabound事件中使用。 Unfortunately, the value isn't being set via the javascript in this hidden control and is acting like it is erroring somewhere in the javascript. 不幸的是,该值不是通过此隐藏控件中的javascript设置的,其行为就像是在javascript中某个地方出错。 I feel like I'm overcomplicating this but was hoping for some guidance on what others have done to implement something like this. 我觉得我太复杂了,但是我希望别人提供一些指导以实现这样的目标。

<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>

Any help is greatly appreciated! 任何帮助是极大的赞赏!

What type of control is the newLenderID2 that you attempt to set a value to? 您尝试将值设置为newLenderID2的控件类型是什么? With this syntax, it should be a RadTextBox. 使用此语法,它应该是一个RadTextBox。 If it is an asp:HiddenFiel, you need 如果是asp:HiddenFiel,则需要

$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 . 另外,您可以触发网格命令,并直接通过网格的masterTableView客户端API和fireCommand()方法向其传递参数(取决于命令): 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. 一个隐藏的字段就足以进行数据传输。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM