0

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

shakenb
  • 1
  • 3

1 Answers1

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.

rdmptn
  • 5,413
  • 1
  • 16
  • 29