Custom Edit button with parameters

3 posts, 1 answers
  1. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 07 Oct 2011 Link to this post

    Hi all.

    This is an urgent requirement, so open to the community if there are any answers out there.

    I have a hierarchical grid and based on this example http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=grid

    I have the following code to open a pop up modal Radwindow. Tjis is ion the Second level grid within the <DetailTables Tag.

                    <CommandItemTemplate>
                        <a href="#" onclick="return ShowMessageScheduleEdit('<%# eval("Message_ID") %>');">
                            <img src="../App_Themes/Images/add_24.png" border="0" vspace="2" hspace="2"/>Add new Location / Schedule</a>
                    </CommandItemTemplate>
     
    JAVASCRIPT
     
                    function ShowMessageScheduleEdit(Message_ID, MessageSchedule_ID) {
                        var oWnd = radopen("MessageScheduleEdit.aspx?Message_ID=" + Message_ID + "&MessageSchedule_ID=" + MessageSchedule_ID, "MessageScheduleEdit");
                        return false;
                    }

    The trouble is I cant get the value of Message_ID to be passed as a parameter. You will notice that I have 2 parameters in the Javascript, I cant pass the second value either.

    Andy
  2. Answer
    Marin
    Admin
    Marin avatar
    1043 posts

    Posted 12 Oct 2011 Link to this post

    Hello Andy,

     I see that you are calling the ShowMessageScheduleEdit function from the "Add new Location" button. Are you trying to open an insert form or edit a specific record? In the referenced online example there are two different functions for this. The one that edits records is constructed in the ItemCreated event and there it gets the correct parameters. The other one ShowInsertForm simply opens the insert form of the grid and does not need parameters.

    All the best,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 12 Oct 2011 Link to this post

    I want to open the same form. In the form I check the querystring to either set  the form for new or edit. This is why I needed to be able to attach the datakeyvalues to the javascript.

    I have this working now as you say from the itemcreated event. But is wasn't obvious.

    Andy
Back to Top