This is a migrated thread and some comments may be shown as answers.

Custom Edit button with parameters

2 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy Green
Top achievements
Rank 2
Andy Green asked on 07 Oct 2011, 11:51 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Marin
Telerik team
answered on 12 Oct 2011, 09:53 AM
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
0
Andy Green
Top achievements
Rank 2
answered on 12 Oct 2011, 11:46 AM
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
Tags
Grid
Asked by
Andy Green
Top achievements
Rank 2
Answers by
Marin
Telerik team
Andy Green
Top achievements
Rank 2
Share this question
or